PIC12F675 Oscilloscope

This is a simple PC voltage oscilloscope using only a PIC12F675, a 20MHz oscillator, and a RS232 level shifter. The PIC takes a sample on GP2, immediately sends it to the PC at 115,200 baud using an software asynchronous serial routine, and repeats. It sends a 8-bit value that is read by the Visual Basic software and displayed on the screen (see examples below). The Visual Basic software deduces the time period between submissions and adjusts the display accordingly.


The microcontroller code can be downloaded here:
uSendAnalogHS.jal (hex)

Visual Basic code example: 675OscilloscopeDR1r1.zip

31 thoughts to “PIC12F675 Oscilloscope”

  1. I from Austria, and I would like to know what kind of version of VB you use to make the screen-output of the ADC. Sure I never used VB but I have the Visual Studio 2003 and tried to open your project. I really don’t know why the VB was not able to open it, there were some errors or something like that…

    And the other question is, why you don’t use the C# to realise your projects. I use it because it is use fuller when your are going to integrate it into a software solution.

    Have a nice day
    Ranko

  2. Ranko – I’ve been using Microsoft Visual Basic 6.0 for all of my projects. I have not tried to open the project in newer versions of Visual Basic (specifically in Visual Studio 2003), so I would not be surprised if there were errors. The code is very simple (open the serial port and interpret the incoming data), but the modules may not be supported in newer versions of VB.

    The simplest reason I don’t use C# is because it was not included in Microsoft Visual Studio 6.0. I haven’t ported the code to C++ or C# because my inexperience with C has hindered me. However, I’ve been learning and working with Visual C++ in Visual Studio 2003, so porting is not out of the question.

  3. Hi Steve:
    I builded the oscilloscope with a pic12f675, the oscilator is running (20 Mhz)but in the pin 6 i have not any signal, I connected the pin 5 to the function generator and pin 6 to my tek 465 osciloscope…but no signal here…
    Can you help me please.

    Guillermo

  4. Guillermo – If you are checking the TTL serial data sent by the PIC, then you don’t need to worry about setting up the function generator until you are certain the PIC is transmitting. Are you sure the crystal/resonator/osc is running at 20MHz and that the PIC’s OSCCAL wasn’t overwritten when you wrote the PIC? I would double check by writing a simple firmware to the PIC that blinks an LED.

  5. Hi Steve:
    The trouble was in the osccal, I lost the original value (this is my first 12f675 proyect) but I write 0x3420 in 0x3FF adress. Now the oscilloscope is woking very nice below 200 Hz. in a old Thoshiba laptop with Windows 98. Thanks a lot for your ULTRAFAST HELP

  6. hi friend!

    pls for my project because my project name “safety guard for the blind “.it is used for the blind people .it function is sense the one metre range of object and tell the user. if the project is present lot of disadvantage so plse help or give me any useful eletronics projects

    by sonu

  7. #8 (sonu) – Sounds like an interesting project. Have you worked on compiling information (i.e. a literature review) about navigational aids for the blind to see if it has been implemented before? A very similar project to the one you propose is the K-Sonar.

  8. hi friend!

    pls send for the “blind people project circuit”

    give some biomedical project or electronic project.

    by
    your friend
    sonu

  9. hello sir
    thank you onthe project oscilloscope by 12f675

    but how input direct on the microcontroller

    and how input from microcontroller to serial port without trinsistor

    pls send the compelt circuit

    thank you
    khaled

  10. What´s the maximun frecuency that i can measure with this oscilloscope.

    Sorry for my bad english, i speak spanish

    DIMINUTE

  11. How I input a semnal AC from a external source .Exemplu divizor R1 R 2 from 220V ac to 5V ac.How I input a semnal AC 5V ac to PIC?

  12. Steve, please tell us which is the higher frequency that this oscilloscope can measure! I can’t figure out how to use the niquist formula… I guess it’s something about data rate and frequency You said that the this pic12F675 oscilloscope works at 20ksps, so what’s the higher frequency ? Please leave a resonse!

  13. Very interesting circuit. However the PIC in my circuit doesnt seem to work correctly with this code – please advise.

  14. I’ve seen a lot of these scopes out there recently, and they all have the same major flaw.

    OK, so how most of these work is that it samples the input using the A2D converter and the obtained number is the height of one pixel on the display, The next sample is the next pixel and so on, creating a graph of the voltages over time. The problem is that the built in A2D converter is painfully slow. And to make things worse you need at least 10 samples per wave period in order to obtain any useful data from the signal.

    You did good work, and I admire the simplicity of the hardware. But it’s easier, cheaper, faster, and will provide a similar sample rate to make one that uses a PC sound card instead. It’s the same idea; just most the work is done for you. And there is a vast collection of programs out there already made for doing the job. The trick is to get a good sound card. more specifically one with an extremely high sample rate. (Can resolve higher pitch sounds)

    A sound card based scope also has the advantage of easily being made a “dual trace” scope by virtue of the fact that most all sound cards are stereo or better.

    Often times if you need more samples, you need a lot more and it’s almost impossible to DIY a 100+Mhz scope that’s cheaper, or as high quality as what you can buy.

    If you plan on looking at purely digital signals then I suggest NOT making an oscilloscope, but making a PC based “logic analyzer” Much higher sample rates are obtainable using purely digital and the circuits are simpler/cheaper also.

    Any way thats my 67 cents (much more than 10) -Oblivion

  15. Any chances to have hex/bin for 12F683? Also it may be nice to have one of the spare pin to flash a LED to indicate the circuit is working…. 😉
    Or use the one spare input for optional dual channel display (and half the sampling rate for each channel…) and the other one to select (H/L) 1-ch or 2-ch operation.

  16. hello friend i was wandering if you can re write or edit software (i dont know vb) so we can drive 12f675 directly from serial port.therefore we can simply connect circuit and work?
    thanks

  17. Bueno lo arme me hice mi propio circuto impreso y listo partio al toque,
    eso. Desde Chile Pais Terremoteado.

Leave a Reply to OblivionCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.