Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

digital speedometer using AT90S2313

Status
Not open for further replies.

fever

New Member
hello all
i am thinkg of building digital speedometer published in edn.com link:(**broken link removed**)
it uses AT90S2313 which is pretty old but i still wana go with it.
before starting it,i want u people to have a look.
is it worth making,imean is this really gona work? it looks ok to me.

pls do post ur openion
thanks
 
I am just start learning AVR but these are my suggestions:

1. Do not use a bridge rectifier before the 7805 on a +12V DC system in the car. You would create two different grounds which is not necessary and have no real advantages at all.

2. The AVR reset pin should have a 10K resistor pull up to +5V.

3. Consider using the ATTiny2313 instead, which is cheaper, easily available and pin/code compatible. Just remember to setup correctly the fuses for the proper clock speed.
 
It uses it's own wheel sensor for some reason, rather than just using the one already in the car. It would be easier to just tap the cars VSS line.

Otherwise, it's a very simple design and project.
 
well thanks for ur replies guys.
i wanan use it for my bike which is powred by 12v 2.5Ah battery.so i'll use my bike battery using 7805 to power this circuit.
@eblc1388
is there any particular reason why i need 10k resistor for avr reset?
and abt using ATTiny2313,i am afraid that it might need some circuit/code modification.
 
fever said:
is there any particular reason why i need 10k resistor for avr reset?

Not particularily. The AVR itself already has a 100K internal pullup resistor at the reset pin but I usually use a 10K external resistor. You can say I don't trust/rely totally on the internal resistor when an external capacitor is also connected.

fever said:
and abt using ATTiny2313,i am afraid that it might need some circuit/code modification.

As I have said, I'm learning AVR right now so I might be wrong. As far as I know, the Tiny2313 is pin/code compatible to 90S2313.

Other AVR gurus in this forum will sure correct me if I'm wrong.
 
You do not need the resistor. Though out of habit (from PICs) I sometime pop a 10K in on the AVR, though I can remove it and it works fine.

Make sure you have decoupling. Some cellphone frequencies might be a problem. I did a circuit for a friends bike, and his Nextel would reset it until we added more caps. The circuit was in a compartment where he stored his phone.

Circuit was to make his tag go up under the fender. He told me it was for when they do their trick riding videos, before you guys jump on me. hehehe.. And yea, I doubt that was what it was for, but a fun project.
 
thanks guys
i'll start making it soon.i hope it will work.
main problem iam facing with it is pcb layout.that site is't providing any layout for this ckt,and my drawing skills sucks :-(
 
Try Eagle CAD, it is nice, capture it, click board, drag parts on the work area, autoroute, then you move them parts and traces around. Also, you can SPLIT traces, and add jumpers and not have to mess with double sided boards.
 
oooffff
making PCB layout is not really that easy.any way i'll request someone on net to design it for me.

and about the code.the default radius 0specified in the ASM is 25cm.
i found only one place where this 25 is being used.is it ok or i missing something

;########Registers used for delays############
.def low_del=r24
.def hi_del=r25
 
No. You have look at the wrong place. See the following code.

Code:
;############For distance measurement################
;After every 100 m the registers holding distance values 
;are incremented. For this we have used following formulae
; 2*pi*R*n/100 = 100
;R = radius of the wheel in cm (In this design R=25cm)
;n is the count which signifies that 100 m has been completed 

.equ n = $40

Now $40 is a way hexadecimal number is represented so $40 is actually 64 in decimal. According to the formula, the required N is 63.66 so the author rounded it up to 64 instead.

For different radius of wheel, use the following equation that I worked out for you from the same equation:

N= 1591.54 / R ; Where R =radius of wheel (in cm)

You do not have to convert the number N into hexadecimal as the assembler understands both format. Just write it without the "$" sign.
 
ohh thanks for the new equation
actaully my wheel size is 30cm so N=1591.54/30=53.051 or 53
so the new code shld be
Code:
;############For distance measurement################
;After every 100 m the registers holding distance values 
;are incremented. For this we have used following formulae
; 2*pi*R*n/100 = 100
;R = radius of the wheel in cm (In this design R=25cm)
;n is the count which signifies that 100 m has been completed 

.equ n = 53

is this right?
 
Yes. But you should also change "in this design R=25cm" to R=30cm in the comment too to remind yourself later when you read back the code.
 
@eblc1388
thanks ur really helpfull.
thanks a lot.

i think what we modified above is only For distance measurement.then what abt speed measurement.do we have to change the code there also?
 
fever said:
i think what we modified above is only For distance measurement.then what abt speed measurement.do we have to change the code there also?

Yes, you're right. I missed that.

Code:
;############For speed measurement#################
;speed = 2*pi*R*3600*clk/time_count*1000*x
;R = radius of the wheel in cm (In this design R=25cm)
;time_count = value of timer counter in b/w
;two successive interrupts
;x = clock prescaler used (in this design x=1024)
;using this we have calculated the equivalent value of 
;all the constants (except time_count all other parameters
;are constants)
;sh and sl are binary equivalent of this constant

.equ sh = $56
.equ sl = $49	
.equ sht = $57		;sht = sh + 1

Now the above formula works out to be:

Speed(Km/h) = 883.56 * R / time_count

If r=25cm, then 883.56*25=22089 and that converted to hexadecimal is $5649.

So in your case with r=30cm, 883.56*30=26507 =$678B

Thus your new code shall be:
.equ sh=$67
.equ sl=$8B
.equ sht=$68 ;sht=sh+1
 
thanks.
i compiled this code using wavrasm.and shows "2313def.inc" not found error.so i did some googling and found this file https://www.qsl.net/zl1vk/Atmel2313definc.txt
i placed this file in same folder and compiled the speedometer ASM once again.now it created a hex file(i think this is what i needed to burn on chip directly).
my doubt is is that Atmel2313definc.txt is universal.i mean can i use it for any source with AT90S2313 chip?
 
fever said:
my doubt is is that Atmel2313definc.txt is universal.i mean can i use it for any source with AT90S2313 chip?

The include file content seems to be created directly by Atmel back in 1998 so I think you are safe to use it for assembly codes targetting AT90S2313.
 
hey thanks once again.

while searching for the simple programmer for AT90S2313 chip i found this programmer(**broken link removed** looks very simple to me.is it really gona work and safe.can i program AT90S2313 directly without destroying it.i don't want any in system programer.
just burning the chip in programmer and placing it in speedometer board.thats all i need.
 
Can't advise you on that.

The programmer I built uses 74HC244 as buffer, which is also a very common design you'll find on the net. There is certainly no harm whatsoever trying the above circuit first.
 
posted on last post of page 1 I guess, as I saved and wound up on last post of page 2 to see eblc1388 answered it a couple posts ago... Sorry.
 
Last edited:
eblc1388 said:
3. Consider using the ATTiny2313 instead, which is cheaper, easily available and pin/code compatible. Just remember to setup correctly the fuses for the proper clock speed.

just setting up the fuses will do the work?i heard that AT90s2313 contain 2 fuses where as ATTiny2313 has lot of fuses.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top