Introduction: T.E.E.T.H. - Adding IOT to Your Home With Intel Edison
TEETH stands for Timer Encouraging Everyone To Health. It uses the Intel Edison board's small form factor to upgrade your toothbrush holder to an IOT Home Appliance. This smart upgrade is great for health-conscious folks, those under dental supervision, or anyone who wants to improve their habits. And it's great for families -- who maybe need to encourage children's brushing habits too!
When you're done building, lift your toothbrush up out of the holder to prep the timer that waits for you to start brushing. Then an ADA-recommended two-minute countdown starts and an LED screen displays words of encouragement. The screen fades through colors until you reach the end and sounds play to prompt you from start to finish. Next the timer stops when you replace your toothbrush (or if you leave the room and turn off the lights). After that, the holder stores your timer data to the cloud. If you’ve met your goal, it also sends a congratulatory email. Finally you can login to the cloud and see the progress for every toothbrush in the holder. That’s the IOT data you need to monitor great brushing and encourage healthy habits for everyone at home.
Take a look at this video to get the idea, https://www.youtube.com/watch?v=CrT2JXHnHcU.
Step 1: Tools and Materials
- Toothbrush holder
- Intel Edison compute module
- Edison breakout board
- Lever switches (one for each toothbrush)
- Plastic platforms (one for each toothbrush)
- 10K resistors (one for each toothbrush)
- I2C RGB Backlight LED display
- Photoresistor light sensor
- Piezoceramic buzzer
- Rechargeable battery with USB connections
- Silicon adhesive or sealant
- Project code
- Hookup wire
- Computer with Intel XDK and USB cables
- Soldering iron and solder
- Cutting tools depending on your holder
- Available at https://github.com/ncarver/TEETH
Step 2: Mount the LED Screen to Front
I chose a bamboo toothbrush holder so that I could easily cut out the holes needed to mount the components and run the wires so they are mostly hidden from view.
Cut out a large hole starting from the top of the holder for the entire LCD component. Then cut a smaller hole from the removed piece for the screen itself. Fit the screen and outer bamboo piece back together using the silicon adhesive. Make sure the wires from your LCD can reach the Edison breakout board that will be mounted on the back.
Step 3: Add Lever Switches to Bottom
A toothbrush only weighs about 15 grams, so you will need very sensitive lever switches. Since these switches are tiny, you will also add a platform so the toothbrush can rest anywhere in the holder and still trigger the switch. My platform is cut from a plastic toolbox divider. Glue this to the top with silicon. Solder one wire to the ground/common pin and one to the NC (normally closed) pin.
Touching the back of the lever doesn’t trigger the switch reliably, so mount these switches so that the back is partially inside the wall of the toothbrush holder. As with the LCD screen, make sure your wires can reach the breakout board. I drilled holes in the holder to make room for the components and wires and sealed things up with the silicon.
Step 4: Add Light Detector to Front and Buzzer to Back
To give your appliance some feedback, and awareness, prepare the light detector and buzzer by soldering hookup wire long enough to reach the back of the holder. Drill a hole in the front just large enough for the light detector. Cut a larger hole in the back for the buzzer. As with the other steps, place the components, run the wires to the back, and glue with the silicon adhesive.
Step 5: Wire the Components to the Breakout Board
The Intel Edison breakout board can be a little tricky. Solder to the connections identified on the GitHub documentation, BreakoutBoardConnections.xlsx. Before you connect the switches and photoresistor, include 10K pull-down resistors to reduce the noise and prevent false readings.
Keep the USB ports easily accessible. We still need to program the chip and add the battery.
Step 6: Prepare the Edison and Cloud Services
Because this project uses wi-fi to connect to the cloud and send email, you will also want to setup the board to connect to your wireless router. This is simple using a utility already on the Edison, but more information can be found at the Intel site. https://software.intel.com/en-us/intel-iot-developer-kit-cloud-based-analytics-user-guide
This project also uses the Intel IOT Cloud-based Analytics to store data. You can setup an account at this site, https://dashboard.us.enableiot.com/v1/ui/auth#/login
After you’ve registered your Edison with the analytics dashboard, prepare the cloud for your data by creating custom components. Create one custom component for each toothbrush. The names you give the components will be the names that show up in your reports.
After the components are created on the Intel analytics dashboard, register them with the Edison. The names you use during this step must match the names used in the source code that sends data to the cloud. The Intel site has more detail.
Finally, start the IOT agent on Edison. This built-in service communicates with the cloud and must be running for the code to connect and send data. Test your connection by issuing this command from the Edison terminal:
iotkit-admin observation [component_name] [value]
Step 7: Program the Edison
Now that the hardware and services are ready, it’s time to program the Edison with the T.E.E.T.H. source code.
The Intel XDK is the developer environment that allows you to build node.js projects on the Edison. For this project, download or clone the source at GitHub, https://github.com/ncarver/TEETH. The files follow the structure of a small node.js project.
· readme.md – documentation and licensing info
· package.json – project descriptor that identifies dependent libraries
· main.js – all the code to run T.E.E.T.H.
· node_modules – directory created with the dependent libraries when you first build the project code
Once you have the code, you will want to modify it for your build.
Configure SMTP services
At the top of main.js, there are a number of constants defined. Change the values for MAIL.user, MAIL.pass and MAIL.bruthTo. These properties define how the SMTP mailer services connect to the Internet and where TEETH emails should be sent.
Use registered analytics component names
Use the names you registered with the Analytics Dashboard in the constants section, METRICS.brushComponent. This is an array of all the components used in your project.
Add more toothbrushes
If you’ve built a holder for more than two brushes, you will want to change the constants section of the code to reflect that. The code uses array structures when there are brush-specific values. Add additional array elements for each brush for these constants: METRICS.brushComponent, MAIL. brushTo.PINS.brushSwitch, SCREEN_MSG.brushName, TIME.brushPreptime, TIME.brushGoaltime.
Step 8: Test It Out
Before adding the final enclosure, take some time to test things out while the Edison and the toothbrush holder are still connected to the computer.
Confirm sensors and display
Use the XDK Install/Build button to send the code to the Edison and run NPM to build the node project. Press the Run button to start T.E.E.T.H.
Test the holder by using a toothbrush to trigger each of the lever switches in the holder. You should see the LCD screen light up and be able to follow along with the console output. Also, the buzzer should beep and if you cover the light sensor, the timer should turn off.
Let the timer run to the end so that the methods sending email will execute. Depending on your services, you should receive an email in your inbox within a few minutes.
Watch for analytics
The last piece to confirm is the analytics. Use all the toothbrushes on your holder to test each switch. Log in to the dashboard to confirm that you see data for each custom component.
Step 9: Add the Power
We’re finally ready to untether the Edison from your computer and return the toothbrush holder to the bathroom sink as a standalone IOT device.
Use a rechargeable battery with a USB connection to provide power to the breakout board. Keep the USB port easy to reach for recharging.
Remember that this project will get wet. Cover the entire back of the holder with a plastic enclosure. Take precautions to protect your battery and the Edison as well as any other exposed electronics.
Step 10: Going Further
Feel free to take this project even further. The source code is BSD open source and documented to be easily modified. Text or tweet instead of email. Use mp3 files sent to a speaker instead of a buzzer. Also, this smart toothbrush holder could be even smarter. Think NEST meets TEETH. But even without any adjustments, this is a great project to bring IOT into the most important room in the house. Consider it part one of your own Bathroom 2.0 movement.
We have a be nice policy.
Please be positive and constructive.