(This is a draft!) I made a simple p5js sketch (read below) to live sensor data off of an Arduino, from a web page -- with no drivers or cables, just audio tones. It's not perfect, but it's an interesting starting point and it's pretty neat. The sketch is here:
https://alpha.editor.p5js.org/jywarren/sketches/rkztwSt8M
The Arduino sketch to use with this is here, and you can load it onto most Arduinos, although I tested an Arduino Nano and an Arduino Uno:
https://create.arduino.cc/editor/jywarren/023158d8-be51-4c78-99ff-36c63126b554/preview
If you don't have an Arduino on hand, you can test it out with this test audio, recorded from a sensor by @donblair: https://www.youtube.com/watch?v=GtJW1Dlt3cg
If you do set it up on an Arduino, WebJack will output audio from pin 3 + ground. Use (splice?) an audio cable from those to a speaker or just plug it into your computer's microphone port if it has one.\
The demo isn't anything fancy; it just draws a pink circle higher and lower on the screen:
The Shinyei dust sensor
The #shinyei dust sensor (the black box at the top of the lead picture) is not a perfect sensor -- it has a lot of limitations, but it's only $20-30 on Amazon, and only $8 on AliExpress, and it reads #PM10 and #PM2.5 .
- Read this great post for more on how to properly set up a Shinyei and about its limitations. (thanks @nanocastro !)
- and see this post for more options for dust sensors
In the above photo, I connected it to an Arduino using the Serial #DustDuino sketch, modified for #WebJack. The DustDuino project and others like the Speck project have really done a lot with this sensor, although I believe more recent projects like #PurpleAir use a different one that's trying to get better data.
Anyhow, I'd like to get this graphing nicely in p5js... shouldn't be too hard, but I'm looking for collaborators if you want to give it a try! Here, I show the basic WebJack graphing demo with the Shinyei sensor and some chalkboard dust:
WebJack
WebJack (by @rmeister and I as part of Google Summer of Code -- #gsoc) is a way to read data from an Arduino (and other sources) using audio -- it basically turns your Arduino into an audio modem. Arduinos are inexpensive ($4-22) electronics boards which can read from a sensor and -- in this case -- generate audio tones with the data.
The audio tones (a kind of chirping sound) can be read by a web page without any cables or software, even on a phone. This is already a demo at the WebJack page.
p5js
p5js is an awesome platform for writing short visual code sketches -- based on Processing, for those who are familiar with that platform. They recently got a really nice web editor, so you can just write sketches online now:
10 Comments
I also proposed this p5js sketch as an example for the p5js web editor: https://github.com/processing/p5.js-web-editor/issues/529
Reply to this comment...
Log in to comment
Hi, @cfastie - do you think this could be adapted pretty easily for live debugging from a #nano-data-logger or #mini-pearl-logger ?
Is this a question? Click here to post it to the Questions page.
Reply to this comment...
Log in to comment