Browse Source

Fugh.

master
Your Name 3 years ago
commit
77b25c1a58
941 changed files with 5447150 additions and 0 deletions
  1. BIN
      Air_Quality_Sensor_PPD42/AirQualityDoc.pdf
  2. +15
    -0
      Air_Quality_Sensor_PPD42/LICENSE
  3. +3
    -0
      Air_Quality_Sensor_PPD42/README.md
  4. BIN
      Air_Quality_Sensor_PPD42/bom/bom1.ods
  5. +42
    -0
      Air_Quality_Sensor_PPD42/code/Blink/Blink.ino
  6. +0
    -0
      Air_Quality_Sensor_PPD42/code/USE_ETHERNET_FIN
  7. +8
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test/webSrv/dtostrf.c
  8. +9
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test/webSrv/dtostrf.h
  9. +44
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test/webSrv/pgmspace.h
  10. +69
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test/webSrv/webSrv.ino
  11. +8
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test2/webSrv_plus/dtostrf.c
  12. +9
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test2/webSrv_plus/dtostrf.h
  13. +44
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test2/webSrv_plus/pgmspace.h
  14. +136
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test2/webSrv_plus/webSrv_plus.ino
  15. +8
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test_fin/ethernet_test_fin/dtostrf.c
  16. +9
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test_fin/ethernet_test_fin/dtostrf.h
  17. +173
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test_fin/ethernet_test_fin/ethernet_test_fin.ino
  18. +44
    -0
      Air_Quality_Sensor_PPD42/code/ethernet_test_fin/ethernet_test_fin/pgmspace.h
  19. +35
    -0
      Air_Quality_Sensor_PPD42/code/python_serial/serial.pi
  20. +397
    -0
      Air_Quality_Sensor_PPD42/code/python_serial/temperaturedata.csv
  21. +93
    -0
      Air_Quality_Sensor_PPD42/code/sensortest/sensortest.ino
  22. +5
    -0
      Air_Quality_Sensor_PPD42/docs/1.aux
  23. +98
    -0
      Air_Quality_Sensor_PPD42/docs/1.log
  24. BIN
      Air_Quality_Sensor_PPD42/docs/1.pdf
  25. +59
    -0
      Air_Quality_Sensor_PPD42/docs/1.tex
  26. +38
    -0
      Air_Quality_Sensor_PPD42/docs/1.tex~
  27. +4
    -0
      Air_Quality_Sensor_PPD42/docs/1.toc
  28. +8
    -0
      Air_Quality_Sensor_PPD42/docs/2.aux
  29. +228
    -0
      Air_Quality_Sensor_PPD42/docs/2.log
  30. BIN
      Air_Quality_Sensor_PPD42/docs/2.pdf
  31. +88
    -0
      Air_Quality_Sensor_PPD42/docs/2.tex
  32. +59
    -0
      Air_Quality_Sensor_PPD42/docs/2.tex~
  33. +6
    -0
      Air_Quality_Sensor_PPD42/docs/2.toc
  34. +13
    -0
      Air_Quality_Sensor_PPD42/docs/3.aux
  35. +248
    -0
      Air_Quality_Sensor_PPD42/docs/3.log
  36. BIN
      Air_Quality_Sensor_PPD42/docs/3.pdf
  37. +103
    -0
      Air_Quality_Sensor_PPD42/docs/3.tex
  38. +88
    -0
      Air_Quality_Sensor_PPD42/docs/3.tex~
  39. +9
    -0
      Air_Quality_Sensor_PPD42/docs/3.toc
  40. +19
    -0
      Air_Quality_Sensor_PPD42/docs/4.aux
  41. +514
    -0
      Air_Quality_Sensor_PPD42/docs/4.log
  42. BIN
      Air_Quality_Sensor_PPD42/docs/4.pdf
  43. +258
    -0
      Air_Quality_Sensor_PPD42/docs/4.tex
  44. +103
    -0
      Air_Quality_Sensor_PPD42/docs/4.tex~
  45. +14
    -0
      Air_Quality_Sensor_PPD42/docs/4.toc
  46. +19
    -0
      Air_Quality_Sensor_PPD42/docs/5.aux
  47. +466
    -0
      Air_Quality_Sensor_PPD42/docs/5.log
  48. BIN
      Air_Quality_Sensor_PPD42/docs/5.pdf
  49. +261
    -0
      Air_Quality_Sensor_PPD42/docs/5.tex
  50. +258
    -0
      Air_Quality_Sensor_PPD42/docs/5.tex~
  51. +14
    -0
      Air_Quality_Sensor_PPD42/docs/5.toc
  52. +19
    -0
      Air_Quality_Sensor_PPD42/docs/6.aux
  53. +470
    -0
      Air_Quality_Sensor_PPD42/docs/6.log
  54. BIN
      Air_Quality_Sensor_PPD42/docs/6.pdf
  55. +261
    -0
      Air_Quality_Sensor_PPD42/docs/6.tex
  56. +14
    -0
      Air_Quality_Sensor_PPD42/docs/6.toc
  57. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs1.odt
  58. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs10.odt
  59. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs11.odt
  60. +14841
    -0
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs11.odt.saved
  61. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs12.odt
  62. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs13.odt
  63. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs14.odt
  64. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs16.odt
  65. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs17.odt
  66. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs2.odt
  67. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs3.odt
  68. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs4.odt
  69. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs5.odt
  70. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs6.odt
  71. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs7.odt
  72. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs8.odt
  73. BIN
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs9.odt
  74. +12191
    -0
      Air_Quality_Sensor_PPD42/docs/AirQualityDocs9.odt.saved
  75. BIN
      Air_Quality_Sensor_PPD42/footprints/animepic.pretty/__konoe_subaru_mayo_chiki_drawn_by_kinta_distortion__4d444ae4fe11d57511e8aa20c75c5756.png
  76. +898
    -0
      Air_Quality_Sensor_PPD42/footprints/animepic.pretty/chronocross_kid.kicad_mod
  77. +26113
    -0
      Air_Quality_Sensor_PPD42/footprints/animepic.pretty/konoesubaru.kicad_mod
  78. +224
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/enc28j60_arduino.bak
  79. +224
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/enc28j60_arduino.sch
  80. +4
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/fp-lib-table
  81. +1087
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield-B.Cu.gbr
  82. +79
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield-B.Mask.gbr
  83. +15
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield-B.Paste.gbr
  84. +15
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield-B.SilkS.gbr
  85. +30
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield-Edge.Cuts.gbr
  86. +2083
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield-F.Cu.gbr
  87. +114
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield-F.Mask.gbr
  88. +50
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield-F.Paste.gbr
  89. +2615
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield-F.SilkS.gbr
  90. +80
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield.drl
  91. BIN
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev1/msp_shield.zip
  92. +2208
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev2.1/msp_shield-B.Cu.gbl
  93. +142
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev2.1/msp_shield-B.Mask.gbs
  94. +15
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev2.1/msp_shield-B.Paste.gbp
  95. +13288
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev2.1/msp_shield-B.SilkS.gbo
  96. +30
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev2.1/msp_shield-Edge.Cuts.gm1
  97. +2891
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev2.1/msp_shield-F.Cu.gtl
  98. +180
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev2.1/msp_shield-F.Mask.gts
  99. +53
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev2.1/msp_shield-F.Paste.gtp
  100. +4279
    -0
      Air_Quality_Sensor_PPD42/pcb/msp_shield/gerber_rev2.1/msp_shield-F.SilkS.gto

BIN
Air_Quality_Sensor_PPD42/AirQualityDoc.pdf View File


+ 15
- 0
Air_Quality_Sensor_PPD42/LICENSE
File diff suppressed because it is too large
View File


+ 3
- 0
Air_Quality_Sensor_PPD42/README.md View File

@ -0,0 +1,3 @@
# Air_Quality_Sensor_PPD42
Testing out the PPD42 Air Quality Sensor, with an MSP430 Launchpad and graphing the data with GNUplot.

BIN
Air_Quality_Sensor_PPD42/bom/bom1.ods View File


+ 42
- 0
Air_Quality_Sensor_PPD42/code/Blink/Blink.ino View File

@ -0,0 +1,42 @@
/*
Blink
The basic Energia example.
Turns on an LED on for one second, then off for one second, repeatedly.
Change the LED define to blink other LEDs.
Hardware Required:
* LaunchPad with an LED
This example code is in the public domain.
*/
// most launchpads have a red LED
//#define LED RED_LED
//see pins_energia.h for more LED definitions
#define LED GREEN_LED
#define DUSTSENSORPIN 1
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(LED, OUTPUT);
pinMode(DUSTSENSORPIN, INPUT);
Serial.begin(4800);
}
// the loop routine runs over and over again forever:
void loop() {
Serial.println("test");
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
int DustSensorState = digitalRead(DUSTSENSORPIN);
Serial.print("Sensor reads:");
Serial.println(DustSensorState);
}

+ 0
- 0
Air_Quality_Sensor_PPD42/code/USE_ETHERNET_FIN View File


+ 8
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test/webSrv/dtostrf.c View File

@ -0,0 +1,8 @@
#include <stdio.h>
char *dtostrf (double val, signed char width, unsigned char prec, char *sout) {
char fmt[20];
sprintf(fmt, "%%%d.%df", width, prec);
sprintf(sout, fmt, val);
return sout;
}

