Using a single development board to read multiple sensors attached and send data to the cloud for further processing.
Additional considerations:
- Sensors need to be turned on before reading and off after reading is complete
- Post-reading all sensors device go into sleep mode
- Reduce traffic with Cloud
- The function needs to function sensor agnostic. Read value and forward to Cloud, any processing or interpretation of values needs to be done outside
- Use RedBear Duo
- Sensor Detection - for suitable sensors (reporting a predictable value when not powered or used) a sensor detection would detect if sensors are connected
About RedBear Duo
The RedBear Duo came to life through a Kickstarter Campaign in 2015/2016. It features Wifi and BLE on a small factor as well as Particle Cloud support.
With its integration with Particle Cloud, it allows for the development to be taking place in the Cloud (through the Particle Cloud IDE) as well as pushing updates over the air, sending commands from the WebIDE (or API) to the device.
For Wifi it uses a built-in chip antenna and also allows to connect an external antenna for better range.
In addition to the Particle Cloud IDE, the following platforms and languages are available: Arduino IDE, Particle CLI, JavaScript and more.
RedBear was bought up by Particle.io recently, so we don't expect for this platform to see much development, however, we do expect a number of these devices to become available.
A great little bear for your projects!
Requirements- RedBear Duo - with firmware version 0.3.1+, connected to your Wifi
- Up to seven sensors - we have used two moisture sensors in our proof of concept. All sensors need to report a value within a consistent threshold when not powered (to determine if they are powered on or not).
- Breadboards and jumper wires
- Particle IDE account
- This tip is focused on Particle IDE and RedBear Duo
- Using a single breadboard might be a bit restrictive due to the number and type of sensors. We have used two of our expandable breadboards and connected them together.
We connect the sensors to the RedBear Duo:
- All sensor GND are connected back to the board GND
- all VCC connect to individual Digital Pins
- all analog out from the sensors are connected to individual Digital Pins
- The digital and analog pin numbers are matched up - e.g. for D0, use A0. The configuration of the Digital/Analog Pin couples can be configured in the code in line 56.Depending on the sensors used you can also tie back all sensor analog outputs to the same Analog Pin on the RedBear - just change line 56
The code goes through the configured sensors and create a string with the sensor readings. Where it has determined there is no sensor attached, it will show 0.
Example String: 1023, 2111, 0, 0, 0, 0, 0
Once the reading is done and the string is put together it is sent to the Particle cloud as a private event. The ID of the event can be configured in line 50 - we named it "Patch0/Sensor".. Patch0 for our first veggie patch, Sensor for sensor readings.
Once the event is sent, it can be viewed in the Particle Cloud IDE or consumed by the API. We will follow up with a seperate tip on how to do this.
WiringThis is the wiring used for the proof of concept. You might have to adapt to suit your sensors.
Sensor 1 -> RedBear DuoGND -> GNDVCC -> D0DO -> Not usedAO -> A0
Sensor 2 -> RedBear DuoGND -> GNDVCC -> D1DO -> Not usedAO -> A1
Comments