Thread: Battery voltage
View Single Post
  #3   Spotlight this post!  
Unread 19-12-2003, 10:53
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,801
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Battery voltage

Quote:
Originally Posted by Josh Siegel
Does anyone know how? If so, please respond (it's getting fairly urgent).
In PBasic use:

bat_volt VAR byte

'RC Analog Input 8, hardwired to the Battery
'Vin = ((4.7/14.7)* Battery voltage)-0.4
'Binary Battery Voltage = (Vin/5.0 V)*255
.
.
.
c_batt_volt CON 1

Serin COMA\COMB, INBAUD, [oi_swA,oi_swB,rc_swA,rc_swB,p2_x,p1_x,p4_x,p3_x,PB _mode,packet_num,sensor1,sensor2,p2_y,p1_y,sensor3 ,sensor4,p4_y,p3_y,sensor5,sensor6,p2_wheel,p1_whe el,sensor7,bat_volt,p4_wheel,p3_wheel,p2_aux,p1_aux,p4_aux,p3_aux,del ta_t,res01]


---
bat_volt will be the variable holding the value you want

For the new controller in C it’s:
current_voltage = battery_voltage * 0.038 + 0.05;

To avoid floating point processing use something like
volts1000s = (battery_voltage * 38 + 50);

The value battery_voltage is provided by the Master uP through rxdata.rc_analog01
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 19-12-2003 at 11:08.