Device iot-measurements is used to measure temperature. Measurements are make in cycles ( one measure for every 5 minutes ). Results are send to web server plot.ly. Using plot.ly services user can see results in real time. Device use rechargeable batteries. Batteries are charging by solar panel. Microcontroller cc3200 is optimized for low power consumption ( hibernation mode is used ).
hardware
Device iot-measurements based on cc3200 Launchpad module. Launchpad module is supply from two rechargeable AA batteries ( voltage 1.2V capacity 2500 mAh of each ). Batteries are charged by solar panel (voltage 3V, current 80mA). Module LaunchPad and batteries are mounted in Z-30A box (dimension 44 mm / 70 mm / 120 mm). Temperature measurements are done by MCP9700 sensor. Temperature sensor is mounted outside the box. Device iot-measurements is shown on picture 1.
Temperature sensor MCP9700 is supply directly from cc3200 output ( line 61 ). Supply is enabled only dring measure cycle. When measure was done supply is off. Sensor analogue output is connected to cc3200 analog input ( line 58). Batteries are connected in series and battery cell is created ( 2.4 Volt, 2500 mAh ). On the power supply line two capacitors are mounted ( battery dropout protection ). Solar panel is connected to batteries via diode. Schematic is shown on figure 1.
Before you start work with iot-measurements device you must remove diodes D1 and D4 (lower power consumption ) from your CC3200-Launchpad. After that you can mount Launchpad board in box.
functionality
After power on all microcontroller modules are initialized ( UART, Watchdog, ADC Hibernation ). Next device connecting to Access Point. After that device measure temperature and send result into plot.ly web server. Together with temperature also time of measure is send. Actual time is reading from NTP server. Temperature is measure in cyclic mode. One measure for 5 minutes. Between measurements cc3200 microcontroller stay in hibernation mode. Full work cycle is shown on figure 2.
Temperature samples are available in plot.ly service http://goo.gl/8w5WCX . Data registered by device was shown on figure 3.
measurements
In device analogue sensor MCP9700 was connected to cc3200 analogue input ( pin number 58, channel CH2 ). Sensor is supply directly from cc3200 output ( pin number 61 ). Power supply is on before temperature measure and is off when measurements was done. In one measure cycle 16 samples are read. Samples are average and temperature value is calculated ( conversion from voltage to temperature ). Internal A/C module usage was implemented in adc12.c and adc12.h files ( folder hardware). Temperature sensor MCP9700 usage was implemented in mcp9700.c and mcp9700.h files ( folder devices).
hibernation
In device hibernation mode was used. From hibernation device is waking up by Slow Clock Couter. Time of work is defined in HibernateInit procedure and is equal 5 minutes. Hibernation mode is actvated in HibenateEnter procedure. Both procedures are available in hibernate.c file.
plot.ly
Plotly is an online analytics and data visualization tool. Plotly provides online graphing, analytics, and stats tools for individuals and collaboration, as well as scientific graphing libraries for Python, R, MATLAB, Perl, Julia, Arduino and REST. Example of plot.ly graphs are shown on figure 4.>
Before start using plotly you must create personal account. Registration is for free. After registration ( in free option ) you can create 10 private plots and unlimited number of public plots. All user plots are available in Workspace tab.Using plotly service with cc3200 microcontroller you must know your private account API key. This parameter is available on plotly account in Settings tab. Connection with plot.ly server is created in UpdateDataTask procedure ( TCP socket ). The data are sent to the plotly server in procedure SetPlotLyData ( HTTP POST method ). In procedure are set figure parameters (x and y values, plot line type and color, plot title, etc. ). More information about plot.ly is available on plot.ly/learn
software
Project was made in CCSv6. Software was written in C language. In project iot-measurements freeRTOS framework SimpleLink and drivers for cc3200 are used. In thread system (file system.c ) two procedures HibernateEnter and DataUpdateTask are called. In procedure HibernateEnter hibernate mode is activated. In procedure DataUpdateTask : cc3200 create connection with Acces Point ( function Connect2AccessPoint), measure temperature( function Mcp9700Temperature ), read time from SNTP server ( function GetSNTPTime ) and send data to plot.ly server ( function SetPlotLyData ).
In project you can activate Watchdog module ( timer of work equal 50 seconds). Watchdog protect iot-measurements device against hang up.
start
Iot-measurements source code is available on github. You should download code and configure device parameters. In configure.h file you should set Access Point SSID name, password and you should define transmission coding algorithm. Additionally you should set plot.ly user account name and API key. If you want activate Watchdog module you should open project options tab Predefined Symbols and from Undefine NAME you should delete value WATCHDOG_ON. After that in Pre-define NAME you should add value WATCHDOG_ON. After all changes you should rebuild project (Project -> Build All). Binary file iot_measurements.bin will be created. Using CCS UniFlash application you should program S-FLASH memory.
After that you should mount cc3200 launchpad in box. Connect batteries, solar panel and temperature sensor. Iot-measurements device is ready to mount in measure point. Example of implementation is shown on picture 2.
Lukasz Krysiewicz, Poland
Comments