Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 30, 2012, 04:58:50 am
Ok guys, I'm back. Sorry for the late reply but I had a really busy weekend, so i didn't get the chance to work on the code quite as much as i hoped. I used a 36K and a 12K resistor, but i'll get back to the garage today and switch them, while testing again if it works. 2 pictures included show the circuit connected to the sensor and the arduino, while measuring the output from the opamp with the multimeter.

After setting the threshold, i turn the wheel a little bit and you see the change in voltage perfectly. Only weird thing i encountered was that, when i started i had a voltage(coming from the sensor,reduced by the resistor at) the '+'  at about 3.2V. It went up to 3.3 and down to 3.1 when i turned the wheel. I then set the threshold to 3.2V, but when i checked the + side again, the voltage was dropped about 0.1 V... This went on until i found a stable configuration at about 2.2 V i think... I'll check it again this afternoon and let you guys know.

About the code, I almost figured out how to get a timer started to count every second, but i'm struggling with the concept of counting the pulses with the other timer. Do i need to use attachintterupt every clock cycle to check if there is a change in signal? And how can i get the value of this timer to reset after every second?

I'm gonna try to put a readable code together and post it here later.
Greetz!
2  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 26, 2012, 07:29:30 am

Bedankt Paul smiley-grin Google translate? smiley-wink

Al, is there a way to know ahead wich resistors to use? or should i just try different types until i get the desired sensor voltage?

I'll build it up from scratch now and post a picture from the final build smiley-wink
3  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 26, 2012, 07:01:40 am
Ok guys,

I set up the sensor to the circuit and the arduino, and it works! I've set the treshold to 3.50 V and adjusted the sensor pot so the high is at 3.6 V and the low at 3.4. When i turn the wheel slowly i can see the output from the opamp shift from 0 to 5V and back. If i turn it fast i can't see it, but that's because my multimeter is too slow.

All thats left for me to do is compile a code so that the arduino timer counts the amount of pulses per second... I'll try to start with that myself but you'll probably hear from me again here asking for help :p

Anyhow, thanks for the solution and the awesome replies. If i don't encounter any problems anymore i'll post some pics here of the whole project

Greetz
4  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 26, 2012, 03:52:02 am
The circuit is still just as in the last drawing (but without sensor ) smiley
5  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 26, 2012, 03:16:51 am
Are you sure? Because Al said we should use the test pot to trim the sensor signal, seeing as it is 10.5 V and i only have a opamp supply of 5V

Quote
Re that 10,5V all you need to do is divide it with 2 resistors so that its minimum and maximum are between 0V and 5V
The op-amp is good for 36V but it will only function with inputs between it's supply voltage, 5V in your case.

We can use that 50K pot to divide the sensor output once the comparator is working ....
Basically all that will be needed is to feed the sensor to the top of the pot in place of the 5V we are using to test.
Having said that not knowing what the signal levels are or for that matter what each pulse represents may be a problem.
but we can give it a go.

greetz
6  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 26, 2012, 02:52:23 am
Ok so I just need to connect sensor input to the trim pot we used to test, and then goes to arduino ground and the middle pin to '+' ?

And should I just connect sensor ground to the arduino ground?