+ 9
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test/webSrv/dtostrf.h View File

@ -0,0 +1,9 @@
#ifdef __cplusplus
extern "C" {
#endif
char *dtostrf (double val, signed char width, unsigned char prec, char *sout);
#ifdef __cplusplus
}
#endif

+ 44
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test/webSrv/pgmspace.h View File

@ -0,0 +1,44 @@
#ifndef __PGMSPACE_H_
#define __PGMSPACE_H_ 1
#include <inttypes.h>
#define PROGMEM
#define PGM_P const char *
#define PSTR(str) (str)
#define _SFR_BYTE(n) (n)
typedef void prog_void;
typedef char prog_char;
typedef unsigned char prog_uchar;
typedef int8_t prog_int8_t;
typedef uint8_t prog_uint8_t;
typedef int16_t prog_int16_t;
typedef uint16_t prog_uint16_t;
typedef int32_t prog_int32_t;
typedef uint32_t prog_uint32_t;
#define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
#define strcpy_P(dest, src) strcpy((dest), (src))
#define strcat_P(dest, src) strcat((dest), (src))
#define strcmp_P(a, b) strcmp((a), (b))
#define strstr_P(a, b) strstr((a), (b))
#define strlen_P(a) strlen((a))
#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__)
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
#define pgm_read_dword(addr) (*(const unsigned long *)(addr))
#define pgm_read_float(addr) (*(const float *)(addr))
#define pgm_read_byte_near(addr) pgm_read_byte(addr)
#define pgm_read_word_near(addr) pgm_read_word(addr)
#define pgm_read_dword_near(addr) pgm_read_dword(addr)
#define pgm_read_float_near(addr) pgm_read_float(addr)
#define pgm_read_byte_far(addr) pgm_read_byte(addr)
#define pgm_read_word_far(addr) pgm_read_word(addr)
#define pgm_read_dword_far(addr) pgm_read_dword(addr)
#define pgm_read_float_far(addr) pgm_read_float(addr)
#endif

+ 69
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test/webSrv/webSrv.ino View File

@ -0,0 +1,69 @@
//--- made by SKA ---
//--- test EtherEncLib
// adapted by Renato Aloi
// May 2015
// removed SD Card part for future implementation
#include <SPI.h>
#include <EtherEncLib.h>
#if (ESP8266)
#include <pgmspace.h>
#else
#include <avr/pgmspace.h>
#endif
static unsigned char ipaddr[] = { 192, 168, 1, 125 };
static unsigned char macaddr[] = { 0x00, 0x11, 0x22, 0x44, 0x00, 0x25 };
EtherEncLib eElib(80);
const PROGMEM char resp200Txt[] = {"HTTP/1.0 200 OK\n\rContent-Type: text/html\n\rPragma: no-cache\n\r\n\r"};
void setup()
{
#if (ESP8266)
Serial.begin(115200);
pinMode(5,OUTPUT); //--- ? -- SS pin must be output # by Renato Aloi
#else
Serial.begin(9600);
pinMode(10,OUTPUT); //--- ? -- SS pin must be output # by Renato Aloi
#endif
eElib.begin(ipaddr,macaddr);
Serial.println(F("------ program start -----------"));
//Serial.println(F("NO SDCARD version")); // by Renato Aloi
}
void loop() {
if ( eElib.available() )
{
Serial.println(eElib.getParams());
eElib.print((char *)&resp200Txt[0],strlen_P(&resp200Txt[0]));
if (eElib.isIndexHtml)
{
eElib.print("<HTML><body><H1>Hello World!</H1>");
eElib.print("<form method=POST>");
eElib.print("<input type=text name=nome />");
eElib.print("<input type=submit value=OK />");
eElib.print("</form></body>");
eElib.print("</HTML>");
}
else if (eElib.isPost)
{
eElib.print("<HTML><body><H1>POST Params: ");
eElib.print(eElib.getParams());
eElib.print("</H1></body>");
eElib.print("</HTML>");
}
else if (eElib.isGet)
{
eElib.print("<HTML><body><H1>GET Params: ");
eElib.print(eElib.getParams());
eElib.print("</H1></body>");
eElib.print("</HTML>");
}
eElib.close();
}
}

+ 8
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test2/webSrv_plus/dtostrf.c View File

@ -0,0 +1,8 @@
#include <stdio.h>
char *dtostrf (double val, signed char width, unsigned char prec, char *sout) {
char fmt[20];
sprintf(fmt, "%%%d.%df", width, prec);
sprintf(sout, fmt, val);
return sout;
}

+ 9
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test2/webSrv_plus/dtostrf.h View File

@ -0,0 +1,9 @@
#ifdef __cplusplus
extern "C" {
#endif
char *dtostrf (double val, signed char width, unsigned char prec, char *sout);
#ifdef __cplusplus
}
#endif

+ 44
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test2/webSrv_plus/pgmspace.h View File

@ -0,0 +1,44 @@
#ifndef __PGMSPACE_H_
#define __PGMSPACE_H_ 1
#include <inttypes.h>
#define PROGMEM
#define PGM_P const char *
#define PSTR(str) (str)
#define _SFR_BYTE(n) (n)
typedef void prog_void;
typedef char prog_char;
typedef unsigned char prog_uchar;
typedef int8_t prog_int8_t;
typedef uint8_t prog_uint8_t;
typedef int16_t prog_int16_t;
typedef uint16_t prog_uint16_t;
typedef int32_t prog_int32_t;
typedef uint32_t prog_uint32_t;
#define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
#define strcpy_P(dest, src) strcpy((dest), (src))
#define strcat_P(dest, src) strcat((dest), (src))
#define strcmp_P(a, b) strcmp((a), (b))
#define strstr_P(a, b) strstr((a), (b))
#define strlen_P(a) strlen((a))
#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__)
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
#define pgm_read_dword(addr) (*(const unsigned long *)(addr))
#define pgm_read_float(addr) (*(const float *)(addr))
#define pgm_read_byte_near(addr) pgm_read_byte(addr)
#define pgm_read_word_near(addr) pgm_read_word(addr)
#define pgm_read_dword_near(addr) pgm_read_dword(addr)
#define pgm_read_float_near(addr) pgm_read_float(addr)
#define pgm_read_byte_far(addr) pgm_read_byte(addr)
#define pgm_read_word_far(addr) pgm_read_word(addr)
#define pgm_read_dword_far(addr) pgm_read_dword(addr)
#define pgm_read_float_far(addr) pgm_read_float(addr)
#endif

+ 136
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test2/webSrv_plus/webSrv_plus.ino View File

@ -0,0 +1,136 @@
#include <math.h>
//--- made by SKA ---
//--- test EtherEncLib
// adapted by Renato Aloi
// May 2015
// removed SD Card part for future implementation
#include <SPI.h>
#include <EtherEncLib.h>
#if (ESP8266)
#include <pgmspace.h>
#else
#include <avr/pgmspace.h>
#endif
static unsigned char ipaddr[] = { 192, 168, 1, 125 };
static unsigned char macaddr[] = { 0x00, 0x11, 0x22, 0x44, 0x00, 0x25 };
EtherEncLib eElib(80);
const PROGMEM char resp200Txt[] = {"HTTP/1.0 200 OK\n\rContent-Type: text/html\n\rPragma: no-cache\n\r\n\r"};
//sensor start
int DustSensePin = 13;
unsigned long duration;
unsigned long starttime;
unsigned long sampletime_ms = 30000;//sample 30s ;
unsigned long lowpulseoccupancy = 0;
float ratio = 0;
float concentration = 0;
void setup()
{
#if (ESP8266)
Serial.begin(115200);
pinMode(5,OUTPUT); //--- ? -- SS pin must be output # by Renato Aloi
#else
Serial.begin(9600);
pinMode(8,OUTPUT); //--- ? -- SS pin must be output # by Renato Aloi
#endif
eElib.begin(ipaddr,macaddr);
Serial.println(F("------ program start -----------"));
//Serial.println(F("NO SDCARD version")); // by Renato Aloi
pinMode(DustSensePin,INPUT);
starttime = millis();//get the current time;
}
void loop() {
duration = pulseIn(DustSensePin, LOW);
lowpulseoccupancy = lowpulseoccupancy+duration;
if ((millis()-starttime) > sampletime_ms)//if the sample time == 30s
{
ratio = lowpulseoccupancy/(sampletime_ms*10.0); // Integer percentage 0=>100
//float exponential power - DOESN"T BUILD
//concentration = 1.1*powf(ratio,3)-3.8*powf(ratio,2)+520*ratio+0.62; // using spec sheet curve
//leaner exponential power
concentration = 1.1*ipow(ratio,3)-3.8*ipow(ratio,2)+520*ratio+0.62; // using spec sheet curve
//Serial.print(lowpulseoccupancy);
//Serial.print(",");
//Serial.print(ratio);
//Serial.print(",");
//Serial.println(concentration);
//lowpulseoccupancy = 0;
starttime = millis();
Serial.println("DataGet");
}
if ( eElib.available() )
{
Serial.println(eElib.getParams());
eElib.print((char *)&resp200Txt[0],strlen_P(&resp200Txt[0]));
if (eElib.isIndexHtml)
{
eElib.print("<HTML><body><H1>Hello World!</H1>");
//eElib.print("<form method=POST>");
eElib.print("<br>");
eElib.print((int)lowpulseoccupancy);
eElib.print("<br>");
eElib.print((int)ratio);
eElib.print("<br>");
eElib.print((int)concentration);
eElib.print("<br>");
//eElib.print("</form></body>");
eElib.print("</body></HTML>");
//Serial.print(lowpulseoccupancy);
//Serial.print(",");
//Serial.print(ratio);
//Serial.print(",");
//Serial.println(concentration);
}
/*
else if (eElib.isPost)
{
eElib.print("<HTML><body><H1>POST Params: ");
eElib.print(eElib.getParams());
eElib.print("</H1></body>");
eElib.print("</HTML>");
}
else if (eElib.isGet)
{
eElib.print("<HTML><body><H1>GET Params: ");
eElib.print(eElib.getParams());
eElib.print("</H1></body>");
eElib.print("</HTML>");
}*/
eElib.close();
}
}
int ipow(int base, int exp)
{
int result = 1;
for (;;)
{
if (exp & 1)
result *= base;
exp >>= 1;
if (!exp)
break;
base *= base;
}
return result;
}

