User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
playground:mission-log-template2 [2014/11/05 18:38] – [Hardware] chronoplayground:mission-log-template2 [2015/12/14 23:15] (current) – created chrono
Line 1: Line 1:
-====== Spark-Core Hacking: Read MQ2 sensor data ======+~~DRAFT~~
  
-The [[mission:tech:aquarius]] needs a galley in order to prepare and cook food but due to unforeseen personal circumstances I had to invest into this infrastructure way before than it was necessary since the base trailer for the LM isn't available yet. So I've started to build a prototype kitchen with all that is needed for functional and fun food hacking. One of the primary energy carriers selected for cooking is gas. That can be either LPG (Propane/Butane) or Methane (delivered by utility gas lines). +====== Questionable ideas for the record ======
  
-Since gases can be tricky and risky energy carriers and their combustion also creates potentially harmful by-products like Carbon-Monoxide (CO)it seemed prudent to have an autonomous environmental monitoring and gas leakage detection system, in order to minimize the risk of an undetected leak, which could lead to potentially harmful explosions or high concentration of CO, which could also lead to unconsciousness and death.+Today was one of those rare, lucky days, when you get chance to render someone awestruck with a perfect, bare-eye ISS fly-by observation for his first time. Afterwardshe was curious if that really was the ISS and how I was able to tell and predict it. Good. People who question things are good company. So I told him bit about TLE's and how they can be used to calculate/predict orbits and sent him the link to [[xfce-planet]] along with the HDEV stream website: http://eol.jsc.nasa.gov/HDEV/
  
-To cover everything, whole team of sensors will monitor specific environmental targets and their data will then be fused and used as basis for air quality and threat management to either proactively start to vent air or send out warnings via mail/audio/visual.+Then it was my turn to render myself awestruck with first-time observation of a different kind:
  
-^ Sensor ^ Target ^ Description ^ Mount ^   +https://analytics.usa.gov/
-| MQ7 | CO | Carbon-monoxide (Combustion product) | Top/Ceiling | +
-| MQ4 | CH4 | Methane (Natural Gas) | Top/Ceiling | +
-| MQ2 | C3H8 | Propane (Camping Gas Mix) | Bottom/Floor | +
-| MQ2 | C4H10 | Butane (Camping Gas Mix) | Bottom/Floor | +
-| DS18S20 | Temperature | Room/Air Temperature Monitoring | Top |+
  
-The ideal platform for this project seemed to be a [[https://www.spark.io|spark-core]], since it's a low power device which has to be always on, to justify its existence. The Spark-Core docs claim 50mA  typical current consumption but it clocked in here with 140mA (Tinker Firmware - logged and averaged for 24h). After setting up a local spark cloud and claiming the first core it was time to tinker with it. The default firmware (called tinker) already get's you started quickly with no fuss: You can read and control all digital and analog out and inputs so with just a quick GNUPlot/watch hack I could monitor what a MQ2 sensor detects over the period of one evening, without even having to hack on the firmware itself (fast bootstrapping to get something done, as a prototype/concept/learning). 
  
-I'll try to release the local spark cloud howto soon, to get an easy start with spark-cores without having to use the official spark-cloud and thereby rendering control of the IoT to basically any government "agency" or other potentially evil institutions, groups or people in the world. In the meantime, you can follow these procedures with the official cloud server too, you only need to install [[https://github.com/spark/spark-cli|Spark-CLI]] and add your global cloud account settings to its configuration. +https://github.com/digital-analytics-program/gov-wide-code
- +
-===== Hardware ===== +
- +
-  * Spark-Core + SC Breadboard +
-  * Sainsmart MQ2 el cheapo sensor boards +
-  * Sensirion SHT71 Temperature & Humidity Sensor +
-  * 6 Resistors (Voltage Divider Rx/Ry: 10k/33k +
-  * Adafruit 7-Segment LED Display with HT16K33 controller +
- +
-{{:mission:log:2014:10:spark-core-mq2-mq7-test-setup.jpg?}} +
-===== Software ===== +
- +
-{{:mission:log:2014:10:06:mq2-chart.png|MQ2 Sensor data via spark-core over a period of one evening}} +
- +
-<sxh bash> +
-#!/bin/bash +
- +
-while : +
-do +
-    VAL=$(spark call 1234567890abcdef analogread "A0"+
-    TS=$(date +%s) +
-    echo "${TS} ${VAL}" +
-    echo "${TS} ${VAL}" >> mq2-test.txt +
-    sleep 1 +
-done; +
- +
-</sxh>+
  
 <code> <code>
-$ vi mq2-gnuplot.parm+https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=NASA&subagency=JSCgov/Universal-Federated-Analytics-Min.js?agency=NASA&subagency=JSC
 </code> </code>
 +
 +amsix-ams8.netarch.akamai.com
 +a23-34-186-52.deploy.static.akamaitechnologies.com
  
 <code> <code>
-set terminal pngcairo background "#383734" size 900,500 enhanced font 'Arimo,12' +% DOTGOV WHOIS Server ready 
-set output "mq2-chart.png"+   Domain Name: DIGITALGOV.GOV 
 +   Status: ACTIVE
  
-set title "Mapping MQ2 Sensor Data over one evening" textcolor ls 2 font 'Arial,16' +>>> Last update of whois database: 2015-12-14T23:09:19Z <<< 
-set grid +Please be advised that this whois server only contains information pertaining 
-set lmargin 9  +to the .GOV domainFor information for other domains please use the whois 
- +server at RS.INTERNIC.NET
-set style line 1 lc rgb '#75890c' lt 1 lw 0.5 pt 7 ps 0.75  +
-set style line 2 lt 2 lc rgb "#d8d3c5" pt 6 +
- +
-set ylabel "ADC Read Value" tc ls 2 offset 1,0 +
- +
-set xtics textcolor linestyle 2 rotate +
-set ytics textcolor linestyle 1 +
-set tics nomirror +
- +
-set xdata time +
-set timefmt "%s" +
-set format x "%H:%M" +
- +
-set border linewidth 1 linestyle 2   +
- +
-unset key +
- +
-plot "mq2-test.txt" using 1:2 with linespoints ls 1 +
- +
-quit+
 </code> </code>
- 
-<code> 
-$ watch --interval=1 gnuplot mq2-gnuplot.parm 
-</code> 
- 
-You can use Ristretto or any other image viewer to look at the resulting png. Ristretto automatcally redraws the image, as soon as gnuplot put's out another one. 
- 
-{{tag>software embedded hardware arm spark-core mq2 gas sensor}} 
- 
-{{keywords>Apollo-NG apollo next generation hackerspace hacker space development makerspace fablab diy community open-resource open resource mobile hackbus software embedded hardware arm spark-core mq2 gas sensor}} 
- 
-~~DISCUSSION~~