@ dhenry : I might give it a try later , but just to be sure:  it appears to be a 10.5 V signal (i'll measure again later to know the exact range), this won't damage the arduino inputs?

I need to work on some cars this morning but i'll be able to proceed testing in an hour or three smiley-wink I'll check here first though :p
Thanks

[edit] @ Paul, yes that describes exactly what it does now smiley-wink
7  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 25, 2012, 04:46:59 pm
Hey man,

I set up the circuit in the last picture, works like a charm! So tomorrow i just need to add sensor output parallel on the pot's with ground from the sensor to the ground on the circuit (and arduino)?

Thanks a lot, you have been a great, great help!
8  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 25, 2012, 09:57:47 am

I tried to do as you said, so i soldered another wire from 5 V to the pot, who then goes to ground. It's now in parallel with the first pot. I use the mid connection from the new pot on the + , with still a 47K resistor to ground from there... When i try to put on 5V from the arduino, the arduino shuts off untill i disconnect the 5V wire... Must be something in the circuit no? I'll check it out later 2nite, when i will also post a picture of the circuit (don't have my microSD adaptor with me to get the pics off my phone..)

Also new fact:

I measured the car's sensor (2 wires) and when the wheel is still it apparantly gives about 10.5V offset. I think the engineer from ford sent me a scope from the front wheel, while i'm measuring the rear wheel. I don't think this is a problem? I mean, i just need to be able to up the threshold to 10.5V, and i think the opamp can take 36V?

I'm afraid to ask the engineer about it, cuz i live in belgium and ford genk, the factory plant, was closed down yesterday... 10 000 ppl lost their jobs so i'm not that eager about harassing them anytime soon with this subject :/

You'll hear from me tonight smiley-wink
Greetz
9  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 25, 2012, 08:53:58 am
Ok well i'll quickly test it on the sensor first in this configuration and if that doesn't work i'll swap the inputs smiley-wink

It can take another day or two, i'm trying to get it ready for the rally next week thursday smiley-wink If i can't find any solutions i will post a picture of my circuit tonight smiley-wink

Greetz
10  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 25, 2012, 08:39:08 am
@ Al,

Power supply is the 5 V pin on the arduino. Ive hooked the ground and all the excessive inputs on to 1 point, and then i connected that point to the ground on the arduino.I have another trimmer (range 50K).

I'm getting about 0,08 mA on the output

@ dhenry,

Isn't the reference the input on the '-'? The constant 2.2 V threshold?
 So how can i measure correctly? I'm using a Multimeter (elix LX-64)
11  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 25, 2012, 07:56:50 am
Ok guys, i grounded all the excessive inputs an enabled the pull up resistor in the arduino. I'm getting somewhere now, but it's still not how it has to be: The output always gives 5V now.

When i put 5 V on + and 3.2V on -, output is 5V
When i put 0 V on + and 3.2V on -, output is 5V

any ideas?

@ dhenry, it is repeatitive (constant amplitude), only frequency changes. I think it goes to a max freq of about 2,5 kHz..

@ Al, thanks for the info i'll check it out! However, I am using the LM 393 and not the LM339 smiley-wink

[Edit]

Ok guys, i think we are there smiley-grin I checked out your site and i the datasheet i found had other input pins in comparison with one i used earlier (weird huh), so i saw that i had grounded the output of comparator a, and was measuring on the output of comparator b (while using comparator a's inputs).

The circuit works beautifully when i test it with PWM now, i'll try and check it on the actual sensor right away smiley-wink

You've been great, thanks a thousand times

[Edit2]
Looks like i've cheered to soon... After testing a little more with PWM , it seems that the output is just always the same as the input... When i put PWM signal at about 2.5 volts , the output gives 2.3 V or something, same with 1.8 (1.6 output)... Do you think it's not comparing? I've set threshold at 2.2 V
12  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 25, 2012, 07:02:42 am
Allright, i'll ground 'em and if that doesn't work i'll switch the inputs up smiley-wink
Will let you know what happens,
Grtz

[Edit]: and yes, i'm using the LM393N smiley-wink
13  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 25, 2012, 06:38:29 am
Hey guys,

So I soldered the circuit , used a 0,01 µF  capacitor and a 47K over '+'. The trimmer (range 10K) works fine as you said, and threshold is easy to set. I checked the circuit multiple times and i get good values at the opamp pins, except for the output.

I used arduino's PWM for signal on + to test it, and the result is everytime 0V on the output.

So i have 5V on '+' and 3.1V (set for the moment, just to test) on '-', output is 0V.
If i have 0 on '+' and 3.1V on '-' , output is 0V.
I used a second opamp to check if it wasn't the opamp, but that delivered the same result..
What could be the issue here?

Also , on pin 5 & 6 the LM393 has a second comparator , on these inputs i get about 3V while there is no wire connected to them?

Thanks smiley-wink
14  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 24, 2012, 08:20:07 am
Thanks Dyslexic, I'm soldering the circuit now and i'll come back to you with the results asap!

How exactly do you mean , "set the threshold"?
I'm quite the n00b on the electronics department, i did study mechanics but we only had 1 course about electronics or so... Learning a lot here though smiley-wink

15  Using Arduino / Programming Questions / Re: Pulse counter - using internal comparator? on: October 24, 2012, 06:43:48 am
Ok guys, love the enthousiasm on this forum!  smiley

I'f I understand correct the circuit should look more like this then? Except for the one difference that the LM393N has a ground pin, so i guess don't need a connection from my sense resistor to ground anymore? I understand it should give either 0V or 5V on the output, and then i can use attachInterrupt() to acknowledge the flank change... Just to be sure of the signal from the sensor output, I emailed an engineer from Ford, he sent me a screenshot from the sensor in 1st gear . I was only able to measure at very low speeds because i had to turn the wheel manually. You can see it below.

Should i connect the ground from the signal also to the opamp, or just the signal wire? I attached the ground from the LM393 to the arduino ground pin.

I'll solder the circuit and give it a try later smiley-wink

@dhenry: I was thinking the same, but i think the other guys are right and it's safer to do it with an opamp... plus i lack the programming skills smiley-wink

Pages: [1] 2