+ 8
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test_fin/ethernet_test_fin/dtostrf.c View File

@ -0,0 +1,8 @@
#include <stdio.h>
char *dtostrf (double val, signed char width, unsigned char prec, char *sout) {
char fmt[20];
sprintf(fmt, "%%%d.%df", width, prec);
sprintf(sout, fmt, val);
return sout;
}

+ 9
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test_fin/ethernet_test_fin/dtostrf.h View File

@ -0,0 +1,9 @@
#ifdef __cplusplus
extern "C" {
#endif
char *dtostrf (double val, signed char width, unsigned char prec, char *sout);
#ifdef __cplusplus
}
#endif

+ 173
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test_fin/ethernet_test_fin/ethernet_test_fin.ino View File

@ -0,0 +1,173 @@
#include <math.h>
//--- made by SKA ---
//--- test EtherEncLib
// adapted by Renato Aloi
// May 2015
// removed SD Card part for future implementation
#include <SPI.h>
#include <EtherEncLib.h>
#if (ESP8266)
#include <pgmspace.h>
#else
#include <avr/pgmspace.h>
#endif
static unsigned char ipaddr[] = { 192, 168, 1, 125 };
static unsigned char macaddr[] = { 0x00, 0x11, 0x22, 0x44, 0x00, 0x25 };
EtherEncLib eElib(80);
const PROGMEM char resp200Txt[] = {"HTTP/1.0 200 OK\n\rContent-Type: text/html\n\rPragma: no-cache\n\r\n\r"};
//sensor start
int DustSensePin = 13;
//copy and paste for 50 zeros
//this should probably not be global...
//Int means max 65535 or so. May need to move to long
//making this too high runs into memory problems
//This resolution will be relatively good enough for now.
//If we need more space, then store only the first value in an unsigned int or long, then
//bit shift it down to reduce size, and store in array in a lower size var.
unsigned int reading[30] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
unsigned long sampletime_ms = 60000;//sample 30s ;
unsigned long starttime = 0;
unsigned char x = 0;
unsigned char toplimit = 0;
unsigned long sum = 0; //highest number possible - 32 bit unsigned, so 4 billion
unsigned int average = 0;
unsigned int sumcutdown = 0;
void setup()
{
Serial.println(F("Setup begin"));
#if (ESP8266)
Serial.begin(115200);
pinMode(5,OUTPUT); //--- ? -- SS pin must be output # by Renato Aloi
#else
Serial.begin(9600);
pinMode(8,OUTPUT); //--- ? -- SS pin must be output # by Renato Aloi
#endif
eElib.begin(ipaddr,macaddr);
Serial.println(F("------ program start -----------"));
//Serial.println(F("NO SDCARD version")); // by Renato Aloi
pinMode(DustSensePin,INPUT);
starttime = millis();//get the current time;
}
void loop() {
reading[x] = pulseIn(DustSensePin, LOW, 500000);
//Print out readings on serial, as they come
if (reading[x] != 0){
Serial.println(reading[x]);
x=x+1;
if(x>50){
x = 0;
}
}
if ((millis()-starttime) > sampletime_ms){
//reset these, no need to display on webpage anymore
sum = 0;
average = 0;
toplimit = x; // don't read the zeros
/*
if(toplimit == 0){
toplimit = 1; //to avoid divide by zero, in case sum / toplimit is both zero
}
*/
for (x=0; x<toplimit; x++){
sum = sum + reading[x];
}
average = sum / toplimit;
//see work docs. Bit shift to allow for lower resolution for built in print functions.
//outputting an int - 16 bit, but we originally have a 32 bit)
sumcutdown = sum >> 4;
//Serial.print("Average Get!: ");
//Serial.println(average); //average when 0 is 65535, so it's invalid (dividing by zero - sum divided by top limit which are both zero)
//but we don't even want the average. It's just for testing here.
Serial.print("Sum Get!: ");
Serial.println(sum); //this is what we care about
Serial.print("Sumcutdown Get!: ");
Serial.println(sumcutdown); //bit shifted
//reset everything that can be reset after a minute
x = 0;
toplimit = 0;
for (x=0; x<toplimit; x++){
reading[x] = 0;
}
starttime = millis();
}
if ( eElib.available() )
{
Serial.println(eElib.getParams());
eElib.print((char *)&resp200Txt[0],strlen_P(&resp200Txt[0]));
if (eElib.isIndexHtml)
{
eElib.print("<pre><H1>Hello World!</H1>");
//eElib.print("<form method=POST>");
eElib.print("<br>");
eElib.print("The Sum is: ");
eElib.print((unsigned)sumcutdown);
//eElib.print("</form></body>");
eElib.print("</pre>");
}
/*
else if (eElib.isPost)
{
eElib.print("<HTML><body><H1>POST Params: ");
eElib.print(eElib.getParams());
eElib.print("</H1></body>");
eElib.print("</HTML>");
}
else if (eElib.isGet)
{
eElib.print("<HTML><body><H1>GET Params: ");
eElib.print(eElib.getParams());
eElib.print("</H1></body>");
eElib.print("</HTML>");
}*/
eElib.close();
}
}
//unused
/*
int ipow(int base, int exp)
{
int result = 1;
for (;;)
{
if (exp & 1)
result *= base;
exp >>= 1;
if (!exp)
break;
base *= base;
}
return result;
}*/

+ 44
- 0
Air_Quality_Sensor_PPD42/code/ethernet_test_fin/ethernet_test_fin/pgmspace.h View File

@ -0,0 +1,44 @@
#ifndef __PGMSPACE_H_
#define __PGMSPACE_H_ 1
#include <inttypes.h>
#define PROGMEM
#define PGM_P const char *
#define PSTR(str) (str)
#define _SFR_BYTE(n) (n)
typedef void prog_void;
typedef char prog_char;
typedef unsigned char prog_uchar;
typedef int8_t prog_int8_t;
typedef uint8_t prog_uint8_t;
typedef int16_t prog_int16_t;
typedef uint16_t prog_uint16_t;
typedef int32_t prog_int32_t;
typedef uint32_t prog_uint32_t;
#define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
#define strcpy_P(dest, src) strcpy((dest), (src))
#define strcat_P(dest, src) strcat((dest), (src))
#define strcmp_P(a, b) strcmp((a), (b))
#define strstr_P(a, b) strstr((a), (b))
#define strlen_P(a) strlen((a))
#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__)
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
#define pgm_read_dword(addr) (*(const unsigned long *)(addr))
#define pgm_read_float(addr) (*(const float *)(addr))
#define pgm_read_byte_near(addr) pgm_read_byte(addr)
#define pgm_read_word_near(addr) pgm_read_word(addr)
#define pgm_read_dword_near(addr) pgm_read_dword(addr)
#define pgm_read_float_near(addr) pgm_read_float(addr)
#define pgm_read_byte_far(addr) pgm_read_byte(addr)
#define pgm_read_word_far(addr) pgm_read_word(addr)
#define pgm_read_dword_far(addr) pgm_read_dword(addr)
#define pgm_read_float_far(addr) pgm_read_float(addr)
#endif

+ 35
- 0
Air_Quality_Sensor_PPD42/code/python_serial/serial.pi View File

@ -0,0 +1,35 @@
#!/usr/bin/python
'''
Original data collection script by Ben Kenney - July 2012
This program reads data coming from the serial port and saves that data to a text file. It expects data in the following format with a comma (,) as a separator:
"value1,value2"
It assumes that the Arduino shows up in /dev/ttyACM0 on the Raspberry Pi which should happen if you're using Debian.
'''
import serial
from time import strftime
from datetime import datetime, time
ser = serial.Serial('/dev/ttyACM0',9600)
startTime = datetime.now()
try:
while 1:
line=ser.readline().rstrip()
# temp,outsidetemp=line.split(",")
# we have more data.
# I don't know what they are yet...
read1,read2,read3=line.split(",");
now = datetime.now()
elapsedTime = now-startTime
elapsedSeconds = (elapsedTime.microseconds+(elapsedTime.days*24*3600+elapsedTime.seconds)*10**6)/10**6
#this is the original
#
# f=open('/home/pi/sensors/sensordata/temperaturedata.csv','a')
#
f=open('./temperaturedata.csv','a')
print >>f,("%s,%s,%s,%s,%s"%(now.strftime("%Y-%m-%d %H:%M:%S"),elapsedSeconds,read1,read2,read3))
f.close()
except KeyboardInterrupt:
print "\ndone"

