The online racing simulator
AVR and LFS
(13 posts, started )
AVR and LFS
I am somewhat new to programming AVR and I wanted to know has anyone made a servo driver for speed and tach information through outgauge and released the code? My searches have been fruitless so far.
Also, I am using attiny2313.
The only thing I know of along these lines is a simple program to output gear details to LCD and/or LED matrix over parallel I'm afraid. There are a few people who have done this, but I believe that they've been using phidgets which come with their own API for talking to the servos, etc.
You can use timer1 and ocr1a / ocr1b on the attiny to drive two servos. Take a look at this page.

You don't need an external oscillator, the internal one (1MHz default, 8 if you disable the CKDIV8 fuse) will work just fine.

edit: or do you mean the servos built into a car dashboard module? As far as i know there isn't a universal way to connect one of those. On modern cars they are controlled by the onboard computer, without documentation it would be very hard to use one of those. Old cars get their tacho signal from the ignition system or alternator, that should be a lot easier.
Thanks for the page, I will start investigating ASAP.
No, I don't want to use a car's tachometer. I'm thinking about taking a servo, mounting it somewhere and placing a paper under it as scale. Ain't gonna be pretty, but it's a jumping point.
I've done some work with an mega169 before which had a 7seg display and 8 rev lights which wasn't hard to make with c#, because serial communication is very easy in .net
I haven't played yet with servo's and using that as a tachometer, so if you finish the project i'd like to see the code
How hard is it to get a few servos into a Parallel/Serial port? .NET makes communication to the ports a doddle My expertise is not with hardware though...
Quote from dougie-lampkin :How hard is it to get a few servos into a Parallel/Serial port? .NET makes communication to the ports a doddle My expertise is not with hardware though...

it will probably work, but it's really cpu intensive to do. Windows (and any other non-realtime os) isn't made for +/- 0.05 ms accuracy, so your servo will not move very smooth.

this is how a servo signal looks:

_________ _________
_| |________________________| |__
|< 1/2ms >| |
|<--------- 20ms ----------------->|


a servo has a 3 wire connector. +5 (red), ground (black) and signal (usually white). The signal wire goes to pin 2 of your parallel port. If you write a 1 to the parallel port it goes high, 0 and ik will go low. For power, you can use the internal power supply from your pc. If you use an external power brick or battery, don't forget do connect the ground from the external power source to the ground of your pc.
Do not, i repeat, do not use an USB connector for power. It can't provide enough current to drive a servo. You will get an overcurrent warning.

the high part should be between 1 and 2 ms. 1.5ms is the center position. Some servos accept a wider range, like 0.6 - 2.4 ms. 1.5 is always the center position.
I'm having trouble with my AVR right now, so the project is on halt.
But just to continue kingfag's subject, I have tried working servos through parallel port. Did not work. (I tried to get it from side to side - 1ms and 2ms delays). Nothing happened.
It should at least wiggle or trying to fry itself :P
Are you sure your parallel port does what it's supposed to do (and you got the right pin)?
You might need a driver to access the parallel port, like dlportio. You only need to install it, you don't need to use it in your software.
Yes, I have done connection of LFS with AVR microcontroller for speed and tach (the second one is still in progress)...

You can read more info here:

DIY analog servo car instruments

Regards, Thanos
Okay, I finally decided to work this again. Got servos working, finally found a code that works for me.
I pretty much ripped off this guy's code. Except made it independent from computer for simplicity's sake. Anyway, now that I am able to control servos, I'll try to get a working link between PC and AVR.
You could try adding a bootloader to your AVR and make an Arduino. It has built in serial and servo libraries... among the many other things it can do.

AVR and LFS
(13 posts, started )
FGED GREDG RDFGDR GSFDG