Thread: A/D Voltage, write the value on a serial port

  1. #1
    Registered User
    Join Date
    Mar 2015
    Posts
    2

    A/D Voltage, write the value on a serial port

    Hi,
    I'm new here, so I hope that I've choosen the right thread for my problem. English isn't my mother-language, but I hope you'll understand what i want to explain.

    I have a Voltage Range from -10V up to +10V, which I transform to a voltage Range 0V to 5V, with the schematic i've attached, so I can use the A/D converter of my ATMEGA32 processor.

    Now I'd like to write the value of the Input Voltage (which moves in the Range of -10V to + 10V) on the serial port, but i don't know how i should calculate this factor. At the moment, I can only write the value of the A/D Converter Input on the serial, but this is only 0V to 5V...
    Can somebody help?

    A/D Voltage, write the value on a serial port-schematic-png

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,509
    If your ADC has 1024 steps, and you're working with a range of 20 volts (10V - -10V), you're looking at a resolution of:

    20V / 1024 = 19.5mV per step of your input voltage (not the transformed input to the ADC).

    So if you multiply the reading by 0.0195 (volts), you have the voltage - but for the range of 0V - 20V.

    Then you just subtract 10 from this result to get the "actual" voltage.

  3. #3
    Registered User
    Join Date
    Mar 2015
    Posts
    2
    It works now, like I want. Many thanks to ya, Matticus!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-29-2013, 05:04 AM
  2. read write serial port
    By Marvin Gorres in forum C Programming
    Replies: 16
    Last Post: 06-23-2013, 07:41 AM
  3. Write to serial port
    By sombrancelha in forum C++ Programming
    Replies: 14
    Last Post: 06-01-2012, 08:08 AM
  4. Serial port read/write problem
    By ojaro in forum C Programming
    Replies: 5
    Last Post: 06-25-2010, 08:26 AM
  5. read from and write to serial port
    By wazilian in forum Networking/Device Communication
    Replies: 3
    Last Post: 04-25-2004, 08:22 AM