+ 397
- 0
Air_Quality_Sensor_PPD42/code/python_serial/temperaturedata.csv View File

@ -0,0 +1,397 @@
2019-01-05 19:59:18,27,112105,0.37,194.46
2019-01-05 19:59:48,58,104586,0.35,181.49
2019-01-05 20:00:20,90,73314,0.24,127.49
2019-01-05 20:00:51,120,269665,0.90,465.77
2019-01-05 20:01:22,151,271773,0.91,469.39
2019-01-05 20:01:53,183,116528,0.39,202.09
2019-01-05 20:02:24,213,162353,0.54,281.09
2019-01-05 20:02:55,245,168318,0.56,291.37
2019-01-05 20:03:26,275,137650,0.46,238.52
2019-01-05 20:03:56,306,300888,1.00,519.45
2019-01-05 20:04:27,337,118525,0.40,205.54
2019-01-05 20:04:58,368,156318,0.52,270.70
2019-01-05 20:05:29,399,253288,0.84,437.61
2019-01-05 20:06:01,430,285557,0.95,493.09
2019-01-05 20:06:32,461,115118,0.38,199.66
2019-01-05 20:07:03,492,157681,0.53,273.04
2019-01-05 20:07:34,523,313713,1.05,541.49
2019-01-05 20:08:05,554,54871,0.18,95.61
2019-01-05 20:08:37,586,76294,0.25,132.64
2019-01-05 20:09:09,618,215227,0.72,372.13
2019-01-05 20:09:39,649,257114,0.86,444.19
2019-01-05 20:10:10,680,105383,0.35,182.86
2019-01-05 20:10:41,711,231989,0.77,400.97
2019-01-05 20:11:12,742,157832,0.53,273.30
2019-01-05 20:11:43,772,4873,0.02,9.07
2019-01-05 20:12:15,804,143329,0.48,248.31
2019-01-05 20:12:46,836,157660,0.53,273.01
2019-01-05 20:13:18,867,291728,0.97,503.70
2019-01-05 20:13:49,899,0,0.00,0.62
2019-01-05 20:14:21,930,106930,0.36,185.53
2019-01-05 20:14:53,962,119659,0.40,207.49
2019-01-05 20:15:25,994,135758,0.45,235.26
2019-01-05 20:15:55,1025,208761,0.70,361.00
2019-01-05 20:16:26,1056,71436,0.24,124.24
2019-01-05 20:16:57,1086,95620,0.32,166.01
2019-01-05 20:17:29,1118,31204,0.10,54.67
2019-01-05 20:18:00,1149,240325,0.80,415.31
2019-01-05 20:18:31,1180,0,0.00,0.62
2019-01-05 20:19:02,1212,105936,0.35,183.82
2019-01-05 20:19:34,1243,219215,0.73,378.99
2019-01-05 20:20:05,1274,351948,1.17,607.21
2019-01-05 20:20:37,1306,130260,0.43,225.78
2019-01-05 20:21:08,1338,215783,0.72,373.09
2019-01-05 20:21:39,1369,235589,0.79,407.16
2019-01-05 20:22:11,1400,164932,0.55,285.54
2019-01-05 20:22:42,1431,0,0.00,0.62
2019-01-05 20:23:14,1463,35366,0.12,61.87
2019-01-05 20:23:46,1495,277039,0.92,478.45
2019-01-05 20:24:16,1526,112808,0.38,195.68
2019-01-05 20:24:47,1557,66890,0.22,116.39
2019-01-05 20:25:19,1588,148889,0.50,257.89
2019-01-05 20:25:50,1620,79933,0.27,138.92
2019-01-05 20:26:21,1650,63640,0.21,110.77
2019-01-05 20:26:53,1682,195845,0.65,338.77
2019-01-05 20:27:24,1713,137990,0.46,239.11
2019-01-05 20:27:55,1745,177355,0.59,306.93
2019-01-05 20:28:26,1775,60739,0.20,105.75
2019-01-05 20:28:56,1806,130597,0.44,226.36
2019-01-05 20:29:28,1837,135349,0.45,234.55
2019-01-05 20:29:59,1868,150300,0.50,260.32
2019-01-05 20:30:29,1899,65524,0.22,114.03
2019-01-05 20:31:00,1929,57514,0.19,100.18
2019-01-05 20:31:31,1960,70784,0.24,123.12
2019-01-05 20:32:03,1992,102506,0.34,177.90
2019-01-05 20:32:35,2024,272364,0.91,470.41
2019-01-05 20:33:06,2055,76847,0.26,133.59
2019-01-05 20:33:37,2087,163264,0.54,282.66
2019-01-05 20:34:09,2119,183813,0.61,318.06
2019-01-05 20:34:40,2150,118392,0.39,205.31
2019-01-05 20:35:12,2182,56292,0.19,98.07
2019-01-05 20:35:44,2213,110316,0.37,191.38
2019-01-05 20:36:15,2245,57770,0.19,100.62
2019-01-05 20:36:46,2276,55322,0.18,96.39
2019-01-05 20:37:18,2308,15465,0.05,27.42
2019-01-05 20:37:50,2339,110808,0.37,192.22
2019-01-05 20:38:21,2370,0,0.00,0.62
2019-01-05 20:38:52,2401,119861,0.40,207.84
2019-01-05 20:39:23,2432,0,0.00,0.62
2019-01-05 20:39:55,2464,96303,0.32,167.19
2019-01-05 20:40:26,2495,58463,0.19,101.82
2019-01-05 20:40:56,2526,110397,0.37,191.52
2019-01-05 20:41:28,2557,14068,0.05,25.00
2019-01-05 20:41:59,2588,187023,0.62,323.58
2019-01-05 20:42:30,2619,163577,0.55,283.20
2019-01-05 20:43:01,2651,86249,0.29,149.83
2019-01-05 20:43:32,2682,0,0.00,0.62
2019-01-05 20:44:04,2713,5917,0.02,10.87
2019-01-05 20:44:35,2745,32574,0.11,57.04
2019-01-05 20:45:07,2776,76487,0.25,132.97
2019-01-05 20:45:38,2807,0,0.00,0.62
2019-01-05 20:46:09,2838,0,0.00,0.62
2019-01-05 20:46:40,2870,97250,0.32,168.82
2019-01-05 20:47:12,2901,109043,0.36,189.18
2019-01-05 20:47:43,2932,0,0.00,0.62
2019-01-05 20:48:14,2964,42779,0.14,74.70
2019-01-05 20:48:45,2995,61407,0.20,106.91
2019-01-05 20:49:17,3027,3324,0.01,6.38
2019-01-05 20:49:48,3058,0,0.00,0.62
2019-01-05 20:50:20,3090,81240,0.27,141.18
2019-01-05 20:50:51,3121,84123,0.28,146.16
2019-01-05 20:51:22,3152,36415,0.12,63.69
2019-01-05 20:51:54,3183,13840,0.05,24.60
2019-01-05 20:52:25,3214,0,0.00,0.62
2019-01-05 20:52:56,3245,207695,0.69,359.17
2019-01-05 20:53:27,3276,106434,0.35,184.68
2019-01-05 20:53:58,3308,46466,0.15,81.07
2019-01-05 20:54:30,3339,0,0.00,0.62
2019-01-05 20:55:01,3370,0,0.00,0.62
2019-01-05 20:55:32,3401,0,0.00,0.62
2019-01-05 20:56:03,3432,186647,0.62,322.94
2019-01-05 20:56:34,3463,0,0.00,0.62
2019-01-05 20:57:05,3494,23174,0.08,40.77
2019-01-05 20:57:36,3525,0,0.00,0.62
2019-01-05 20:58:07,3556,0,0.00,0.62
2019-01-05 20:58:38,3588,1859,0.01,3.84
2019-01-05 20:59:10,3620,100086,0.33,173.72
2019-01-05 20:59:41,3651,0,0.00,0.62
2019-01-05 21:00:12,3682,0,0.00,0.62
2019-01-05 21:00:43,3713,0,0.00,0.62
2019-01-05 21:01:15,3745,173269,0.58,299.90
2019-01-05 21:01:46,3776,0,0.00,0.62
2019-01-05 21:02:17,3807,0,0.00,0.62
2019-01-05 21:02:48,3838,0,0.00,0.62
2019-01-05 21:03:19,3869,0,0.00,0.62
2019-01-05 21:03:50,3900,93400,0.31,162.18
2019-01-05 21:04:21,3931,92569,0.31,160.74
2019-01-05 21:04:52,3962,31062,0.10,54.42
2019-01-05 21:05:23,3993,0,0.00,0.62
2019-01-05 21:05:54,4024,0,0.00,0.62
2019-01-05 21:06:25,4055,0,0.00,0.62
2019-01-05 21:06:56,4086,0,0.00,0.62
2019-01-05 21:07:28,4117,0,0.00,0.62
2019-01-05 21:07:59,4148,0,0.00,0.62
2019-01-05 21:08:30,4179,0,0.00,0.62
2019-01-05 21:09:02,4211,73329,0.24,127.51
2019-01-05 21:09:32,4242,61186,0.20,106.53
2019-01-05 21:10:03,4273,0,0.00,0.62
2019-01-05 21:10:34,4304,0,0.00,0.62
2019-01-05 21:11:05,4334,71914,0.24,125.07
2019-01-05 21:11:36,4366,0,0.00,0.62
2019-01-05 21:12:07,4397,0,0.00,0.62
2019-01-05 21:12:39,4429,30147,0.10,52.84
2019-01-05 21:13:10,4460,0,0.00,0.62
2019-01-05 21:13:41,4490,1152,0.00,2.62
2019-01-05 21:14:12,4521,0,0.00,0.62
2019-01-05 21:14:43,4552,0,0.00,0.62
2019-01-05 21:15:14,4583,0,0.00,0.62
2019-01-05 21:15:45,4614,44602,0.15,77.85
2019-01-05 21:16:16,4645,0,0.00,0.62
2019-01-05 21:16:47,4677,0,0.00,0.62
2019-01-05 21:17:18,4708,0,0.00,0.62
2019-01-05 21:17:49,4739,0,0.00,0.62
2019-01-05 21:18:20,4770,0,0.00,0.62
2019-01-05 21:18:52,4802,26478,0.09,46.49
2019-01-05 21:19:23,4832,49802,0.17,86.84
2019-01-05 21:19:54,4863,0,0.00,0.62
2019-01-05 21:20:25,4894,60540,0.20,105.41
2019-01-05 21:20:56,4926,26185,0.09,45.98
2019-01-05 21:21:27,4956,136028,0.45,235.72
2019-01-05 21:21:58,4987,80906,0.27,140.60
2019-01-05 21:22:29,5018,0,0.00,0.62
2019-01-05 21:23:00,5049,0,0.00,0.62
2019-01-05 21:23:31,5081,4882,0.02,9.08
2019-01-05 21:24:02,5112,0,0.00,0.62
2019-01-05 21:24:34,5143,0,0.00,0.62
2019-01-05 21:25:05,5174,0,0.00,0.62
2019-01-05 21:25:35,5205,80813,0.27,140.44
2019-01-05 21:26:07,5236,0,0.00,0.62
2019-01-05 21:26:38,5268,135012,0.45,233.97
2019-01-05 21:27:09,5299,0,0.00,0.62
2019-01-05 21:27:40,5330,0,0.00,0.62
2019-01-05 21:28:11,5361,0,0.00,0.62
2019-01-05 21:28:42,5392,0,0.00,0.62
2019-01-05 21:29:13,5423,93174,0.31,161.79
2019-01-05 21:29:44,5454,0,0.00,0.62
2019-01-05 21:30:15,5485,0,0.00,0.62
2019-01-05 21:30:46,5516,0,0.00,0.62
2019-01-05 21:31:17,5547,0,0.00,0.62
2019-01-05 21:31:48,5578,0,0.00,0.62
2019-01-05 21:32:19,5609,0,0.00,0.62
2019-01-05 21:32:51,5640,0,0.00,0.62
2019-01-05 21:33:22,5672,73552,0.25,127.90
2019-01-05 21:33:54,5703,19057,0.06,33.64
2019-01-05 21:34:25,5734,50732,0.17,88.45
2019-01-05 21:34:56,5765,0,0.00,0.62
2019-01-05 21:35:27,5796,0,0.00,0.62
2019-01-05 21:35:58,5828,0,0.00,0.62
2019-01-05 21:36:29,5859,0,0.00,0.62
2019-01-05 21:37:00,5890,0,0.00,0.62
2019-01-05 21:37:31,5921,0,0.00,0.62
2019-01-05 21:38:02,5952,0,0.00,0.62
2019-01-05 21:38:33,5983,0,0.00,0.62
2019-01-05 21:39:04,6014,0,0.00,0.62
2019-01-05 21:39:35,6045,0,0.00,0.62
2019-01-05 21:40:07,6076,0,0.00,0.62
2019-01-05 21:40:38,6108,72037,0.24,125.28
2019-01-05 21:41:09,6139,0,0.00,0.62
2019-01-05 21:41:40,6170,0,0.00,0.62
2019-01-05 21:42:11,6201,0,0.00,0.62
2019-01-05 21:42:42,6232,0,0.00,0.62
2019-01-05 21:43:14,6264,47213,0.16,82.37
2019-01-05 21:43:45,6295,0,0.00,0.62
2019-01-05 21:44:16,6326,0,0.00,0.62
2019-01-05 21:44:48,6357,0,0.00,0.62
2019-01-05 21:45:18,6388,50656,0.17,88.32
2019-01-05 21:45:49,6419,0,0.00,0.62
2019-01-05 21:46:20,6450,0,0.00,0.62
2019-01-05 21:46:51,6481,0,0.00,0.62
2019-01-05 21:47:23,6512,0,0.00,0.62
2019-01-05 21:47:54,6543,0,0.00,0.62
2019-01-05 21:48:25,6574,66683,0.22,116.03
2019-01-05 21:48:56,6606,0,0.00,0.62
2019-01-05 21:49:27,6637,0,0.00,0.62
2019-01-05 21:49:58,6668,0,0.00,0.62
2019-01-05 21:50:30,6699,68944,0.23,119.94
2019-01-05 21:51:00,6730,154978,0.52,268.39
2019-01-05 21:51:31,6761,0,0.00,0.62
2019-01-05 21:52:02,6792,0,0.00,0.62
2019-01-05 21:52:34,6824,172412,0.57,298.42
2019-01-05 21:53:05,6855,0,0.00,0.62
2019-01-05 21:53:36,6886,0,0.00,0.62
2019-01-05 21:54:07,6917,0,0.00,0.62
2019-01-05 21:54:38,6948,0,0.00,0.62
2019-01-05 21:55:09,6979,0,0.00,0.62
2019-01-05 21:55:41,7010,0,0.00,0.62
2019-01-05 21:56:12,7041,0,0.00,0.62
2019-01-05 21:56:43,7072,0,0.00,0.62
2019-01-05 21:57:14,7103,0,0.00,0.62
2019-01-05 21:57:44,7134,98041,0.33,170.19
2019-01-05 21:58:16,7165,117605,0.39,203.95
2019-01-05 21:58:47,7196,0,0.00,0.62
2019-01-05 21:59:18,7227,0,0.00,0.62
2019-01-05 21:59:49,7258,0,0.00,0.62
2019-01-05 22:00:20,7289,0,0.00,0.62
2019-01-05 22:00:51,7321,0,0.00,0.62
2019-01-05 22:01:22,7352,0,0.00,0.62
2019-01-05 22:01:53,7383,104330,0.35,181.05
2019-01-05 22:02:24,7414,0,0.00,0.62
2019-01-05 22:02:56,7445,0,0.00,0.62
2019-01-05 22:03:27,7476,0,0.00,0.62
2019-01-05 22:03:58,7508,16235,0.05,28.75
2019-01-05 22:04:29,7539,0,0.00,0.62
2019-01-05 22:05:01,7571,111599,0.37,193.59
2019-01-05 22:05:32,7602,0,0.00,0.62
2019-01-05 22:06:03,7633,0,0.00,0.62
2019-01-05 22:06:34,7664,0,0.00,0.62
2019-01-05 22:07:05,7695,0,0.00,0.62
2019-01-05 22:07:36,7726,0,0.00,0.62
2019-01-05 22:08:07,7757,0,0.00,0.62
2019-01-05 22:08:38,7788,0,0.00,0.62
2019-01-05 22:09:09,7818,35293,0.12,61.74
2019-01-05 22:09:40,7850,0,0.00,0.62
2019-01-05 22:10:11,7881,216688,0.72,374.64
2019-01-05 22:10:42,7912,0,0.00,0.62
2019-01-05 22:11:13,7943,0,0.00,0.62
2019-01-05 22:11:44,7974,0,0.00,0.62
2019-01-05 22:12:16,8006,59634,0.20,103.84
2019-01-05 22:12:48,8038,60228,0.20,104.87
2019-01-05 22:13:19,8069,0,0.00,0.62
2019-01-05 22:13:50,8100,0,0.00,0.62
2019-01-05 22:14:21,8131,0,0.00,0.62
2019-01-05 22:14:52,8162,0,0.00,0.62
2019-01-05 22:15:23,8193,0,0.00,0.62
2019-01-05 22:15:55,8224,0,0.00,0.62
2019-01-05 22:16:26,8255,0,0.00,0.62
2019-01-05 22:16:57,8286,0,0.00,0.62
2019-01-05 22:17:28,8317,0,0.00,0.62
2019-01-05 22:17:59,8348,0,0.00,0.62
2019-01-05 22:18:30,8380,80824,0.27,140.46
2019-01-05 22:19:01,8411,0,0.00,0.62
2019-01-05 22:19:32,8442,0,0.00,0.62
2019-01-05 22:20:04,8473,0,0.00,0.62
2019-01-05 22:20:35,8504,0,0.00,0.62
2019-01-05 22:21:06,8535,0,0.00,0.62
2019-01-05 22:21:37,8566,0,0.00,0.62
2019-01-05 22:22:08,8597,0,0.00,0.62
2019-01-05 22:22:39,8628,0,0.00,0.62
2019-01-05 22:23:10,8659,0,0.00,0.62
2019-01-05 22:23:41,8691,52550,0.18,91.60
2019-01-05 22:24:12,8722,0,0.00,0.62
2019-01-05 22:24:43,8753,0,0.00,0.62
2019-01-05 22:25:14,8784,0,0.00,0.62
2019-01-05 22:25:46,8816,158085,0.53,273.74
2019-01-05 22:26:17,8847,0,0.00,0.62
2019-01-05 22:26:48,8878,0,0.00,0.62
2019-01-05 22:27:19,8909,0,0.00,0.62
2019-01-05 22:27:50,8940,0,0.00,0.62
2019-01-05 22:28:22,8971,0,0.00,0.62
2019-01-05 22:28:53,9003,350,0.00,1.23
2019-01-05 22:29:25,9034,0,0.00,0.62
2019-01-05 22:29:56,9065,0,0.00,0.62
2019-01-05 22:30:27,9096,0,0.00,0.62
2019-01-05 22:30:58,9127,0,0.00,0.62
2019-01-05 22:31:28,9158,34950,0.12,61.15
2019-01-05 22:31:59,9189,93440,0.31,162.25
2019-01-05 22:32:30,9220,0,0.00,0.62
2019-01-05 22:33:01,9251,0,0.00,0.62
2019-01-05 22:33:32,9282,0,0.00,0.62
2019-01-05 22:34:03,9313,0,0.00,0.62
2019-01-05 22:34:35,9344,0,0.00,0.62
2019-01-05 22:35:06,9375,0,0.00,0.62
2019-01-05 22:35:37,9406,0,0.00,0.62
2019-01-05 22:36:08,9437,0,0.00,0.62
2019-01-05 22:36:39,9468,0,0.00,0.62
2019-01-05 22:37:10,9499,0,0.00,0.62
2019-01-05 22:37:41,9530,0,0.00,0.62
2019-01-05 22:38:12,9561,0,0.00,0.62
2019-01-05 22:38:43,9592,0,0.00,0.62
2019-01-05 22:39:14,9623,0,0.00,0.62
2019-01-05 22:39:45,9655,0,0.00,0.62
2019-01-05 22:40:16,9686,17692,0.06,31.27
2019-01-05 22:40:48,9717,0,0.00,0.62
2019-01-05 22:41:19,9748,0,0.00,0.62
2019-01-05 22:41:50,9779,0,0.00,0.62
2019-01-05 22:42:21,9810,0,0.00,0.62
2019-01-05 22:42:52,9841,0,0.00,0.62
2019-01-05 22:43:23,9872,0,0.00,0.62
2019-01-05 22:43:54,9903,0,0.00,0.62
2019-01-05 22:44:24,9934,138506,0.46,240.00
2019-01-05 22:44:55,9965,0,0.00,0.62
2019-01-05 22:45:26,9996,0,0.00,0.62
2019-01-05 22:45:57,10027,113363,0.38,196.63
2019-01-05 22:46:28,10058,0,0.00,0.62
2019-01-05 22:46:59,10089,89254,0.30,155.02
2019-01-05 22:47:30,10120,0,0.00,0.62
2019-01-05 22:48:02,10151,0,0.00,0.62
2019-01-05 22:48:33,10182,0,0.00,0.62
2019-01-05 22:49:04,10213,0,0.00,0.62
2019-01-05 22:49:35,10244,0,0.00,0.62
2019-01-05 22:50:06,10275,0,0.00,0.62
2019-01-05 22:50:37,10306,0,0.00,0.62
2019-01-05 22:51:08,10337,0,0.00,0.62
2019-01-05 22:51:39,10368,0,0.00,0.62
2019-01-05 22:52:10,10399,0,0.00,0.62
2019-01-05 22:52:41,10431,0,0.00,0.62
2019-01-05 22:53:12,10462,0,0.00,0.62
2019-01-05 22:53:43,10493,0,0.00,0.62
2019-01-05 22:54:14,10524,0,0.00,0.62
2019-01-05 22:54:45,10555,64193,0.21,111.72
2019-01-05 22:55:16,10585,69420,0.23,120.76
2019-01-05 22:55:47,10616,0,0.00,0.62
2019-01-05 22:56:18,10647,0,0.00,0.62
2019-01-05 22:56:49,10678,0,0.00,0.62
2019-01-05 22:57:20,10710,0,0.00,0.62
2019-01-05 22:57:51,10741,0,0.00,0.62
2019-01-05 22:58:22,10772,0,0.00,0.62
2019-01-05 22:58:53,10803,0,0.00,0.62
2019-01-05 22:59:25,10834,159184,0.53,275.63
2019-01-05 22:59:56,10865,0,0.00,0.62
2019-01-05 23:00:28,10897,22835,0.08,40.18
2019-01-05 23:00:59,10928,0,0.00,0.62
2019-01-05 23:01:30,10959,0,0.00,0.62
2019-01-05 23:02:01,10990,0,0.00,0.62
2019-01-05 23:02:32,11021,0,0.00,0.62
2019-01-05 23:03:04,11053,29230,0.10,51.25
2019-01-05 23:03:35,11084,0,0.00,0.62
2019-01-05 23:04:06,11115,0,0.00,0.62
2019-01-05 23:04:37,11146,0,0.00,0.62
2019-01-05 23:05:08,11178,0,0.00,0.62
2019-01-05 23:05:39,11209,0,0.00,0.62
2019-01-05 23:06:10,11240,0,0.00,0.62
2019-01-05 23:06:41,11271,0,0.00,0.62
2019-01-05 23:07:12,11302,0,0.00,0.62
2019-01-05 23:07:43,11333,0,0.00,0.62
2019-01-05 23:08:14,11364,0,0.00,0.62
2019-01-05 23:08:46,11395,0,0.00,0.62
2019-01-05 23:09:17,11426,0,0.00,0.62
2019-01-05 23:09:48,11457,734711,2.45,1267.49
2019-01-05 23:10:19,11488,0,0.00,0.62
2019-01-05 23:10:51,11520,31315,0.10,54.86
2019-01-05 23:11:22,11551,0,0.00,0.62
2019-01-05 23:11:53,11582,0,0.00,0.62
2019-01-05 23:12:24,11613,0,0.00,0.62
2019-01-05 23:12:55,11644,0,0.00,0.62
2019-01-05 23:13:26,11676,36580,0.12,63.97
2019-01-05 23:13:57,11707,0,0.00,0.62
2019-01-05 23:14:28,11738,0,0.00,0.62
2019-01-05 23:14:59,11769,0,0.00,0.62
2019-01-05 23:15:30,11800,0,0.00,0.62
2019-01-05 23:16:01,11830,69449,0.23,120.81
2019-01-05 23:16:32,11861,0,0.00,0.62
2019-01-05 23:17:03,11892,0,0.00,0.62
2019-01-05 23:17:34,11923,0,0.00,0.62
2019-01-05 23:18:05,11955,0,0.00,0.62
2019-01-05 23:18:37,11986,78615,0.26,136.64
2019-01-05 23:19:08,12017,0,0.00,0.62
2019-01-05 23:19:39,12048,7157,0.02,13.02
2019-01-05 23:20:10,12079,0,0.00,0.62
2019-01-05 23:20:41,12110,0,0.00,0.62
2019-01-05 23:21:11,12141,94516,0.32,164.10
2019-01-05 23:21:42,12172,0,0.00,0.62
2019-01-05 23:22:13,12203,0,0.00,0.62
2019-01-05 23:22:44,12234,0,0.00,0.62
2019-01-05 23:23:15,12265,0,0.00,0.62
2019-01-05 23:23:47,12296,0,0.00,0.62
2019-01-05 23:24:18,12327,0,0.00,0.62
2019-01-05 23:24:49,12358,0,0.00,0.62

