Wireless Arduino Oscilloscope
Wireless Arduino Oscilloscope
Wireless Arduino Oscilloscope
Table of Contents
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
http://www.instructables.com/id/Wireless-Arduino-Oscilloscope/
Intro: Wireless Arduino Oscilloscope
In this guide I will explain how to use a Windows 8.1 phone, Arduino Uno board, and HC-05 Bluetooth module to build a wireless oscilloscope. The phone application has
the critical functions of an oscilloscope, although the bandwidth is a measly 300 Hz. Still, if you want to see squiggly lines on your phone, it is a fun project.
Today's phones have the ability to perform real-time signal processing. The challenge is getting the data into the phone and sourcing a low-cost front end. The Arduino
Uno performs the data acquisition and packaging. It sends the data, using rfcomm, over the HC-05 Bluetooth module to the phone. The phone runs an application called
"SerialScope" that unpacks the data and plots it.
Wiring
HC-05 GND --- Arduino GND Pin
HC-05 VCC (5V) --- Arduino 5V
HC-05 TX --- Arduino Pin 10 (soft RX)
HC-05 RX --- Arduino Pin11 (soft TX)
A0 --- Analog in for channel 1
A1 --- Analog in for channel 2
Without any conditioning the input to the 'scope is limited to 0-5V. It also doesn't include any anti-aliasing filters so that can be a problem if you are doing any serious
analysis.
http://www.instructables.com/id/Wireless-Arduino-Oscilloscope/
Step 3: Download the MinSegBus library for the Arduino
In order to send data over a serial link, it is wrapped in a data frame. This frame includes a CRC and an address byte that is used to verify no frames are dropped.
The data bus library is called MinSegBus and is available on a public repository on GitHub:
https://github.com/MoreCoffee12/MinSegBus
You can fork this repository and use the code that way or use the attachment to this step. The GitHub will always have the latest version so that's the preferred method.
Either way, you will need to add the library to your Arduino IDE (see http://www.arduino.cc/en/guide/libraries for details).
File Downloads
MinSegBus.zip (5 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'MinSegBus.zip']
Step 4: Program the Arduino
To get accurate samples, the timer interrupts are used on the Arduino so this program structure might look a little different from other Arduino programs you have worked
on. This Instructable has a lot more details on the Arduino timers, if you are interested: http://www.instructables.com/id/Arduino-Timer-Inte...
The code can be downloaded from GitHub (https://github.com/MoreCoffee12/SerialScope/tree/m...), the .zip file attached to this step, or typed in from below.
// Firmware to capture 2-channels of data and send it out over BlueTooth.
// This implementation is designed to provide data to the Windows Phone 8
// Application
//
// Software is distributed under the MIT License, see ArduinoFirmware_License.txt
// for more details.
//storage variables
boolean toggle0 = 0;
// Buffers
unsigned short iUnsignedShortArray[ADCChannels*2];
unsigned char cBuff[maxbuffer];
// MinSegBus vaiiables
unsigned char iAddress;
unsigned short iUnsignedShort;
unsigned int iBytesReturned;
unsigned int iErrorCount;
unsigned int iIdx;
void setup()
{
// Serial port setup
Serial.begin(115200);
BTSerial.begin(115200);
cli();
// All the work is done in the timer interrupt service routine (ISR)
void loop()
{
return;
}
if (toggle0)
{
digitalWrite(9,HIGH);
toggle0 = 0;
}
else
{
digitalWrite(9,LOW);
toggle0 = 1;
}
if( bOutput)
{
iUnsignedShortArray[2] = analogRead(analogPinCh1);
iUnsignedShortArray[3] = analogRead(analogPinCh2);
iBytesReturned = 0;
iAddress++;
mbus.ToByteArray(iAddress, iUnsignedShortArray, ADCChannels*2, maxbuffer, &Buff[0], &BytesReturned);
bOutput = false;
}
else
{
iUnsignedShortArray[0] = analogRead(analogPinCh1);
iUnsignedShortArray[1] = analogRead(analogPinCh2);
bOutput = true;
for (iIdx = 0; iIdx<iBytesReturned; iIdx++)
{
// Uncomment this line to write to the serial port. Useful
// only for debugging
//Serial.write(cBuff[iIdx]);
BTSerial.write(cBuff[iIdx]);
}
}
File Downloads
ArduinoFirmware.zip (1 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'ArduinoFirmware.zip']
Step 5: Download and install the Windows Phone App
The application that runs on the Windows Phone is called SerialScope and can be downloaded from the Windows Store or forked from this GitHub repository:
https://github.com/MoreCoffee12/SerialScope. The software is also licensed under MIT License.
The video has the instructions on how to use the app. The only thing that's a little odd is that it sometimes fails to find the HC-05 Bluetooth device. You may have to try
this a couple times to get the connection. It happened to me in the video, you can see me bring up the connection screen twice.
http://www.instructables.com/id/Wireless-Arduino-Oscilloscope/
Related Instructables
Advertisements
Comments
http://www.instructables.com/id/Wireless-Arduino-Oscilloscope/