Searching \ for '[PIC]: car headlight control' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'car headlight control'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: car headlight control'
2004\01\03@221931 by John J. McDonough

flavicon
face
Sounds like it to me

I assume you are using a D/A to move the pot in the headlight? (seems
strange).  Anyway, you want to make the high end of the dashboard pot set to
the maximum voltage of your A/D.  Now, presuming you are using one of the
PIC 10 bit A/D, and lets just assume, for the sake of argument, your D/A is
an 8 bit D/A, just shift the dashboard pot position right 2 bits before
sending it you to the D/A.

If you are using a stepper motor in the headlight pot, then figure out the
number of steps, and do a little dancing around with the dashboard pot
voltage to make the stepper count work out.  Watch out for your A/D
resolution, though.

I am really agin complicated, but I doubt you have to worry about slow.
Physical things like a pot are amazingly slow compared to the PIC.

72/73 de WB8RCR    http://www.qsl.net/wb8rcr
didileydadidah     QRP-L #1446 Code Warriors #35

----- Original Message -----
Sent: Saturday, January 03, 2004 9:58 PM
Subject: [PIC] : car headlight control


my concern is the code is getting too big and complicated
for such a simple device, and maybe too slow?
is there an easier way?
thanks

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2004\01\03@232651 by reinaldo

flavicon
face
sorry i was very vague
the headlight motor is a simple DC motor, and i'm going to
fit a resitor pot to the headlight to measure the angle of
the headlight, say this pot gives me 80 when the light is
down and 200 when fully open, the pot in the dash will give
0 to 255 ofcourse. so i'll need 0 to equal 80, 200 to equal
255, AND every 2.125 steps of the dash pot correspond to 1
step of the headlight pot. i can't measure .125 from a pot.
but, i'll measure the dash pot(say 60) divided 2.125 =
28.23.. so that's 28 steps for the headlight pot + the
bottom position(80) = 108, so now i work out wich way to
turn the motor untill i reach 108. that way i hope to use
the full range of the dash pot.
now you can see i need division routines, i need to store
top and bottom levels while the power is off, and i also
need to constantly calculate what position the dash pot
works out to be for the headlight pot. i don't dare remove
the current motor and replace it for a stepper, also
remember everything needs to be done for both headlights :(
can you think of a simpler method?
thanks for your advice

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2004\01\04@004026 by David Duffy

flavicon
face
reinaldo@IHUG.CO.NZ wrote:

>sorry i was very vague
>the headlight motor is a simple DC motor, and i'm going to
>fit a resitor pot to the headlight to measure the angle of
>the headlight, say this pot gives me 80 when the light is
>down and 200 when fully open, the pot in the dash will give
>0 to 255 ofcourse.
>

Just add resistors in series to the top and bottom of the dash pot.
This will give you your reduced range when the A-D reads it.
Either fixed resistors or preset pots will do the trick. Simple.
David...

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\01\04@004443 by reinaldo

flavicon
face
ha!!
so simple! i got too involved in software to consider the
hardware

thanks

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2004\01\04@010553 by Picdude

flavicon
face
Which PIC are you using?  Most that I've worked with have a 10-bit A/D, so you'd actually get a range of 0-1023, and instead of 2.125, your steps would be 8.5.

I actually prefer to do the math and reduce the number of components, but if you need more resolution from the A/D, then how about using a 3-resistor voltage divider with the 2 center points going to VREF+ and VREF- of the A/D converter.  Something like this ...

     +V
      ^
      |
     [R1]
      |
      o----> To Vref+
      |
     [R2]
      |
      o----> To Vref-
      |
     [R3]
      |
      v
     GND

In this case, the A/D will read "0" when the sampled voltage is equal to V*(R1+R2)/R3 and 255 (or 1023 if using a 10-bit A/D) when the sampled voltage is equal to V*R1/(R2+R3).  Remember that there is a minimum difference allowed between Vref+ and Vref- (~2V for some of the 16F-series chips IIRC) -- see the datasheet for the official spec.

Cheers,
-Neil.


On Saturday 03 January 2004 10:25 pm, spam_OUTreinaldoTakeThisOuTspamIHUG.CO.NZ scribbled:
{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

More... (looser matching)
- Last day of these posts
- In 2004 , 2005 only
- Today
- New search...