+ 93
- 0
Air_Quality_Sensor_PPD42/code/sensortest/sensortest.ino View File

@ -0,0 +1,93 @@
#include <math.h>
int DustSensePin = 13;
//let's start with 100 readings. (copy and paste)
unsigned int airreading[100] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
unsigned long starttime = 0;
unsigned long sampletime_ms = 60000;//sample 60s == 60000 ;
unsigned long lowpulseoccupancy = 0;
float ratio = 0;
float concentration = 0;
unsigned int x = 0;
unsigned int toplimit = 0;
unsigned long sum = 0; //highest number possible - 32 bit unsigned, so 4 billion
unsigned int average = 0;
void setup()
{
Serial.begin(9600);
Serial.println("Starting Air Sensor, please wait for readings...");
pinMode(DustSensePin,INPUT);
starttime = millis();//get the current time;
}
void loop()
{
airreading[x] = pulseIn(DustSensePin, LOW, 500000);
/*lowpulseoccupancy = lowpulseoccupancy+duration;
if ((millis()-starttime) > sampletime_ms)//if the sample time == 30s
{
ratio = lowpulseoccupancy/(sampletime_ms*10.0); // Integer percentage 0=>100
concentration = 1.1*powf(ratio,3)-3.8*powf(ratio,2)+520*ratio+0.62; // using spec sheet curve
Serial.print(lowpulseoccupancy);
Serial.print(",");
Serial.print(ratio);
Serial.print(",");
Serial.println(concentration);
lowpulseoccupancy = 0;
starttime = millis();
}
*/
//if ((millis()-starttime) > sampletime_ms){
//KISS. Relative readings only.
//Something else keeps the time.
if (airreading[x] != 0){
Serial.println(airreading[x]);
x=x+1;
if(x>100){
x = 0;
}
}
//starttime = millis();
//}
//KISS. Average for a minute, and store that data in a webpage (that part will be in ethernet sensor test 3).
//
if ((millis()-starttime) > sampletime_ms){
toplimit = x; // don't read the zeros
if(toplimit == 0){
toplimit = 1; //to avoid divide by zero, in case sum / toplimit is both zero
}
for (x=0; x<toplimit; x++){
sum = sum + airreading[x];
}
average = sum / toplimit;
Serial.print("Average Get!: ");
Serial.println(average); //average when 0 is 65535, so it's invalid (dividing by zero - sum divided by top limit which are both zero)
//but we don't even want the average. It's just for testing here.
Serial.print("Sum Get!: ");
Serial.println(sum); //this is what we care about
//reset everything after a minute
sum = 0;
average = 0;
x = 0;
toplimit = 0;
for (x=0; x<toplimit; x++){
airreading[x] = 0;
}
starttime = millis();
}
}

