I have been working on this IOT thing for a while and wanted to share some details of my latest project. In using the data loggers, I have found that just as I need to be able to use different sensors, I also need to be able to support different methods of recording and reporting data. My first data logger used a MicroSD card for disconnected data collection. Then, I built a version which connected using a cellular network. For this next version, I used WiFi.
I started this project using the Atmel 328p but soon came to a realization, with WiFi, I needed more working memory and would need a more powerful chip. After some trial and error, I decided to use the wonderful Teensy 3.1 from PJRC. This is an Arduino compatible ARM processor with much more memory and speed.
The basic build contains the following components:
- Teensy 3.1 – – $17 from OSHPark – Microcontroller
- Sparkfun MMA8452 -$9.95 – to sense movement
- Adafruit Ultimate GPS – $39.95- for location
- Adafruit CC3000 – $34.95 – TI’s powerful WiFi module on a carrier board
- Custom OSHPark Carrier Board – $35 for three – Power Supply and Connections
- Ubidots IOT site – Free or $5/month for heavy use.
The basic idea is that this board will connect to GPS, obtain a GPS fix and report its location to Ubidots. Ubidots can then display this information in a number of ways including showing the location and the number of times the sensor had been moved that day as the dashboard below shows:
Here is the carrier board in detail:
Here is what the basic board looks like:
And here it is inside its protective Pelican case:
I have posted the firmware sketch and the carrier board Design files to my Github repository.
A few design notes:
- I wanted to use a variety of power sources (including Solar) so I went with the TI TPS63002 Buck-boost switching DC-DC converter. It can be a pain to solder (see tutorial here) but I have yet to find a more versatile power supply.
- I incorporated a very cool battery monitoring approach using a P-MOSFET to allow the data logger to monitor battery voltage and report it to Ubidots. While not as good as true fuel gauge, it should be easy to implement across various power sources. Thanks to Shane Trent for sharing this circuit on his excellent FET Tricks Blog. I have yet to implement this in the firmware but will leave that you to.
- I have put some potentiometers and a momentary contact switch (held high) on the board for future use. One plan I have for the switch is to test for a button press at startup to select the WiFi network to use. The potentiometers are intended to adjust the sensitivity and reporting interval for the logger.
- I added extra connections for power management – you should be able to turn off the WiFi and GPS modules to save power between reporting. The Teensy can be put to sleep as well and the accelerometer can wake it with the provided interrupt connection.
- I also included the battery holder and header pin for using the Teensy’s integrated real time clock. You only need to add the battery and solder a crystal on the underside of the Teensy. This would enable you to set a regular reporting interval even if no movement is detected. Full instructions are provided here.
I hope this information is helpful. Please leave comments or contact me if you have questions. Also, you can follow me on Twitter @chipmc86 to hear about more over time.