< Disclaimer: Keuwlsoft is a participant in the Amazon EU Associates Programme, an affiliate advertising programme designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.co.uk (also .com .de .fr .it .es & .ca). This means that if you purchase from any of the Amazon links on this page you will also be supporting Keuwlsoft.

uno monitor demo

Uno Monitor


Monitor the analogue and digital inputs on the Arduino Uno. An XBee HC-06 Bluetooth module and shield are used to provide the Bluetooth connection.

About this demo


The demo uses a XBee HC-06 Bluetooth module and shield to transmit the pin status of the Arduino Uno to an Android device. The android device needs to be Bluetooth capable and have keuwlsoft's Bluetooth Electronics app installed.

Digital pins 0 (RX) and 1 (TX) are used for the serial communication. The status of pins 2-13 are shown with light indicators (Green=HIGH). Voltage on analogue pins A0 to A5 are shown on the rolling graph.

In this example, we use an XBee HC-06 Bluetooth module and an XBee Shield. This makes circuit construction quick with no cables or breadboard. In this case we have just stacked the three circuit boards.

stack
Stacking of the Bluetooth module, shield and Arduino Uno.

When running the demo, unless you tie the inputs (digital & analogue) to ground that are not being used, you will probably find them fluctuating. An alternative way to tidy things up is to modify the panel in the app and remove all the data channels not used from the graph/digital indicators.

Components used



Arduino code


// Uno Monitor Via Bluetooth
// By keuwlsoft:  www.keuwl.com  26th Sept 2015
// cc Attribution-ShareAlike

// This sketch monitors the Analogue and Digital Inputs and sends
// the results via Bluetooth to keuwlsofts 'Bluetooth Electronics' app.
// Digital Pins 0 and 1 for serial commincation, Pins 2-13 Monitored.
// Analogue pins 0-5 monitored on graph in app.

String colors[]={"R0G0B0","R0G150B0"}; //App Light colours for LOW and HIGH
String receive_chars="abcdefghijkl"; //so app knows which data goes where
int interval=100; //Gives the serial link and app a chance to process data
float voltage; //Assumes 0-1023 range over 5V

void setup() {
 //Initiate Digital pins as Inputs
  for(int i=2;i<=13;i++) pinMode(i, INPUT); 
 
 //Initiate Serial for Bluetooth Communication
  Serial.begin(9600); 
}

void loop() {
  
  //Read Digital Pins and Send results over Bluetooth
    for(int i=2;i<=13;i++){
      Serial.print("*"+String(receive_chars.charAt(i-2))+colors[digitalRead(i)]+"*");
    }

  //Graph - Read Analogue Pins and Send Results over Bluetooth
    Serial.print("*G"); //using 'G' as receive char for graph in app
    for(int i=0;i<=5;i++){
      voltage=analogRead(i)*0.0048828;
      Serial.print(String(voltage)+",");
    }
    Serial.print("*");
    
  //Pause before taking next measurement
    delay(interval); 
}


Programming the Arduino


To program the device, make sure you remove pins 0 and 1 to the Bluetooth module otherwise the Arduino will get confused trying to communicate to two serial devices simultaneously on the same pins. On the XBee shield there is a switch to select whether the 0 and 1 pins are connected to the USB or XBee Bluetooth module. Make sure to switch back after programming. Run the Arduino software, select the correct COM Port and Arduino device in the Tools menu. Copy and paste the above sketch and click upload.

The strings for the graph data sent over Bluetooth begin with '*G'. This 'receive character' can be set in the Edit screen of the 'Bluetooth Electronics' app. The string is terminated with a '*' to tell the app where the end of the string is so that it can start processing the command. Inside the string are 6 comma separated floating point numbers corresponding the the analogue voltage on Pins A0 to A5.

To identify which Light indicator the digital status goes to, receive characters 'a', 'b', 'c', ..., 'k' and 'l' are used corresponding to Digital Pins 2 to 13 respectively. A colour for the light is attached to the string. For example '*aR255G0B0*' will tell the light for digital pin 2 to be red. The values for the RGB can be between 0 and 255. Digital pins 0 and 1 are not monitored since they are used for serial communication.

Bluetooth Electronics App


1) Run the Bluetooth Electronics app, click edit.

2) Select library and navigate to the 'UNO Monitor' demo and copy to panel.

3) Now connect to the Bluetooth device. Turn on power to your circuit so that the LED on the Bluetooth module starts flashing. Click connect on the main screen of the app. If not already paired, click on discover and wait for the device to appear in the list below. Select the device (e.g. HC-06) and click on pair. When requested you will need to enter a pin number, which is usually 1234 for these devices. Once paired, the device will appear on the right hand side. Select it and click on connect. Hopefully this was successful, return to the main screen.

4) The run button should be enabled now that we have connected to the Bluetooth device. Click run and test it out.