A HTTP Server that listens out for one or more Arduino's over serial communications.
It serves a static HTML page that uses Socket.IO to communicate back to the server without needing page refreshes. The static page displays the readings from the Arduino's sensors (passed in JSON format) in tabular and charted formats.
Designed to run on multiple platforms as long as node-serialport can be compiled and the appropriate serial port(s) identified.
-
Calculate elapsed time between updates
- If elapsed time too long, restart the serial connection
-
Save the data
- Absolute Max/Min
- Daily Max/Min
- Replay the data on connect from browser
-
Email on:
- Battery low
- Nothing from Ard after n min
- Temp low/high
-
Email commands in
-
Add comments e.g. note where sensor is, notes
- from web interface
-
Multiple sensors
- each in separate server
- master server?
-
Add to Arduino code
- Inbound commands
- Speed up/slow down readings
- Id for the Arduino (so can use mutiple)
- SLEEP to reduce battery/power consumption
- Will this work with bluetooth?
- Alternate wireless types
- 2.4GHz
- 433MHz
- Inbound commands
- supervisor - Keeps things running
- serialport - Talk to Arduino(s)
- socket.io - Pi<->Browser, no page refresh needed
- express - HTTP server
- jade - HTML templating
- localStorage - store data in a file
- json-storage - extends localStorage
- underscore - JS Utility functions
- mailparser - Understand the structure of an email
- imap - Recieve email from GMail (using secure connect)
- nodemailer - Send email via GMail (using secure connect)
- winston - advanced logging
- moment - time fns - http://momentjs.com/docs/
- child_process* - enable exec of cmd line app, capture output
- Autostart on reboot
- /etc/rc.local -> /home/pi/node/NodeListener1/start.sh
-
Setup
- Create HTTP(s) server
- Create Socket connection
- Create Serial Port connection(s)
-
On Serial Port recieve
- Get timestamp
- Get Pi Temp & pass to Socket
- Pass data to Socket
- Parse data as JSON
- Add timestamp
- Save to raw data
- Check for new max/min
- Is this a new day?
- Yes
- Create new saved day
- Update with new max/min
- No
- Check for new max/min
- Yes
- Save the day
-
On Socket Connect
- Check for saved data - if available, send to socket
- Set up listners for arduino and PiTemp
{ loopcount time (ms since start, will reset after around 70d) humidity (%) temperature (oC) battery (V) dewPoint (oC)* light motion uid (ID of arduino)* timestamp (UNIX time of reciept of this loop)* loopTime (sec since last loop)* timeStr (as timestamp but in text format) }
- = Set by Node.js not by Arduino
PiTemp (oC, temperature of Pi CPU)