Previous posts for this project:
- [AirCare] InTheAir - Project Description
- [AirCare] InTheAir - Week 1: Getting a Launchpad to Blink
- [AirCare] InTheAir - Week 2: Preparing the Beaglebone Black
- [AirCare] InTheAir - Week 3: Fuel Tank Testing
- [AirCare] InTheAir - Week 4: Using the CC3200
- [AirCare] InTheAir - Week 5: openHAB and MQTT
- [AirCare] InTheAir - Week 6: Accessing Fuel Tank's Data
- [AirCare] InTheAir - Week 7: Dust sensor
- [AirCare] InTheAir - Week 8: MSP430FR5969 with Energia14
- [AirCare] InTheAir - Week 11: CC3200, Energia and analogRead()
- [AirCare] InTheAir - Week 12: Automatically starting some things
- [AirCare] InTheAir - Week 13: GP2Y10 BoosterPack
- [AirCare] InTheAir - Week 14: Ordering Parts and PCBs
- [AirCare] InTheAir - Week 16: CNC Milling
- [AirCare] InTheAir - Week 16 bis: Fan Control with MSP430FR5969
- [AirCare] InTheAir - Week 17: Surface Mount Soldering
Introduction
I needed to work on a few things before tomorrow's final summary post and challenge deadline. Here's a quick overview.
Boosterpack
The little boosterpack I soldered last week works! I am able to make more stable measurements using the CC3200's ADC. The Energia sketch was updated to make the conversion back to the actual voltage and then convert it to dust concentration (mg/m3) based on the graph provided in the dust sensor's datasheet.
OpenHAB
I've also been working on the OpenHAB config to get all monitored parameters nicely categorized and organized. A debug menu has also been foreseen, providing additional values for troubleshooting purposes.
Here are some code snippets to better understand how I've created my openHAB configs.
The items file contains the monitored parameters of a remote sensor using MQTT. In the item definition below, you'll see how every item takes the value from a specific MQTT topic. The item file can easily be expanded with new items for extra parameters or extra remote sensors.
Group All String livingroom "Living Room" <sofa> String office "Office" <office> String bedroom1 "Bedroom #1" <bedroom> String bedroom2 "Bedroom #2" <bedroom> Number FT_Voltage_Period "Chart Period" Number FT_TimeToEmpty_Period "Chart Period" Number FT_StateOfCharge_Period "Chart Period" Number FT_Temperature_Period "Chart Period" Number DS_Density_Period "Chart Period" Number DS_Voltage_Period "Chart Period" Number FT_Voltage "Battery Voltage [%d mV]" (All) {mqtt="<[eclipseIot:cc3200-fvan/voltage:state:default]"} Number FT_TimeToEmpty "Battery Time to empty [%d min]" (All) {mqtt="<[eclipseIot:cc3200-fvan/tte:state:default]"} Number FT_StateOfCharge "Battery [%d %%]" <battery> (All) {mqtt="<[eclipseIot:cc3200-fvan/soc:state:default]"} Number FT_Temperature "Temperature [%d <C2><B0>C] "<temperature> (All) {mqtt="<[eclipseIot:cc3200-fvan/temp:state:default]"} Number DS_Density "Dust [%.2f mg/m<C2><B3>]" <dust> (All) {mqtt="<[eclipseIot:cc3200-fvan/ddens:state:default]"} Number DS_Voltage "Dust Voltage [%.2f V]" (All) {mqtt="<[eclipseIot:cc3200-fvan/dvolt:state:default]"} String Launchpad "Launchpad [%s]" (All) {serial="/dev/ttyO0"} Switch Socket "Filter" <socket>
The sitemap structures all the data in the web interface. I opted for a view per room, with every room containing all the monitored parameters. Just like the items file, the sitemap can easily be expanded to contain more rooms.
Frame { Text item=livingroom { Frame { Text item=FT_Temperature valuecolor=[>35="red",>25="orange",>15="green",<15="blue"] { Switch item=FT_Temperature_Period label="Chart Period" mappings=[0="Hour", 1="Day", 2="Week"] Chart item=FT_Temperature period=h refresh=6000 visibility=[FT_Temperature_Period==0, FT_Temperature_Period=="Uninitialized"] Chart item=FT_Temperature period=D refresh=30000 visibility=[FT_Temperature_Period==1] Chart item=FT_Temperature period=W refresh=30000 visibility=[FT_Temperature_Period==2] } Text item=DS_Density { Switch item=DS_Density_Period label="Chart Period" mappings=[0="Hour", 1="Day", 2="Week"] Chart item=DS_Density period=h refresh=6000 visibility=[DS_Density_Period==0, DS_Density_Period=="Uninitialized"] Chart item=DS_Density period=D refresh=30000 visibility=[DS_Density_Period==1] Chart item=DS_Density period=W refresh=30000 visibility=[DS_Density_Period==2] } Text item=FT_StateOfCharge valuecolor=[>79="green",>29="orange",<30="red"] { Switch item=FT_StateOfCharge_Period label="Chart Period" mappings=[0="Hour", 1="Day", 2="Week"] Chart item=FT_StateOfCharge period=h refresh=6000 visibility=[FT_StateOfCharge_Period==0, FT_StateOfCharge_Period=="Uninitialized"] Chart item=FT_StateOfCharge period=D refresh=30000 visibility=[FT_StateOfCharge_Period==1] Chart item=FT_StateOfCharge period=W refresh=30000 visibility=[FT_StateOfCharge_Period==2] } Switch item=Socket } Frame { Text label="Debug" icon="debug" { ... } } } }
The rules files contains some logic to trigger actions depending certain values. For example, when the socket's state is set to ON or OFF a specific value is sent to the MSP430FR5969 Launchpad in order to control the fan with filter. Turning the socket ON or OFF is based on the measured dust concentration.
rule "Fan Control" when Item Socket changed then if(Socket.state == ON) { sendCommand (Launchpad , "#A") } else { sendCommand (Launchpad , "#U") } end rule "Dust Filtering" when Item DS_Density changed then if(DS_Density.state > 0.1) { sendCommand (Socket, ON) } else if(DS_Density.state < 0.05) { sendCommand (Socket, OFF) } end
The events log shows that the fan is triggered to filter when the dust density reached a value higher than 0.1mg/m3.
2015-02-26 21:38:30 - DS_Voltage state updated to 3.534719 2015-02-26 21:38:30 - DS_Density state updated to 0.489120 2015-02-26 21:38:32 - Socket received command ON 2015-02-26 21:38:33 - Launchpad received command #A
The other way around works as well. When the dust density has reached a normal level again, the filtering system is stopped.
2015-02-26 21:40:10 - DS_Voltage state updated to 0.780146 2015-02-26 21:40:10 - DS_Density state updated to 0.030024 2015-02-26 21:40:10 - Socket received command OFF 2015-02-26 21:40:10 - Launchpad received command #U
Enclosures
Finally, I've been making progress on the enclosures for both the control unit and the remote sensor. I milled additional "layers" for the control unit, which when combined, result in an enclosure capable of holding all the electronics involved.
For the remote sensor, I've been running into some issues with my printer. Because the enclosure is too big for my current print platform, I split the part in two. Printing the first part went well and the result was as expected. Things started to go wrong when printing the second part. For some reason, the printer's X-axis is skipping frequently. Why this didn't happen with the first print is a mystery. I've been troubleshooting the issue, but with time running out, alternatives might need to be found. On the bright side, I now know my printer is capable of handling huge bridges without support material, which is rather nice
The final enclosures will be revealed in tomorrow's final summary post (because I'm still working on them).
Conclusion
We're about to enter the last day of the challenge! The solution works, but there are still a few details I'd like to take care of before the final submission. See you tomorrow!
Top Comments