+ 5
- 0
Air_Quality_Sensor_PPD42/docs/1.aux View File

@ -0,0 +1,5 @@
\relax
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Work Log}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Parts List}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Beginning}{2}}

+ 98
- 0
Air_Quality_Sensor_PPD42/docs/1.log View File

@ -0,0 +1,98 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 14 MAY 2019 01:24
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2018/
Air_Quality_Sensor_PPD42/docs/1.tex
(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2018/A
ir_Quality_Sensor_PPD42/docs/1.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (./1.aux)
\openout1 = `1.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <12> on input line 8.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 8.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 8.
(./1.toc
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <10.95> on input line 3.
)
\tf@toc=\write3
\openout3 = `1.toc'.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <9> on input line 14.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 14.
LaTeX Font Info: Try loading font information for OMS+cmr on input line 19.
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions
)
LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10.95> not available
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 19.
[1
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
Overfull \hbox (89.30338pt too wide) in paragraph at lines 33--37
\OT1/cmr/m/n/10.95 lar board is the and as ex-plained here: http://energia.nu/p
in-maps/guide[]msp430g2launchpad/
[]
[2] (./1.aux) )
Here is how much of TeX's memory you used:
265 strings out of 495020
3242 string characters out of 6181323
49970 words of memory out of 5000000
3545 multiletter control sequences out of 15000+600000
10030 words of font info for 35 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
23i,8n,19p,536b,187s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm
bx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.p
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></us
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/share
/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/texlive
/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/texmf-d
ist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-dist/font
s/type1/public/amsfonts/cm/cmsy10.pfb>
Output written on 1.pdf (2 pages, 99694 bytes).
PDF statistics:
43 PDF objects out of 1000 (max. 8388607)
30 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)

