Shop OBEX P1 Docs P2 Docs Learn Events
Voltage measurement — Parallax Forums

Voltage measurement

danielreisdanielreis Posts: 16
edited 2010-05-01 00:08 in Propeller 1
Hi guys,

I'm developing a project that I need to read a battery charge.
I'm a basic stamp user, and with it I can use the RCTIME command to make this measurement, but with propeller, how can I do that?

Best regards,

Daniel Reis

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-30 20:18
    You can use the same technique. Look at the RCTIME routine in the BS2_Functions object in the Object Exchange. This routine is intended to provide the same functionality as the RCTIME statement in PBasic.

    You can also use the Propeller's normal ADC functionality using a Sigma-Delta ADC as described in the application note (AN001) available on the Propeller Downloads webpage. This uses two I/O pins and you have to mount the passive components very close to the Propeller chip. The RCTIME technique may be easier.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-04-30 23:53
    Other options would be to use an ADC IC (MCP3202, or the like). These will give a value which is a linear representation of the actual voltage being detected which can be very simply converted to a readable voltage.
    RC techniques will give you a logarithmic return. So the voltage is detected accurately at only two points, the further you get away from those two points the less accurate it is. You could add float math algorithms to get a more accurate reading across a wider range of inputs. But in a simple RC setup, no matter what, as the voltage gets low (closer to Vdd / 2) the accuracy goes out the window.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!

    Some of my objects:
    MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
    Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
    String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
  • danielreisdanielreis Posts: 16
    edited 2010-05-01 00:08
    Thanks for the replies!

    I will try to use the RCTIME function of BS2_functions library, it appears to be simpler.

    Bye,

    Daniel Reis
Sign In or Register to comment.