Introduction: LinkitONE DIY Oscilloscope

About: I build products which solve real world problems.

Ever wanted to own a oscilloscope? Well it starts from $300 which can't be afforded by all! So I came up with a new solution for this!

Imagine, if you could use your PC screen as display, and your LinkitONE as data receiver!!!

YES, you can do it, and that too under $100!

Let's get started!

Step 1: What Do You Need?

1) LinkitONE Board

2) micro-USB cable (to program board)

3) Many sensors to test!!!

(I'm using sound sensor, PIR motion sensor, air quality sensor, DHT temprature sensor, dust sensor etc.)

Step 2: Hook Up Your Sensor(s)

Here you should chose any kind of sensor that can give you an analog reading. You can use any of the analog sensors available in the world!!!

Sound sensor, light sensor, soil moisture sensor, touch sensor!! even more! Any!

Step 3: Writing Some Code

The code is really simple here! There's nothing much!

We're just taking a analog reading from sensor and then sending it to the computer. Then a program in the computer will convert the data to a real time graph.

CODE:

------------

#define ANALOG_IN 1
void setup()

{

Serial.begin(9600); //Serial.begin(115200);

}

void loop() {

int val = analogRead(ANALOG_IN);

Serial.write( 0xff );

Serial.write( (val >> 8) & 0xff );

Serial.write( val & 0xff );

}

------------

Okay, so now burn this code to your board. In the next step we'll write another code for the computer to visualize the readings.

Step 4: Developing the Graph Interface

We'll be making the GUI part with processing software. First of all download processing from www.processing.org and install latest version.

The code is really simple, we're just taking readings from the serial and then plotting a graph. Please download the code attached in this step.

CODE:

---------

import processing.serial.*;

Serial port; // Create object from Serial class int val; // Data received from the serial port int[] values; float zoom;

void setup() { size(1280, 480); // Open the port that the board is connected to and use the same speed (9600 bps) port = new Serial(this, Serial.list()[0], 9600); values = new int[width]; zoom = 1.0f; smooth(); }

int getY(int val) { return (int)(height - val / 1023.0f * (height - 1)); }

int getValue() { int value = -1; while (port.available() >= 3) { if (port.read() == 0xff) { value = (port.read() << 8) | (port.read()); } } return value; }

void pushValue(int value) { for (int i=0; i

void drawLines() { stroke(255); int displayWidth = (int) (width / zoom); int k = values.length - displayWidth; int x0 = 0; int y0 = getY(values[k]); for (int i=1; i

void drawGrid() { stroke(255, 0, 0); line(0, height/2, width, height/2); }

void keyReleased() { switch (key) { case '+': zoom *= 2.0f; println(zoom); if ( (int) (width / zoom) <= 1 ) zoom /= 2.0f; break; case '-': zoom /= 2.0f; if (zoom < 1.0f) zoom *= 2.0f; break; } }

void draw() { background(0); drawGrid(); val = getValue(); if (val != -1) { pushValue(val); } drawLines(); }

--------

Once you've done this move to next step and start testing your oscilloscope!

Step 5: Testing It Out!

Now test it out!

Plug in your Linkit board and then run the program you made in processing by clicking the play button!

You'll be seeing the readings update in real time! You can try it with different sensors! Cool? try some more :D

Step 6: Testing Sound Sensor

This is the sound sensor!

You can see the readings analysed while taking breath.

Step 7: Testing Air Quality Sensor

You can also test air quality! The program plotted a graph about air quality in my room that changed in 30 seconds.

Step 8: Testing PIR Motion Sensor

Wala! Motion sensor! You get digital readings in this! You'll have lot of fun testing it!

Step 9: Final Touches!

Cool! You can also make a simple frame box that is portable so you can carry it anywhere!