Hi everybody! So today we're going to walk through how to build your very own Lucky Bamboo Zen desk fixture that monitors your activity levels, and alerts you when it's time to exercise, and when you've exercised enough. On top of that, your Zen garden will graph your activity levels day-to-day, so you can historically look back and analyze your healthy decisions!
This project is about staying fit, and combating the ill effects of sitting down for too long in a business setting, as well as integrating current technology trends into our design to keep things cutting edge, and encourage fellow hacksters to get out there and experiment!
Walk-through of How it Works:
The Zen Tracker constantly fluctuates the RGB LED strip for a soothing effect against the vase structure, and the pump perpetually provides ambient flowing water sounds and also circulates the water in the vase to keep the lucky bamboo healthy. When the Zen Tracker is pointed at you, the Ultrasonic RangeFinder detects if you are sitting down as indicated by the green LED next to the sensor. After a predetermined amount of time (50 minutes in our case), the code will activate the CC3100 to send you a text notification to remind you that it's time to get up and be active. After 10 minutes (preset), you will get another notification that you have reached the appropriate active-inactive ratio value and tell you that you can come back and sit down. This takes the stress of monitoring the time off a person's back, so that they can purely engage in staying active and healthy, or concentrated and working. Furthermore, at the end of the day, the CC3100 is activated and delivers all of the data recorded throughout the day to a personal Google Sheet for you to view, showing you a breakdown of your activity levels.
Hardware: At a physical level, this Zen Garden is a glass vase filled with marbles, water and lucky bamboo. There is a motor driven by the MCU that can provide peaceful ambient noise (either bubbles or flowing water sounds), an ultrasonic range finder used to calculate the distance to you from where the fixture is fitted on your desk (activated by the rangefinder are a green and red LED, which respectively inform you whether or not the sensor detects you), a USB charging port, and an analog LED strip that fluctuates through the spectrum of visible light to provide a pleasing ambiance to your fixture. There is also a CC3100 BoosterPack that allows for wifi communication between the device and the cloud.
Here is a short list of parts used for this project:
•TI Parts used:
–MSP432
–BQ25570 – Solar Energy Harvesting Battery Charger
–SN74AUP1G74 – D-Type Flip-Flop
–TPL5100 – Nano Timer
–DRV8850 – Differential Motor Driver
–TPS79633 – LDO Voltage Regulator
–CC3100
•Other Parts used:
–DC to DC Step-up Boost Converter
–Analog LED Strip
–Ultrasonic Ranger
–5V Wall Adapter
Software: As far as software goes, we programmed our MSP432 microprocessor in the Energia IDE, although one could also use Code Composer Studio (CCS). Our software runs the motor, the LED strip (using Pulse Width Modulation), powers the USB port, runs the ultrasonic range finder and determines your activity state (sitting or being active), and then sends notifications to the user based on these inputs, such as "Time to get up!" and then "You've been active long enough, come back and get some work done!" In coordination with this, the MCU documents your activity levels on a day to day basis, and sends this information to a Google Sheet that you can view at your convenience, allowing you to historically look at your level of activity on the web!
-------------------------------------------------------------------------------------------------------------------------
Upload the code: Let's begin with how to build this! First things first, let's get your MSP432 and get the software flashed on there. Go to http://energia.nu/download/ and download the appropriate version of the IDE for your operating system. From here, you can open Energia and copy-paste our provided code onto your board using the Verify and then Upload buttons at the upper left of the IDE. Our code can appropriately be found in our software tab. The reason for flashing our code onto the microprocessor first, is that it let's us troubleshoot our parts as we attach them, to make sure that everything is working correctly!
One adjustment you will want to make in the code will be under the TembooAccount.h tab; you will need to make your own Temboo account and enter your account name where "comets" is written, as well as your app name. Where it says WIFI_SSID and WPA_PASSWORD, these should be changed to your wifi name and password that the device will connect to.
Another adjustment you'll want to make is under Ultrasonic.h; scrolling down you will see some code talking about uploading your data to a Google Sheet.
Here, you're going to want to alter the code to fit your own specific Google Sheet address. This can done using the Energia example code that comes stock with the program, it ought to be called "Send data to Google Sheet", under file->example->temboo.
Useful Graphics for Pin Assignments on the MSP432:
Connect your LED Strip: Take the red, green and blue wires from your LED strip, and attach them to pins P2.7 (40), P2.6 (39), and P2.4 (38) respectively. These are PWM pins on the MSP432 that can alter the intensity of each colored LED on the strip individually.
At this point, there is one connector left on your LED strip; the 12V power wire.
Power your LED strip: So, the MSP432 can only ouput 3.3V, but we need 12V for our LED strip! The solution? A Voltage Step-Up Boost Converter.
This Boost Converter can take in between 3V-5V as an input voltage, and transform that into an output of up to 12V. You can change the output voltage with the potentiometer (the little blue thing, with the turnable knob on top). You'll likely need to hook up your input voltage, and then use a multimeter to measure the output voltage and adjust the potentiometer until the output is where you want it. So, hook up your 3.3V output from your MCU to the Boost Converter's positive input terminal, and a ground from the MCU to the negative input terminal of the converter. Then, take the positive output of the converter and connect that to the 12V power line of the LED strip. The negative output of the converter goes back to ground (such as one on the MCU). Voila! you ought to have light now (assuming that your MCU is powered)! Your LED strip ought to be very bright.
Ultrasonic Range Finder: The ultrasonic range finder is used to determine the distance from the device to you (or any other object) in centimeters. Our code uses an algorithm that takes these readings and calculates the length of time that you are within a certain range (meaning that the device assumes you are sitting down/being inactive).
The Range Finder has 4 pins: Ground, Echo, Trigger, and Vcc. Vcc and Ground obviously supply power. Trigger is the pin that activates to send a pulse from one of the speakers on the device, and Echo is the pin that receives the reflection of the Trigger pulse. Trigger should be connected to P8.5 (41), and Echo to P8.6 (57). Ground can be hooked up to any ground on the MCU, and Vcc needs to be hooked up to a 5V output from the wall adapter.
Hook up the Indicator LEDs: There will be a red and green LED that indicate whether or not you are detected by your Ultrasonic Range Finder. These LEDs need a 150 ohm resistor in line between the MCU pin and the LED itself, this ensures that excess current is drawn by the diode in forward bias, burning out the LED. So hook up a resistor and the Green LED to P8.2 (44), and a resistor and the Red LED to P9.1 (59). then, the opposite terminal of each LED ought to go to ground to complete the circuit.
Testing the Ultrasonic Functionality: In Energia, when you have your MCU hooked up and the code is flashed onto it, you'll be able to press the Serial Monitor button at the top right of the Energia IDE (it looks like a small red box with a magnifying glass in it). This will open a screen that outputs readings from the Ultrasonic Sensor in real time (a reading about every 2 seconds, some variance between readings is normal due to processing time on the MCU). If you see that, then you're all good! You also ought to be able to test the Indicator LEDs by putting your hand in front of the Ultrasonic Sensor and seeing the green LED light up, and then the red LED light up when your hand is removed (provided that the Sensor doesn't sense anything else within range).
USB Charging Port: Next up is the 5V USB charging port. This is probably the easiest part of the entire project. This device only has two pins to be connected: IN+ and IN-. Hook IN+ up to the 3.3V voltage output of the MCU and the onboard boost converter will do the rest. Then hook up IN- to any ground on the MCU. Voila! Now you can charge your phone from your system!
Energy Harvesting BoosterPack: Next up is the custom PCB we built for the MCU. It contains a solar energy harvesting IC (BQ25570), two differential motor drivers (DRV8850), a Nano-timer and a voltage regulator. In this particular application, the only thing being used is one of the motor drivers for the water pump. However, adding this BoosterPack adds a lot of flexibility and potential for new applications to the device, such as having the entire system run off of solar energy!
BoosterPacks actually have to be powered separately from the MSP430 MCU itself. For instance, if you provide power to the MSP432, the BoosterPack won't turn on, but if you provide power to the BoosterPack, it will actually power the MSP432! So, our main concern here is powering the BoosterPack. Remember the 5V power supply we ordered earlier? We're going to want to hook up the positive wire to the 4.3V pin of the J4 terminal, and the negative/ground wire to the middle pin of either the J1 or J2 terminals (both are connected to the same ground). One thing that must be done that isn't in the picture below, is that there must be a jumper on the J6 terminal in order to allow the BoosterPack to power the MSP432. Jumpers should be on the bottom two pins of JP3, JP4 and JP5 (these regulate the nano-timer, in this case it isn't being used). JP1 ought to be jumped on the leftmost pins, and JP2 on the rightmost pins (these switch power to the two motor drivers).
After you have it powered, we need to connect the pins to the MSP432. As you can see, the BoosterPack has its own pin assignments (1-20). The convention I'll use here in describing the connections will be "BoosterPack Pin: MSP432 Pin." There are only a few connections that need to be made since we are only using one of the motor drivers. You will also need to connect, at the bottom right of the BoosterPack, the 3.3V and two ground pins to their corresponding 3.3V and ground inputs on the MSP430.
12:62
13:63
14:64
15:65
17:66
19:67
4:68
Get your pump working: The pump only has two terminals, Vin+ and Vin-. Connect Vin+ to B2 and Vin- to B1. As soon as you do this, you ought to hear and feel the pump activate!
CC3100 Wifi BoosterPack: Connecting this BoosterPack is very simple; just put it directly on top of your MSP432 and match up the pins! Voila! Now you're done, and your device is Wifi-capable!
Casing: The CAD files for 3D printing the casing is supplied in the appropriate section. Print it out, and then install all of your hardware in the designated areas! Once you're done, just add marbles and water! The LED strip fits in a grove under the glass vase, the ultrasonic sensor fits into two holes on the front, next to it are spots for the indicator LEDs. On the side, there is a slot for the USB charging port, and on the back is an area for the pump tubes and power cord to enter.
Now you have your very own Zen Desk fixture that documents your activity levels and soothes you throughout stressful days at work! Just add your Lucky Bamboo and you're all set to go!
Other applications: This system can be much more than just a peaceful activity tracker. With some simple reworking of the code, this installation can be used to notify you of visitors to your desk (point the ultrasonic sensors at the entrance to your office and have the CC3100 text you when people come in!), it can be altered to run off of solar-recharged batteries, and more! If you guys think of any cool applications to pursue with this system, please share with us! Thank you guys for tuning in, and let us know if you have any questions!
More examples: hydroponics unit, wireless window blinds management
PS. There also exists a TI Design based around the custom PCB BoosterPack created for this project that can be found at TI.com!
Comments