This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
playground:mission-log-template2 [2014/10/06 15:09] – created chrono | playground:mission-log-template2 [2014/11/05 20:28] – removed chrono | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Spark-Core Hacking: Read MQ2 sensor data ====== | ||
- | The [[mission: | ||
- | |||
- | Since gases can be a 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 a high concentration of CO, which could also lead to unconsciousness and death. | ||
- | |||
- | To cover everything, a whole team of sensors will monitor specific environmental targets and their data will then be fused and used as a basis for air quality and threat management to either proactively start to vent air or send out warnings via mail/ | ||
- | |||
- | ^ Sensor ^ Target ^ Description ^ Mount ^ | ||
- | | MQ7 | CO | Carbon-monoxide (Combustion product) | Top/Ceiling | | ||
- | | MQ4 | CH4 | Methane (Natural Gas) | Top/Ceiling | | ||
- | | MQ2 | C3H8 | Propane (Camping Gas Mix) | Bottom/ | ||
- | | MQ2 | C4H10 | Butane (Camping Gas Mix) | Bottom/ | ||
- | | DS18S20 | Temperature | Room/Air Temperature Monitoring | Top | | ||
- | |||
- | The ideal platform for this project seemed to be a [[https:// | ||
- | |||
- | 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 " | ||
- | |||
- | ===== Hardware ===== | ||
- | |||
- | * Spark-Core + SC Breadboard | ||
- | * Sainsmart MQ2 el cheapo sensor board | ||
- | * Two Resistors (Voltage Divider R1/R2: 10k/33k | ||
- | |||
- | ===== Software ===== | ||
- | |||
- | {{: | ||
- | |||
- | <sxh bash> | ||
- | #!/bin/bash | ||
- | |||
- | while : | ||
- | do | ||
- | VAL=$(spark call 1234567890abcdef analogread " | ||
- | TS=$(date +%s) | ||
- | echo "${TS} ${VAL}" | ||
- | echo "${TS} ${VAL}" | ||
- | sleep 1 | ||
- | done; | ||
- | |||
- | </ | ||
- | |||
- | < | ||
- | $ vi mq2-gnuplot.parm | ||
- | </ | ||
- | |||
- | < | ||
- | set terminal pngcairo background "# | ||
- | set output " | ||
- | |||
- | set title " | ||
- | set grid | ||
- | set lmargin 9 | ||
- | |||
- | set style line 1 lc rgb '# | ||
- | set style line 2 lt 2 lc rgb "# | ||
- | |||
- | 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 " | ||
- | set format x " | ||
- | |||
- | set border linewidth 1 linestyle 2 | ||
- | |||
- | unset key | ||
- | |||
- | plot " | ||
- | |||
- | quit | ||
- | </ | ||
- | |||
- | < | ||
- | $ watch --interval=1 gnuplot mq2-gnuplot.parm | ||
- | </ | ||
- | |||
- | 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> | ||
- | |||
- | {{keywords> | ||
- | |||
- | ~~DISCUSSION~~ |