jeanninemtv
Senior Member
Offline
Posts: 311
Thank You
-Given: 57
-Receive: 25
|
|
« on: April 19, 2009, 01:02:04 13:02 » |
|
hello,
i bought a bike speedometer, but i wish to adapt it into a more complex toy with a microcontroller, the problem is that i can't identify at all the sensor, because it's not powered (2 wires only, see attachment) but it gives me voltage when the magnet aproachs. as i know there are magnetic sensors who works as switches but this gives me voltage... it's a little confusing. it give me peaks of 12V ! -i did the measures without powering it to the speedometer, -
|
|
« Last Edit: April 19, 2009, 01:04:56 13:04 by jeanninemtv »
|
Logged
|
|
|
|
oldvan
Senior Member
Offline
Posts: 372
Thank You
-Given: 154
-Receive: 107
If the van is a Rockin'...
|
|
« Reply #1 on: April 19, 2009, 02:37:28 14:37 » |
|
Measure its resistance, a good guess is it is simply a coil of wire on an iron core. Resistance will be relatively low if it is.
|
|
|
Logged
|
Give a man a fish and you feed him for a day. Teach a man to fish and he will sit around in a boat drinking beer all day.
|
|
|
Trishool
Active Member
Offline
Posts: 113
Thank You
-Given: 9
-Receive: 9
|
|
« Reply #2 on: April 19, 2009, 03:32:04 15:32 » |
|
hello,
i bought a bike speedometer, but i wish to adapt it into a more complex toy with a microcontroller, the problem is that i can't identify at all the sensor, because it's not powered (2 wires only, see attachment) but it gives me voltage when the magnet aproachs. as i know there are magnetic sensors who works as switches but this gives me voltage... it's a little confusing. it give me peaks of 12V ! -i did the measures without powering it to the speedometer, -
It looks like a Variable reluctance sensor . When the magnet approaches the coil it induces an AC voltage in it (a kinda pulse) . All what you have to do to interface a MCU to it is use a diode fectifier and convert it to DC now use OPamp stages to bring the voltage level to your desired ADC range and calibrate it. Another way could be to use a schmitt trigger at the output of the signal and use your MCU timer to count pulses and calibrate it . Thats all . Ts
|
|
|
Logged
|
|
|
|
jeanninemtv
Senior Member
Offline
Posts: 311
Thank You
-Given: 57
-Receive: 25
|
|
« Reply #3 on: April 19, 2009, 03:54:10 15:54 » |
|
Then:
1: i have to use a bridge before pass it on a "whatever - to - TTL " stage.
i think i wil use some inverter gates one or two- depending- to do that , if there's no other more elegant solution.
thank you for your answer. i will continue in these days with my proj.
|
|
|
Logged
|
|
|
|
Biggles
Junior Member
Offline
Posts: 47
Thank You
-Given: 15
-Receive: 23
|
|
« Reply #4 on: April 20, 2009, 12:07:44 12:07 » |
|
Yes, put it through a bridge rectifier, and then maybe into the emitter led of an optoisolator. Nice buffer with noise immunity and input voltage protection to your microcontroller.
|
|
|
Logged
|
Man who act in haste, repent at leisure.
|
|
|
DTiziano
Active Member
Offline
Posts: 104
Thank You
-Given: 41
-Receive: 168
|
|
« Reply #5 on: April 20, 2009, 02:10:01 14:10 » |
|
Since you do not have the sensor specification, I suggest you to test it (simulate and monitor) like on your final application. From the reported shape the output seems to be a clipped Direct Current, did you try at different speed ? Are the wave the same ? With such case the simplest interface could be a dividing resistors plus a clamp diode from MCU input to VCC. Since the signal rise rate is quite slow use a schmitt trigger input.
VCC | diode | signal --resistor--- MCU input | resistor | signal ----------- | GND
|
|
|
Logged
|
|
|
|
jeanninemtv
Senior Member
Offline
Posts: 311
Thank You
-Given: 57
-Receive: 25
|
|
« Reply #6 on: April 20, 2009, 03:29:34 15:29 » |
|
DTiziano, it' always the same signal, not a sine but a squared one... but 12 V levels ... i'm a little bit affraid about simplicity... i think i will test a bridge + opto interface maybe... i will attach the info included with the original speedometer in the next post
for biggles: wich opto is good to use if i'm waiting to have a speed around 60kmph ? i have in my stock pc817 and 4n35 ...
|
|
« Last Edit: April 20, 2009, 03:57:37 15:57 by jeanninemtv »
|
Logged
|
|
|
|
Manuel
Senior Member
Offline
Posts: 329
Thank You
-Given: 680
-Receive: 192
|
|
« Reply #7 on: April 20, 2009, 09:06:44 21:06 » |
|
Easy JOB my dear friend!
Well, type of sensor can be a REED based sendor so it's just a switch.....or it can be a two wire self powered (parassithic powering is intended) true hall sensor.
In both case do the following... -cut the GND wire. -add a series resistor and a LED. -check the LED lightinig when magnet move over.....
Once checked... -substiture the LED with the DIODE side of an OPTO such ad 4N25 or 4N35 as well ....then enjoy the signal on the optoisolated side.
If you need help just ask.
X!
Posted on: April 20, 2009, 10:01:54 22:01 - Automerged
PS:
1st) remember to add a small filter on the secondary side of the OPTO...this will help you in case of noise.... 2nd) resistor calculation: i'd say for approximation 12V/15ma = 800ohm --> 1K (better) ;-)
X-
|
|
|
Logged
|
-> An Apple a Day does not Let U become a Macintosh!
|
|
|
jeanninemtv
Senior Member
Offline
Posts: 311
Thank You
-Given: 57
-Receive: 25
|
|
« Reply #8 on: April 20, 2009, 09:14:47 21:14 » |
|
ok friday i will try it... 1st ) you mean a little capacitor of 10nF iin parallel with the output stage? 2nd) thank you
|
|
|
Logged
|
|
|
|
Manuel
Senior Member
Offline
Posts: 329
Thank You
-Given: 680
-Receive: 192
|
|
« Reply #9 on: April 20, 2009, 10:17:00 22:17 » |
|
Related to the 1st)
10nF is ok! it solve lotta problems....but it depends also on pull-up value you use for the secondary stage of OPTO......it can reduce bandwidth.....but i'd say that for your application can be ok.
Related to the 2nd)
Use the related button... :-D
X
|
|
|
Logged
|
-> An Apple a Day does not Let U become a Macintosh!
|
|
|
TomJackson69
Active Member
Offline
Posts: 218
Thank You
-Given: 26
-Receive: 63
|
|
« Reply #10 on: April 21, 2009, 06:33:42 06:33 » |
|
DTiziano, it' always the same signal, not a sine but a squared one... but 12 V levels ... i'm a little bit affraid about simplicity... i think i will test a bridge + opto interface maybe... i will attach the info included with the original speedometer in the next post
for biggles: wich opto is good to use if i'm waiting to have a speed around 60kmph ? i have in my stock pc817 and 4n35 ...
jeanninemtv, Look the waveform on your scope, I see you have a 12V(on first picture) and 1.2V(on second picture). So which one is the signal comes out of the coil? Did you use 10x probe? You may want to pay attention on the rising edge of the signal, its very slow. You want to be able to detect the signal for 60KmpH than let do little calculation. Assume the wheel is 1.5m (I just guest) so 60000m / 3600s = 16.666m/s that is 11.1 rev/s therefore, about 90mS MAx from pulse to pulse. The 4N35 has about 2uS rise and 2uS fall time, so you can use it. Again, the rising edge of the output is very slow. You may want to feed the output of the opto-isolator to a logic gate (such as the CD4011 NAND gates) before connect it to the PIC. Tom
|
|
|
Logged
|
Con Rong Chau Tien
|
|
|
jeanninemtv
Senior Member
Offline
Posts: 311
Thank You
-Given: 57
-Receive: 25
|
|
« Reply #11 on: April 21, 2009, 07:25:13 07:25 » |
|
Tom, i used 10x probe att.
what about pc817?
Response time VCE = 2V, I C = 2mA, R L = 100ohm Rise time 4us (typical) 18 us (max) Fall time 3us " 18 us " it has 4 pins and i think it will gimme some mm2 of more space to fit some other components... btw i'm thinking to use a 12f675 who will measure rpm and/ or kph and then it will send it to a 18f4550 - i think i will use the strong pic to do some tricks with reports and statistics ... i'm reading a littl' ...
|
|
« Last Edit: April 21, 2009, 07:45:12 07:45 by jeanninemtv »
|
Logged
|
|
|
|
Manuel
Senior Member
Offline
Posts: 329
Thank You
-Given: 680
-Receive: 192
|
|
« Reply #12 on: April 21, 2009, 08:35:47 08:35 » |
|
PC817 it's ok for your application too!
i'd say you can use less current for this OPTO model. so you can increase the R value a little...so maybe move trom 1K to 1.2K....even if it's not really necessary....
Do not get killed by going on discussing about technicals of components...just test it! because the frequency you get from the sensor should be anyway low frequency.....
Posted on: 21-04-2009, 09:24:05 - Automerged
Easyer shematics can be realized....
You have just to invent your application!
If you use the external generated signal to start/stop a counter or to trigger a voltage compare....you can obtain maximum performances....to obtan best counting value...
Use interrupts!
X;
|
|
|
Logged
|
-> An Apple a Day does not Let U become a Macintosh!
|
|
|
jeanninemtv
Senior Member
Offline
Posts: 311
Thank You
-Given: 57
-Receive: 25
|
|
« Reply #13 on: April 21, 2009, 11:52:04 11:52 » |
|
ok this afternoon i will attach the schema for the 1st block wait a littl' i am at job...
|
|
« Last Edit: April 21, 2009, 06:02:12 18:02 by jeanninemtv »
|
Logged
|
|
|
|
TomJackson69
Active Member
Offline
Posts: 218
Thank You
-Given: 26
-Receive: 63
|
|
« Reply #14 on: April 22, 2009, 12:43:27 00:43 » |
|
jeanninemtv,
The PC817 has 18uS/18uS rise/fall MAX so it is OK to use.
Did you try your new circuit? Only thing is that if the output pulse of the sensor can provides enough current to light the internal LED of the opto. If not, you can do little different with what you have.
I think you can use voltage devider to get about 4.0V. Use this step down signal to feed it to the input of the CD4011 (or any invert or non invert gates. You don't have to use CD4011, it just come across my mind - In this case you already use 4093). The output of the logic gate wll be sharp for both rise and fall edges. Now this signal is safe to connect to the PIC.
If you chose to use opto-isolator than you must make sure you have enough current for the LED.
Use TMR/COUNTER to count the pulse, use interupt to adding the pulse and calculate for pulse/sec.
//=================
You have two situations here: 1/ If the signal is strong enough to drive the internal LED of the Opto-Isolator than use the circuit you have.
2/ If the signal can not turn on the LED than use voltage divider and feed the step down signal to the 4093.
Tom
|
|
|
Logged
|
Con Rong Chau Tien
|
|
|
Manuel
Senior Member
Offline
Posts: 329
Thank You
-Given: 680
-Receive: 192
|
|
« Reply #15 on: April 22, 2009, 12:10:06 12:10 » |
|
Q1 is not needed!!!!!!!
R2 i'd say it's too low if you use 12VDC...on sensor side...
you can add a small C in parallel to CE.....maybe 1nF.
;-)
|
|
« Last Edit: April 22, 2009, 12:13:21 12:13 by Manuel »
|
Logged
|
-> An Apple a Day does not Let U become a Macintosh!
|
|
|
jeanninemtv
Senior Member
Offline
Posts: 311
Thank You
-Given: 57
-Receive: 25
|
|
« Reply #16 on: April 22, 2009, 01:50:39 13:50 » |
|
oh yes i forgot the tiny cap ... and idont know what current delivers that sensor when it generates the 12V signal when magnet passes ...
i tried to measure frequences of 1hz to 100 hz with interrupts -like capture-compare- but no success. i have not enough bits to count and if i "extend" registers using auxiliar variables, i have very unstable values in simulation and in real world it makes crash my lcd ... it shows crap and no undestable values ...
that's why i will let a little pic with "counter" command work with data with further transmit to main pic ... and if i get a litte 12f683 i think i can send precalculated values of speed, because with both 12f675 qnd 12f629 it uses all the space to use counter and serial transmit
|
|
« Last Edit: April 22, 2009, 02:08:45 14:08 by jeanninemtv »
|
Logged
|
|
|
|
Manuel
Senior Member
Offline
Posts: 329
Thank You
-Given: 680
-Receive: 192
|
|
« Reply #17 on: April 22, 2009, 02:21:02 14:21 » |
|
Could you please give us specific information about the sensor?
About actual connection too!
You have to use a counter in free run mode at high speed and use the sensor signal to capture the value...properly...
;-)
Something is not clear to me!
DOES IS IT A GENERATOR?!?!?!?!?
IF So, schematic is wrong!!!
|
|
|
Logged
|
-> An Apple a Day does not Let U become a Macintosh!
|
|
|
|
Manuel
Senior Member
Offline
Posts: 329
Thank You
-Given: 680
-Receive: 192
|
|
« Reply #19 on: April 22, 2009, 06:12:14 18:12 » |
|
ok.
It should work as a reed contact.
If you use a voltmeter and check the electrical continuity....you should obtain NO RESISTANCE with NO MAGNETE and probably a value CLOSE TO ZERO if you apply a MAGNET.
(i hope it's not inductive.... :-D :-D :-D )
tell me tests results....
take care.
|
|
|
Logged
|
-> An Apple a Day does not Let U become a Macintosh!
|
|
|
jeanninemtv
Senior Member
Offline
Posts: 311
Thank You
-Given: 57
-Receive: 25
|
|
« Reply #20 on: April 22, 2009, 06:55:49 18:55 » |
|
the oscilloscope photo was taken without any voltage source and meter added... same results of voltage while measuring with Woltmeter
|
|
« Last Edit: April 22, 2009, 07:09:36 19:09 by jeanninemtv »
|
Logged
|
|
|
|
Manuel
Senior Member
Offline
Posts: 329
Thank You
-Given: 680
-Receive: 192
|
|
« Reply #21 on: April 23, 2009, 08:54:59 20:54 » |
|
Enjoy a design.
D1 = Zener Diode 3.6V.
|
|
|
Logged
|
-> An Apple a Day does not Let U become a Macintosh!
|
|
|
|