It’s that time…when the Leaf Spa starts networking…
(I can only imagine the conversations the plants might have…hmmm…did you hear what the basil said to the stevia…huh? There are humans that don’t believe in climate change?….)
In deference to adding Internet and Bluetooth connectivity, I’ll be referring to this “improvement” to the Leaf Spa as iLeafSpa.
Thanks To Those That Went Before
Adafruit – It seems I cannot THANK YOU ENOUGH. This time, for the exceptional BLE Feather products and surrounding experience/support. THANK YOU for showing me that when company leaders and their employees are as passionate about creating awesome experiences as the folks that are trying to make them, there is quality. There is happiness. There is inclusion. THANK YOU. Oh. One more thing. THANK YOU.
Apple – THANK YOU for Swift and Xcode as well as the iPhones to develop and play with. Amazing. These environments keep getting better and better. THANK YOU for caring about security…although, I wish the latest MacBooks were something I wanted to upgrade to (sigh…). Some things are perhaps small items to you….like removing the SD Card slot. But for me…it just seems design is overwhelming customer needs…at least my needs :-).
The Goal of iLeafSpa
The goal of the iLeafSpa is to add Internet and Bluetooth so the Leaf Spa activities can be further automated past controlling relays into more of an expert system through it’s knowledge enhances the growth happiness of the Leaf Spa residence.
High Level Diagram
Here is a high level component diagram of the first iteration of iLeafSpa:
The Leaf Spa currently has Firmware and sensors interacting with the Grow Chamber to adjust the CO2 as well as turn on/off the water pump and LEDs. Settings and sensor readings are written to an SD card. An iPhone 4s takes time lapse movies.
iLeafSpa adds BLE and Internet connectivity by:
- upgrading the Leaf Spa firmware/hardware to include BLE.
- using the iPhone 4s (Smartphone in the image) as a BLE hub.
- using the iPhone 4s to get to the Internet in order to upload log files, time lapse movies, and send alerts.
To The Internet!
More Uses for the iPhone
Adding BLE to the Leaf Spa Firmware/Hardware
I’ll be changing the Arduino Uno out for an Adafruit BLE Feather. E-X-C-I-T-I-N-G…I’m running out of SRAM space on the Arduino Uno I am currently using. Also, adding BLE will require another shield piled on top of what is already there. I have used and like Nordic’s BLE chips. I did an in depth look at the nRF51822… when I built the Ladybug BLuE (starting around this blog post).
Oops! I got so excited to try all this stuff out that I accidentally ordered Adafruit’s Feather 32u4 Bluefruit LE instead of the Feather nRF52832 BLE… MORE reason to resist hitting a purchase button before I’ve had enough coffee…With that said, this version is out of stock. At least I can start with this Feather and move to the other when available.
Testing the 32u4 BLE Feature
Whoa – nice. I installed the Adafruit BLE iOS app after powering up the Feather. The Adafruit App immediately found the Feather. Upon connecting, the App let me know there was an update available and made it s-o-o simple by providing an OTA-DFU. Like I said, nice.
Feather to iOS
Feather
I’ve written Arduino BLE code before. I’ll start here by checking out how the Adafruit team has coded BLE support within an Arduino application. I am interested in what I can pick up from the coding techniques that are used.
- Download and add the Adafruit nRF51 library to the Arduino IDE. DONE.
- Find an example that has the general structure I want to use moving forward. DONE – using callbacks example.
iOS
- Update Mac OS to Sierra to use Xcode 8. Every time I go back to iOS programming, I watch the latest version of the excellent Stanford course on developing iOS apps written in Swift. The latest uses Xcode 8. I started with Xcode 7. However, there were enough UI differences to make me want to upgrade to Xcode 8. In order to upgrade, I needed to (finally?) upgrade to Sierra. I avoid upgrading to a new OS if I am on an older machine until I have an application that requires me to do so. Unfortunately, I was not delighted to upgrade my MacBook with the newer offering since I didn’t see any clear benefits, which means I have been on an older Mac OS version. DONE…took long enough :-).
- Write test code that is based on knowledge picked up getting to know Adafruit’s excellent Swift BLE iOS source code.
What’s Next
I plan to take a staycation this week. The focus of fun will be reintroducing myself to Swift 3 and Xcode 8. The outcome will be an iPhone 4s app that works with the Leaf Spa as a first test in evolving iLeafSpa.
I hope all is well with you. Please find many things to smile about.