Go Down

Topic: Read a 12V pwm with Arduino (Read 3173 times) previous topic - next topic

bvli

Hi there!

Quite new to electronics, so please be gentle!

I need to read a 12V pwm signal in my project. How do I convert it to a 5V pwm for me to read it using the pulseIn(...) function.

I found this: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1232444802, but in fact I do not understand what to do with the resistor, transistor. (how to connect them) Wouldn't a normal voltage divider circuit suffer?

Could any of you guys point me in the right direction?

Thanks in advance.


retrolefty

Yes, I see no reason a simple two resistor voltage divider wouldn't do the job just fine.


Lefty


bvli


Yes, I see no reason a simple two resistor voltage divider wouldn't do the job just fine.


Thank you very much.

retrolefty

Your welcome. Just remember to connect the grounds together from the 12vdc system/voltage divider and  arduino ground pin.

Gadgeroonie

would a zener diode also work to protect the input on the arduino ?

what would happen if the 12v signal went to say 100v by accident

retrolefty


would a zener diode also work to protect the input on the arduino ?

Yes that is another method, one say 4.7vdc zener diode and one current limiting resistor would 'chop' the +12vdc signal to a 0 - 4.7vdc signal.

what would happen if the 12v signal went to say 100v by accident

If using a voltage divider a 100vdc could cause destruction of the arduino chip. If using the zener maybe nothing or destruction of the series current limiting resistor.

I like the zener + resistor solution over the two resistor divider solution.


bvli

Quote

I like the zener + resistor solution over the two resistor divider solution.

Ok, if it will protect my arduinos input it is maybe the way to go. So here's another newbie question:

I should connect the Zener in parallel with the input and ground. But where should I place the resister? And how will I calculate the value of the resistor?

Thanks in advance!

retrolefty

I should connect the Zener in parallel with the input and ground.

Yes, anode lead to ground.

But where should I place the resister?

Between input pin and source of 12vdc PWM signal.

And how will I calculate the value of the resistor?

Not critical in this application, 1k ohms should work fine.

Lefty

bvli


Gadgeroonie

Lefty would a 1k resistor protect against bigger voltages like 50 v ?

Go Up