BLEBee and SODAQ: The perfect fit!
Hello everyone,
this weekend I received a SODAQ beta board for some testing with the BLEBee and just grabbed some parts from my electronic boxes to create a “Plant Moisture Sensor”.
The part list for this little project is:
- 1 SODAQ Moja Board
- 1 BLEBee (http://www.seeedstudio.com/depot/blebee-v100-p-1632.html)
- 1 Groove Moisture Sensor (http://www.seeedstudio.com/depot/grove-moisture-sensor-p-955.html)
- 1 Groove Cable (http://www.seeedstudio.com/depot/grove-universal-4-pin-20cm-unbuckled-cable-5-pcs-pack-p-749.html)
- 1 Lipo Battery
- 1 Mini USB Cable
The parts are shown in the picture below:
I wrote a very little sketch to read the data from the grove moisture sensor and print it out over Serial. Connect the SODAQ board to the PC/MAC and program it using the settings:
- Board: Arduino Pro or Pro Mini (3.3V 8MHz) w/ ATmega328
- Serial: The port where the board is attached to 🙂
and program the following sketch to it:
/* * BLE SODAQ Moja Moisture Sensor Demo for Arduino 1.0.5 * v1.0.0 2013-11-17 * * Copyright (c) 2012-2013 Dr. Michael Kroll * * Permission is hereby granted, free of charge, to any * person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the * Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall * be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * http://www.mkroll.mobi * http://forum.mkroll.mobi */ int sensorPin = A0; // select the input pin sensor int sensorValue = 0; // variable to store the sensor value
void setup() { // Set the BLEBee Baudrate here Serial.begin(9600); Serial.print("Setup... done."); }
void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); Serial.print("Grove - Moisture Sensor = "); Serial.println(sensorValue); delay(2500); }
After doing so, plug the parts together and turn the SODAQ on and illustrated in the picture below:
Now you can connect to the Moisture Sensor using an iPhone where BLExplr installed on to connect to it. Select the BLEBee:
Once connected navigate to the BLEBee service, select the RX characteristic and enable notifications and you will see the text that is sent from the moisture sensor:
Since the sensor is measuring the “Air” the data transferred is: “Grove – Moisture Sensor = 0” once you put it into water, the value changed as shown in the picture below. I just put the sensor in a small plastic tray of water to show the difference in the reading.
The first picture shows the reading in air and the second in water:
Of course this is a very easy example on how to use the SODAQ Moja together with the BLEBee. I have chosen this example to show the simplicity of using both together (I don’t have any other Groove sensors around, to be honest 😉 ). Setting up the hardware, writing the sketch and even writing this blogpost including taking the photos took me around an hour. Take a look at the SODAQ Kickstarter pages in order to get more information about this nice board: http://www.kickstarter.com/projects/386717175/sodaq-a-lego-like-plug-in-rapid-prototyping-board?ref=live
Have fun,
Michael.