simple oscilloscope

Advice on general approaches or feasibility and discussions about game design

simple oscilloscope

Postby JnK757 » Mon Dec 22, 2014 11:29 pm

hello everyone,

I played a little bit with the gambuino and thought, how I can visualize one of the unused inputs of the gamebuino and so the idea of using the gamebuino as a simple oscilloscope came into my mind.

my simple code:
I scaled the input value to 33 px because of the 3.3volts.
Code: Select all
#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;

int xcount = 0;

void setup()
{
  gb.begin();
  gb.battery.show = true;
  gb.titleScreen(F("osciloscope\nCK connection"));
  gb.setFrameRate(1000);
}


void loop()
{
  if(gb.update())
  {
    for(xcount = 83; xcount >= 0; xcount--)
    {
      gb.display.drawPixel(xcount, 47 - (map(analogRead(A5), 0, 1024, 0, 33)));
    }
  }
}

I tested the program with a funktion generator. I used a sinus-funktion and started with a period-time of about 2 seconds. I slowly lowered the period-time until I didnt see anything. That was at about 7 milliseconds period-time. I think thats quite impressive!
If you dont have the possibility of a funktiongenerator, I recommend the use of a photoresistor for the voltage drop. With this probe you can see, something like the refresh rate of your lcd screen! : )
http://youtu.be/1gh80ypLK2U

I also made a other program with for more information about the input, but I wrote the code very bad, because I lowered the input frequence with too much dataprocessing and other things.


Now i want to improve it. Any ideas?
Last edited by JnK757 on Tue Dec 23, 2014 6:54 pm, edited 1 time in total.
JnK757
 
Posts: 2
Joined: Thu Dec 11, 2014 10:30 pm

Re: simple oscilloscope

Postby Myndale » Tue Dec 23, 2014 2:20 am

Cool! :) You could use the DAT pin as a second channel and use it as either a trigger or for X-Y mode. Use a modified version of the SD library and you could stream to a binary file, thus turning Gamebuino into a signal analyser.
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am

Re: simple oscilloscope

Postby JnK757 » Tue Dec 23, 2014 7:48 pm

thanks for yor reply,

maybe i will implement the dat pin as an additional input, or i will make it to an output for a funktion generator instead.
x-y mode seems not realy relevant for me.
the biggest problem is, keeping the frequency high and the sample rate constant. so i think one option would be: minimal data processing between the samples. the other option is to seperate the process, into datalogging and data processing and redering. or?

what do you mean with a modified sd library, do you have link for me?

a additional project of mine, would be a datalogger. a serial input signal from the i2p interface (grove modules), processing the data, and save the data on .txt file on the sd card.
JnK757
 
Posts: 2
Joined: Thu Dec 11, 2014 10:30 pm


Return to Project Guidance & Game development

Who is online

Users browsing this forum: No registered users and 8 guests