mardi 15 février 2011

Power supply, test and calibration - Alimentation, essai et étalonnage

After a couple of modifications on the new PCB, I mounted it on the robot and started to use the new voltage monitoring function.

Yes, I had to modifiy it :
First, I must admit that a I made a major mistake when designing it... The ADC0831 input line was not at the right polarity. It would have not been a big deal if I had tested the PCB without the ADC on its socket. I should have gone to sleep instead of burning one these integrated circuit... Good thing I ordered a spare one.

Moreover, The potentiometer I chose for the voltage divider bridge (9,6 V to 5,2 V max) was to light, which means the current accross it was to high, which means it got warm pretty fast and it was probably consuming way to much power...

It's always good to remember the basics like ohm's law...


Layout for prototyping board


Everything seems to work properly now. I started to try the embedded voltage monitoring tonight. What I need now is to figure out a conversion law between the actual voltage and the value read through the ADC. I run the code below on the BS2 to collect these values in excel :

' {$STAMP BS2}
' {$PBASIC 2.5}

'mesure tension
'ADC0831

'init
adcbits    VAR Word

cs         PIN 9
clk        PIN 10
dataoutput PIN 11

DEBUG CLS

'main
DO
  GOSUB adc_data
  GOSUB calc_volts
  GOSUB display
LOOP

'subs
adc_data:
  HIGH cs
  LOW cs
  LOW clk
  PULSOUT clk,210
  SHIFTIN dataoutput,clk,MSBPOST,[adcbits\8]
RETURN

calc_volts:
RETURN

display:
  DEBUG HOME
  DEBUG "8 bit bin val : ", BIN8 adcbits
  DEBUG CR, "dec val : ", DEC3 adcbits
RETURN

After collecting around 10 values, I should be able to write a "standard" piece of code, easily reusable in each new mission / program.

Aucun commentaire:

Enregistrer un commentaire