Limiting Output

willeng

Member
As a project for better understanding of load control & the need for something out of the ordinary I have built a small dynomometer made up of a 12v DC motor, the load is a small Eddy Current brake that I built.
It is controlled using a PID controller using an Arduino board that I programmed, the small setup is working better than expected & I have full load control & can ramp up & down etc as well as static load testing among some other very nice things.

I am using a LM2917N for frequency to voltage conversion from a tacho optical pickup as one of the inputs to the Arduino.

With this LM2917 I have it configured to have an output of 5v at 200Hz which is the maximum I want for this setup.
What I can't work out is how to limit the output to 5v so it doesn't exceed this value incase of a runaway situation where I will get a higher voltage output that may damage the Arduino input.

I thought I would just use a 5.1v Zener on the output but it doesn't work as expected, maybe I am doing it the wrong way?

I have included the LTSPICE file of the LM2917 circuit that I am using, could someone give me some advice on this, it would be appreciated.

Cheers
 

Attachments

Last edited:
Put a diode from the i/p on the arduino to the + supply, with the cathode to the +supply, then put a 4k7 resistor in series with the o/p on the 2917 to the arduino.
If the 2917 tries to go above 5v, the diode will conduct and the 4k7 will swamp the difference in voltage.
Standard technique and simple, you can even leave out the diode if the internal protection diode on the arduino can take it.

Couldnt you have made the arduino count the freq directly, 200hz shouldnt be difficult.
 
Thanks for the reply,

I see what your saying about the diode, I will give it a try.

I would have liked to have the Arduino count the frequency directly but I am a complete novice at programming & am a little unsure at this stage how to go about it.

I will have a look into it as it would be a better setup.

Do you know of any tutorials covering this subject on the net?

Thanks again
 
I would recommend a Schottky diode. Lower voltage drop. BAT54s are about the best. I would not rely on the internal diodes
 
I was going to ask what diode would be suitable as I don't have BAT54s available as suggested, will any Schottky diode be sufficient like 1N5819 or simillar ?

I have just found some BAT46s which should be ok?

Cheers
 
Last edited:
I've allways used 1n4148's, but there was no real design to choosing them, just whats handy, bat42/6 would have been by next choice.

I've just been working on a simple software based frequency counter, I was about to post the code but I just realised your into avr, my code is for a pic, and its assembler.
 
dr pepper,

If you don't mind I would like to have a look at your assembler program, I am trying to learn this as well, I have mplab & several different pics I have been using.

Cheers
 
Yup:

Its a pushbike dynamo lights system, the processor turns on the lights when the dynamo is turning fast enough by measuring the freq of the ac (by setting speedok flag).

Heres the section that measures the frequency and decides if the speed is ok, the section marked 'count' is what actually measures the freq, I use antirepeat flags to ensure that the incomming pulses are only counted once.

The first section minsp decides if the freq (contained in pulsecn) is high enough, the 'count' routine is run for a set time by using the speed register (250 calls = the correct gate freq), there is hysterysis on switch on and switch off speeds to avoid flicker.

;
;--------------------------------flash leds above min speed---------------------------
;
minsp decfsz speed,f
goto count
;
movlw d'250'
movwf speed ;every 0.25 seconds
;
btfss speedok
goto spdb
spdg movlw d'2'
goto on
;
spdb movlw d'3'
;
on subwf pulsecn,w
btfss status,c
goto spdbad
;
spdok bsf speedok ;speed above min so flag it
clrf pulsecn ;reset
retlw d'0'
;
spdbad bcf speedok ;speed to low forget t bomb out
clrf pulsecn
retlw d'0'
;
;--------------------------------------
;
count btfsc gpio,3 ;pulse from dynamo?
goto spdclr
;
btfsc antirepeat2 ;yes but anti repeat enabled bomb out
retlw d'0'
;
bsf antirepeat2 ;enable antirepeat
incf pulsecn,f ;else increment pulse count and bomb out
retlw d'0'
;
spdclr bcf antirepeat2
retlw d'0'
;
END ;directive 'end of program'
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…