BIN
Air_Quality_Sensor_PPD42/docs/1.pdf View File


+ 59
- 0
Air_Quality_Sensor_PPD42/docs/1.tex View File

@ -0,0 +1,59 @@
\documentclass[11pt]{article}
%Gummi|065|=)
\title{\textbf{Air Quality Sensor}}
\author{Steak Electronics}
\date{2018 (revised 2019)}
\begin{document}
\maketitle
\tableofcontents
\section{Overview}
To know when I need to clean my room. I usually vacuum every two or three weeks, but sometimes am lazy and I need a reminder. The dust sensor will be more motivation to get me to clean, when I see the dust levels increase. \footnote{Technically, I also get a rash from excess dust, which is another great motivator.}
\section{Work Log}
\subsection{Parts List}
\begin{itemize}
\item Shinyei PPD42NS Air Quality Sensor
\item MSP-EXP430G2553 V1.5
\item 5V adapter (required as MSP is 3.3V only)
\item SD Card adapter
\item Ethernet Module
\item Energia version 0101E0012 (or later, possibly)
\end{itemize}
\subsection{Beginning}
Here are some things I learned working on this project.
\textbf{IDE}
I'm using Energia from energia.nu which is an Arduino IDE clone for TI Launchpads. This will allow for rapid development. And ease me into the TI platform.
\textbf{MSP-EXP430G2 V1.5}
There are different version of this. My particular board is the
and as explained here: http://energia.nu/pin-maps/guide\_msp430g2launchpad/ and http://energia.nu/pin-maps/guide\_msp430g2launchpad/
You need to rotate the UART jumpers to get UART to display correctly. Oddly enough you can choose a different chip in the boards list and serial will print out right... But switch the jumpers and the correct board will work with UART. Otherwise, it does not work out of the box for serial.print. Though the blink example sketch works.
\textbf{Dust Sensor}
The code for the dust sensor is found online easily. The pinout is tricky as the colours of the wire are nonsense, but the pinout seems to be the same for all sensors, and is: PIN 1 (closest to black box) GND, PIN 3, VDD (5+V), PIN 4 output A. there is also an output B for different readings (I think size) of dust. I'm not that particular (no pun intended) about my dust so I will go with the one most people are using.
\textbf{3.3V only on TI}
The TI takes input of USB but only outputs 3.3V. Fail. I'll through a 5V PSU on the board. It won't be connected to USB for its use anyways.
\textbf{POW function}
There is a pow function (power exponent) in arduino. In TI, I changed it to powf, and included math.h.
I'm not sure if my change was correct.
EDIT: looks like there is a LED tied to pin 14. I'm moving to pin 13. I meant to use 13 earlier but accidentally used the wrong pin and kept using it. Oops.
EDIT 2: Actually, I was reading from the wrong pin in software. Maybe I will leave it on the LED pin as you can see when the dust is firing off the sensor. Hm.... Neat.
EDIT 3: Yes, so I had to use powf instead of pow, and it works. The accidental incorrect pin was a bonus as it allows me to see visually how often the sensor is going off. Over time, I should have a vague grasp of the dust levels just looking at the light. Actually, I won't. Nevermind. The dust sensor reading, is too irregular for that.
\end{document}

+ 38
- 0
Air_Quality_Sensor_PPD42/docs/1.tex~ View File

@ -0,0 +1,38 @@
\documentclass[11pt]{article}
%Gummi|065|=)
\title{\textbf{Computer Switch Board}}
\author{Steak Electronics}
\date{03/17/19}
\begin{document}
\maketitle
\section{Requirements}
\begin{itemize}
\item large pcb board
\item fused power input - EDIT: instead I will have a case around the nano, 3d printed, and have the case connect into the pcb, i.e. cutouts for the case in the pcb, and clips on case. the rest of the pcb will be fused somewhere, after the nano. but nano powers it.
\item arduino nano
\item switch to activate things
\item rotary to change number
\item 7 digit display to list number, and shift register, resistors
\item explanation of what numbers do on board
\item 3d printed cover over nano
\end{itemize}
\section{build notes}
The 7 segment symbols are abstracted in kicad. Job security for engineers.
The example gave a common Vcc, with all pins being connected to GND, and sinked when on.
The data sheet of the 7seg, omits the schematic. but does show that it is common anode, or common vcc. Pin 3 is left out, but that is VCC.
\end{document}

+ 4
- 0
Air_Quality_Sensor_PPD42/docs/1.toc View File

@ -0,0 +1,4 @@
\contentsline {section}{\numberline {1}Overview}{1}
\contentsline {section}{\numberline {2}Work Log}{1}
\contentsline {subsection}{\numberline {2.1}Parts List}{1}
\contentsline {subsection}{\numberline {2.2}Beginning}{2}

+ 8
- 0
Air_Quality_Sensor_PPD42/docs/2.aux View File

@ -0,0 +1,8 @@
\relax
\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Shinyei Dust sensor PPD42\relax }}{1}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Work Log}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Parts List}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Beginning}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Work Log 08/2018}{3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.4}Work Log 12/2018}{3}}

+ 228
- 0
Air_Quality_Sensor_PPD42/docs/2.log View File

