Go Down

Topic: arduino oscilloscope, a nice one :-) (Read 35252 times) previous topic - next topic


Oct 02, 2010, 08:43 pm Last Edit: Oct 02, 2010, 09:08 pm by xchip Reason: 1
Ok, I got the arduino to send data at 10,000,000 bauds/sec that means it will be able to sample higher frequencies.. So far the theoretical maximum is 28Khz, although in the practice we could say it's 10Khz since you need a few samples per wavelength.

Credits! I am getting such a speed up thanks to Kiril's post

It requires replacing the slowly arduino serial files by his, which are way better!

I still need to check if I can get the ADC to work faster since I think this is what limiting the throughput...

Ok, it's sat night, and its party time! Stay tuned for the release! ;-)


hi xchip, how's the coding going?

have you considered using a hardware interrupt as a way of the user communicating that the settings have changed on the interface?

If I understand your code correctly, the Arduino questions the serial port to see if there is incoming data from the PC to arduino.  If you changed this to a hardware interrupt the rest of the code might run faster.

For example, you would change the desired settings on the C# app such as no. of channels and time.  Then you would press a button on Arduino 'telling' it to communicate 2 ways with the application to get the new settings.

just a thought... I have not done any code like this myself but I think the theory is correct.  a little bit of incoming serial data *might* be lost during the ISR but I don't think that matters if you are in the middle of changing the settings anyway.

Also, you could get faster speeds by using an external ADC but I think that would make the project quickly become a lot more complicated and it would put it out of reach for many beginners..  I really like your approach so far and the bandwidth is plenty for my purposes.


Hey I am a bit busy right now with real life but I'll be back soon :-)

Feel free to change the arduino code in the way you think it will work best and if so well add your changes to the xoscillo codebase.

Sending data only when it changes is a good idea, the problem is that data is changing all the time, the interrupt would be triggered continuously and this would be a big slowdown... what you mention would be good if the signal was to change slowly or remain constant for long periods of time, which is not the typical case.


yes, I understand about real life duties for sure : )

I think I did not explain myself well... or maybe I am way off about how the code works  - that is possible.

What I see is that the serial port has to be checked in the loop to see if the number of channels has been changed or if the trigger voltage has been changed.  My idea was to totally delete the command for reading incoming serial and have the person press a button on Arduino when they want it to get some new settings.  I am referring to this part of the code:

Code: [Select]

if (Serial.available() > 0)
   // read the incoming byte:
   unsigned char in = Serial.read();
  //read the analog input and send serial data.

so... maybe that would speed up the loop if you need it.  What you would do instead is have a hardware interrupt (button) that the user would press and it would initiate the exchange of setup data after which normal/fast reading would commence.

it's just a thought.   :)


Hey the command for reading teh serial is very fast and it doesn't cause a big delay, but anyway please feel free to try your approach and see what happens though! :-)


BTW I updated the source code with the latest improvements to get higher sample rates.

I'd be nice if someone could test them to double check. If all goes well I'll update the release.



Oct 13, 2010, 01:04 pm Last Edit: Jun 29, 2013, 08:58 pm by xchip Reason: 1
new and pretty version available!

Just in case you missed it :)

link https://code.google.com/p/xoscillo/

Go Up