@ -0,0 +1,228 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2015/dev/Debian) (preloaded format=pdflatex 2018.11.28) 14 MAY 2019 01:31
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2018/
Air_Quality_Sensor_PPD42/docs/2.tex
(/home/layoutdev/Desktop/code/documentation_general/Electronics_Projects_2018/A
ir_Quality_Sensor_PPD42/docs/2.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/05/08 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
)
Package graphics Info: Driver file: pdftex.def on input line 91.
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count87
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR)
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR)
Package caption3 Info: TeX engine: e-TeX on input line 57.
\captionmargin=\dimen105
\captionmargin@=\dimen106
\captionwidth=\dimen107
\caption@tempdima=\dimen108
\caption@indent=\dimen109
\caption@parindent=\dimen110
\caption@hangindent=\dimen111
)
\c@ContinuedFloat=\count88
) (./2.aux)
\openout1 = `2.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 8.
LaTeX Font Info: ... okay on input line 8.
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count89
\scratchdimen=\dimen112
\scratchbox=\box26
\nofMPsegments=\count90
\nofMParguments=\count91
\everyMPshowfont=\toks15
\MPscratchCnt=\count92
\MPscratchDim=\dimen113
\MPnumerator=\count93
\makeMPintoPDFobject=\count94
\everyMPtoPDFconversion=\toks16
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO
)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is detected.
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO)
))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds) That can mean that you are not using pdfTeX 1.50 or
(etexcmds) that some package has redefined \expanded.
(etexcmds) In the latter case, load this package earlier.
)))
Package grfext Info: Graphics extension search list:
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext) \AppendGraphicsExtensions on input line 452.
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
Package caption Info: Begin \AtBeginDocument code.
Package caption Info: End \AtBeginDocument code.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <12> on input line 10.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 10.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 10.
(./2.toc)
\tf@toc=\write3
\openout3 = `2.toc'.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <10.95> on input line 16.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <9> on input line 16.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 16.
<../pics/dustsensor.JPG, id=1, 667.49374pt x 499.8675pt>
File: ../pics/dustsensor.JPG Graphic file (type jpg)
<use ../pics/dustsensor.JPG>
Package pdftex.def Info: ../pics/dustsensor.JPG used on input line 19.
(pdftex.def) Requested size: 200.24966pt x 149.9614pt.
LaTeX Font Info: Try loading font information for OMS+cmr on input line 26.
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions
)
LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10.95> not available
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 26.
[1
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map} <../pics/dustsensor.JPG>]
Overfull \hbox (89.30338pt too wide) in paragraph at lines 40--44
\OT1/cmr/m/n/10.95 lar board is the and as ex-plained here: http://energia.nu/p
in-maps/guide[]msp430g2launchpad/
[]
[2] <../pics/woodboard.JPG, id=18, 803.0pt x 602.25pt>
File: ../pics/woodboard.JPG Graphic file (type jpg)
<use ../pics/woodboard.JPG>
Package pdftex.def Info: ../pics/woodboard.JPG used on input line 69.
(pdftex.def) Requested size: 240.90186pt x 180.67639pt.
[3 <../pics/woodboard.JPG>]
Overfull \hbox (34.19756pt too wide) in paragraph at lines 75--82
[]\OT1/cmr/m/n/10.95 I'm go-ing to use this li-brary: https://github.com/reaper
7/EtherEncLib/releases
[]
[4] (./2.aux) )
Here is how much of TeX's memory you used:
2580 strings out of 495020
41135 string characters out of 6181323
95813 words of memory out of 5000000
5786 multiletter control sequences out of 15000+600000
10030 words of font info for 35 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
38i,8n,38p,752b,228s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cm
bx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.p
fb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></us
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/share
/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/texlive
/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texlive/texmf-d
ist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/share/texlive/texmf-dist/font
s/type1/public/amsfonts/cm/cmsy10.pfb>
Output written on 2.pdf (4 pages, 281052 bytes).
PDF statistics:
51 PDF objects out of 1000 (max. 8388607)
34 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
11 words of extra memory for PDF output out of 10000 (max. 10000000)

BIN
Air_Quality_Sensor_PPD42/docs/2.pdf View File


+ 88
- 0
Air_Quality_Sensor_PPD42/docs/2.tex View File

@ -0,0 +1,88 @@
\documentclass[11pt]{article}
%Gummi|065|=)
\usepackage{graphicx}
\usepackage{caption}
\title{\textbf{Air Quality Sensor}}
\author{Steak Electronics}
\date{2018 (revised 2019)}
\begin{document}
\maketitle
\tableofcontents
\section{Overview}
To know when I need to clean my room. I usually vacuum every two or three weeks, but sometimes am lazy and I need a reminder. The dust sensor will be more motivation to get me to clean, when I see the dust levels increase. \footnote{Technically, I also get a rash from excess dust, which is another great motivator.}
\begin{center}
\includegraphics[scale=0.3]{../pics/dustsensor.JPG}
\captionof{figure}{Shinyei Dust sensor PPD42}
\end{center}
\section{Work Log}
\subsection{Parts List}
\begin{itemize}
\item Shinyei PPD42NS Air Quality Sensor
\item MSP-EXP430G2553 V1.5
\item 5V adapter (required as MSP is 3.3V only)
\item SD Card adapter
\item Ethernet Module
\item Energia version 0101E0012 (or later, possibly)
\end{itemize}
\subsection{Beginning}
Here are some things I learned working on this project.
\textbf{IDE}
I'm using Energia from energia.nu which is an Arduino IDE clone for TI Launchpads. This will allow for rapid development. And ease me into the TI platform.
\textbf{MSP-EXP430G2 V1.5}
There are different version of this. My particular board is the
and as explained here: http://energia.nu/pin-maps/guide\_msp430g2launchpad/ and http://energia.nu/pin-maps/guide\_msp430g2launchpad/
You need to rotate the UART jumpers to get UART to display correctly. Oddly enough you can choose a different chip in the boards list and serial will print out right... But switch the jumpers and the correct board will work with UART. Otherwise, it does not work out of the box for serial.print. Though the blink example sketch works.
\textbf{Dust Sensor}
The code for the dust sensor is found online easily. The pinout is tricky as the colours of the wire are nonsense, but the pinout seems to be the same for all sensors, and is: PIN 1 (closest to black box) GND, PIN 3, VDD (5+V), PIN 4 output A. there is also an output B for different readings (I think size) of dust. I'm not that particular (no pun intended) about my dust so I will go with the one most people are using.
\textbf{3.3V only on TI}
The TI takes input of USB but only outputs 3.3V. Fail. I'll through a 5V PSU on the board. It won't be connected to USB for its use anyways.
\textbf{POW function}
There is a pow function (power exponent) in arduino. In TI, I changed it to powf, and included math.h.
I'm not sure if my change was correct.
EDIT: looks like there is a LED tied to pin 14. I'm moving to pin 13. I meant to use 13 earlier but accidentally used the wrong pin and kept using it. Oops.
EDIT 2: Actually, I was reading from the wrong pin in software. Maybe I will leave it on the LED pin as you can see when the dust is firing off the sensor. Hm.... Neat.
EDIT 3: Yes, so I had to use powf instead of pow, and it works. The accidental incorrect pin was a bonus as it allows me to see visually how often the sensor is going off. Over time, I should have a vague grasp of the dust levels just looking at the light. Actually, I won't. Nevermind. The dust sensor reading, is too irregular for that.
\subsection{Work Log 08/2018}
I've put everything on a single piece of plywood, and need to do some more work on the code. I've decided to forgo the SD card, as I don't want to deal with reading a 2MB sd card with the buffer provided by the SRAM. I'm not quite sure how to manage that, and whether it's possible to read such large data files. I did some quick research and did not find what I wanted. It is likely possible, but let's do something simpler. Instead, I will use the EEPROM to store the last 5 minutes of data or so, and then have the server read the data every five minutes. This keeps the client simple, and puts the burden of complexity on the server.
In addition, I don't want to read SD cards manually, as that is cumbersome, though possibly scripts could be made.
The PPD42 was made sure to be put vertically.
\begin{center}
\includegraphics[scale=0.3]{../pics/woodboard.JPG}
\end{center}
\subsection{Work Log 12/2018}
I have decided to change how I do this slightly. Instead of an SD card, I will connect on the LAN and use thingspeak from a locally hosted instance (and deployed with docker, possibly) or some other aggregating server to pull the data. I'll also make a shield, to simplify deployment. That might not be necessary, but I can make a shield in a few hours, and pcbs are cheap. These options such as thingspeak sometimes have graphing / plotting included.
I'm going to use this library:
https://github.com/reaper7/EtherEncLib/releases
so git clone that, then
git tags -l
git checkout tags/v0.4.2
to get the latest release (or a newer one if possible).
The pinout for the ENC is viewable at the figure to the right. This is from the 43oh.com forum.
\footnote{You will see later, that this library turns out to be not developed enough, and results in overall failure for this project. Next time, use a well vetted library!}
\end{document}

+ 59
- 0
Air_Quality_Sensor_PPD42/docs/2.tex~ View File

@ -0,0 +1,59 @@
\documentclass[11pt]{article}
%Gummi|065|=)
\title{\textbf{Air Quality Sensor}}
\author{Steak Electronics}
\date{2018 (revised 2019)}
\begin{document}
\maketitle
\tableofcontents
\section{Overview}
To know when I need to clean my room. I usually vacuum every two or three weeks, but sometimes am lazy and I need a reminder. The dust sensor will be more motivation to get me to clean, when I see the dust levels increase. \footnote{Technically, I also get a rash from excess dust, which is another great motivator.}
\section{Work Log}
\subsection{Parts List}
\begin{itemize}
\item Shinyei PPD42NS Air Quality Sensor
\item MSP-EXP430G2553 V1.5
\item 5V adapter (required as MSP is 3.3V only)
\item SD Card adapter
\item Ethernet Module
\item Energia version 0101E0012 (or later, possibly)
\end{itemize}
\subsection{Beginning}
Here are some things I learned working on this project.
\textbf{IDE}
I'm using Energia from energia.nu which is an Arduino IDE clone for TI Launchpads. This will allow for rapid development. And ease me into the TI platform.
\textbf{MSP-EXP430G2 V1.5}
There are different version of this. My particular board is the
and as explained here: http://energia.nu/pin-maps/guide\_msp430g2launchpad/ and http://energia.nu/pin-maps/guide\_msp430g2launchpad/
You need to rotate the UART jumpers to get UART to display correctly. Oddly enough you can choose a different chip in the boards list and serial will print out right... But switch the jumpers and the correct board will work with UART. Otherwise, it does not work out of the box for serial.print. Though the blink example sketch works.
\textbf{Dust Sensor}
The code for the dust sensor is found online easily. The pinout is tricky as the colours of the wire are nonsense, but the pinout seems to be the same for all sensors, and is: PIN 1 (closest to black box) GND, PIN 3, VDD (5+V), PIN 4 output A. there is also an output B for different readings (I think size) of dust. I'm not that particular (no pun intended) about my dust so I will go with the one most people are using.
\textbf{3.3V only on TI}
The TI takes input of USB but only outputs 3.3V. Fail. I'll through a 5V PSU on the board. It won't be connected to USB for its use anyways.