converting 12v to 5v


  • Hero Member

    I would like to wire my doorbell (12v) to a mys node. would this work? http://www.aliexpress.com/item/Ultra-small-LM2596-power-supply-module-DC-DC-BUCK-3A-adjustable-buck-module-regulator-ultra-LM2596S/32245472014.html
    do i need anything else or just connect one end to doorbell power supply and the other end to the arduino? how do I sense the doorbell ringing? Sorry, these are probably elementary questions but I just don't know the answers.


  • Hero Member

    @Moshe-Livne , it should be simpler than that --- Just connect the ground of the doorbell to arduino's ground, and use a voltage divider below to divide the +12v by lets say, 3, and connect it to any arduino input pin.

    R1 = 670K and R2 = 470K should do the trick... 12V will become ~4V , and digitalRead() will read '1' when the bell rings (and zero when idle).

    voltage-divider-w.gif



  • the buck converter you have referenced is great for variable input voltage. so lets look at a transformer, if you use the resistor setup that goes from 240volt to 5volts for example than its a ratio NOT a standard. this simply means that if you have a drop in power than the output power also drops. this goes for batteries too, a fully charged car battery likes to be around 13.5volts, and becomes pretty useless below 12volts to start the car.
    the buck converter outputs a regular voltage untils it drops below a point usually 1-2volts above the output. I would recommend the buck converter and besides a bit of soldering and a USB connector it should work well


  • Hero Member

    @freerpg @rvendrame Thanks! as this is a constant 12v from a transformer the transistor setup should be fine. I need to use it both to feed the arduino and to trigger the pin but making two such circuits shouldn't be too much of a problem even for a soldering challenged guy like myself....


  • Hero Member

    oh sorry, there is only need for one. yay!


  • Hero Member

    no i do need 2.... still fine!!!


  • Admin

    Use the switch mode for powering arduino with 5v, and a voltage divider to detect ring status.


  • Hero Member

    @tbowmo why? not that I don't trust you, I just want to understand. is the vurrent from the 12v transformer not regulated enough?


  • Hero Member

    BTW, its a nano, not mini pro so should have a better voltage regulator?


  • Admin

    Ahh, thought that it was a board without voltage regulator on board..

    In that case, it's not necessary to use switchmode at all. connect the 12V (DC) to RAW on the nano/mini, and then voltage divider for the ring signal.


  • Hero Member

    @tbowmo you learn something new every day! I never guessed you can feed this kind of current in. Thanks! Will finish the door bell as soon as i get my wirewrap tool back....



  • I added a doorbell alert with mySensors back in the fall -- I was going to post the code here, but I seem to have misplaced it. I have a trigger going to the VERA and a mosfet driving a couple of feet of bright LEDs strung over either side of the door frame between the two sides of the basement. These flashes a few times when the bell is rung, and the vera sends me a prowl message as well. I haven't missed any deliveries since adding it.

    However, my 1955 era house here in the US uses AC voltage for the doorbell circuit ( it seems most, but not all, here in the US do as well ). Since the actual transformer is in a difficult to access area of the attic ( I think I code violation now ), I tapped into the wires as they run from the door bell button to the actual bell, this line was easily accessible in the unfinished side of the basement.

    I just built a small bridge rectifier from 4 diodes 'dead bug' style on the pins of a relay, and covered the whole thing in some shrink. The relay just grounds a pin on a pro-mini. The pro-mini is just powered by a scavanged wall-wart which also provides enough current to flash the LEDs...

    IMG_2692.jpg


  • Hero Member

    @soward yep.... Mine will send me hangouts message. And probably also a snapshot of who ever dared to ring my bell....
    I have no idea what half of the terms you used means but will look that up when I am home. Dead bug? Bridge rectifier?

    I am actuslky luckier than I thought. The ring just short two wires so can trigger the nano directly. Its so easy its frightening....



  • dead bug is just a term for soldering together components w/o a breadboard or similar to put them on -- the resulting bits of electronics with wire 'legs' sticking out looks sorta like a dead bug. There's an art to doing it and making it still look nice which I never learned.

    A bridge rectifier is a very simply way to convert AC into DC by using 2 (for a 1/2 wave) or 4 (for a full wave) diodes. Wikipedia probably has a better explanation than I could come up with though.

    I added the lights as a secondary feature, since sometimes the lag of getting the message out and back to my phone was enough that I could miss someone -- that and I might have the phone on the charger, and not hear it (or be on the phone and not be able to see the message, etc).

    regardless, sounds like your bell is a bit easier to work with than mine was.

    I'd like to have a camera there as well, but it's going to be a challenge to get one mounted appropriately.



  • For what it's worth, I have a couple of the power supply boards from the OP that I'm using with a bridge rectifier to convert from a 24VAC sprinkler system to DC voltages appropriate for Arduino. Much cheaper to get the rectifier and DC-DC board separately than a dedicated AC-DC board that is effectively the same thing. If memory serves, I think my doorbell is also on a 24VAC transformer, so that would be appropriate here, too.


  • Hero Member

    @soward OK, I knew it was too easy to be true. apparently the transformer is 9v AC and the doorbell ring closes ~6v dc circuit that has the tiniest current on it (9ma). So, I can't steal current from the 6vdc so need to use the 9vac... so, bridge rectifier? and how do I "sense" the closing of the circuit without triggering a doorbell ring? I tried connecting the arduino with pin 3 and gnd in parallel to the door ring but it triggers a continuous ring. darn, and i thought that this at least will be simple!


  • Hero Member

    This post is deleted!

  • Hero Member

    Maybe if you post the circuit, it will be easy to understand. Anyway, I think the less-invasive method is by using a optocoupler:

    voorbeeld - dragoslav_1.jpg


  • Hero Member

    @rvendrame here is the page from the manual:
    doorbell_20150626_0001.jpg

    my installation is the one without the batteries,
    i'll get some optocouplers and play. Thanks!


  • Hero Member

    @Moshe-Livne Do you have a volt meter? Than measure between 0 and 1 while pressing the button and releasing it (or 0 and 2, depending which one is used) and than post your measurements. From the pictures I imagine that it is a DC circuit.


  • Hero Member

    @rvendrame Oh wow. there are zillions of kinds... As aliexpress are a bit thin on details, anyone knows when one I should get to detect 6v 6ma ?


  • Hero Member

    @AWI It is 6vdc, about 6ma current. i tried to tap it for powering the arduino but its not enough


  • Hero Member

    @Moshe-Livne going back to an earlier suggestion from @rvendrame (adapted a little for the situation)

    Current is not important here as long as you do don't power the arduino from it. Just connect the ground of the doorbell to arduino's ground, and use a voltage divider below in parallel (U1) with the pushbutton. This divides the voltage of +6v by 1.5, and can be connected to any arduino input pin (Digital or Analog).

    R1 = 470K and R2 = 670K should do the trick... 6V (U1) will become ~4V (U2) , and digitalRead() will read 'low' when the bell rings (and 'high' when idle).

    voltage-divider-w.gif


  • Hero Member

    @AWI Errrr tried something similar before and the bell was ringing continuously as if the arduino acted as a short. might be something stupid i did. I excel in these. maybe defined the pin as output. will double check tomorrow.
    Thanks!


  • Admin

    hmm.. only 6v DC?

    why use optocouplers for that? Could also be done very simple with a resistor and one or two diodes.

    connect gnd together, a 10-100k resistor in line with the +6V signal to the input on arduino, and a clamping diode to VCC (optionally a second clamping diode to GND for good measures).

    See the first answer to the question here http://electronics.stackexchange.com/questions/45127/what-kind-of-diode-to-use-with-adc-inputs


  • Hero Member

    @tbowmo , I suggested the optocoupler as an alternative to not trigger the ring as Moshe Livne had mentioned. But I agree with you, it should work without it if connected in the right way.


  • Hero Member

    @tbowmo SO, just re-iterating so I wont do something stupid:

    1. I still need a bridge rectifier or some sort of ac-dc regulator/transformer to drive the arduino as the dc circuit does not have enough juice
    2. the circuit will look something like:
      edit#breadboard.jpg
      (the simulation shows zero current so i probably did something wrong)

    Again, thank you for your patience.


  • Hero Member

    @tbowmo added the door bell to the simulation and its working. you are the bestest! now to get some diodes.....


  • Admin

    @Moshe-Livne

    That doesn't look quite right. If you look at the link I provided, you will see that the resistor is in line with the signal from "outside" to the arduino. So 1 side goes to the doorbell, the other go to the arduino pin. Then the two diodes go from arduino pin and vcc, and arduino and gnd.


  • Hero Member

    @tbowmo did I get it right now?
    edit#breadboard (1).jpg
    its a shame that they don't have ac power supply there so i can't simulate the rectifier. nifty site...


  • Admin

    @Moshe-Livne

    Without knowing the details of the doorbell, I would think it is something like this.. That is, the doorbell get power, when the button is pressed, and makes a connection to GND. So this would be the circuit that I would create:

    doorbell1.png

    It's only the arduino part you should make, the rest is the existing doorbell.. The resistor should be high value, I've put in 56Kohm, but something in the order of 56-220K ohm, whatever you have in your parts bin 🙂


  • Hero Member

    @tbowmo I think its just about the same as my messy sketch. only thing is you assumes the grounds are the same, which should be ok. got a bridge rectifier as well but had to take the kids to watch minions. sigh....


  • Admin

    @Moshe-Livne

    It seems that you have the doorbell switch attached accross the supply, so you short circuit it, when you press it.

    You also need a common ground signal, between the door bell, and the arduino.


  • Hero Member

    @tbowmo oh this power supply represents the bell circuit but i see what you mean. If the kids will give me 10 min today I'll give it a try. Door bell is one of those things you can't do after they go to sleep


  • Hero Member

    @tbowmo so, to get a common ground i just connect the "-" from the bell to the gnd on the arduino?


  • Admin

    @Moshe-Livne

    Yes, I would think so.. again, without having any knowledge to how the door bell is functioning..


  • Hero Member

    @tbowmo Oh I wish I knew. I might just open it and look although it will be a big hard to put back. currently the power from the bridge seems to be not enough to drive the circuit which is strange. the power lights up but nothing much happens. I'll go over everything once again.


  • Hero Member

    @tbowmo I have double checked everything, used the arduino connected to the computer so have a stable 5v power supply to the nano. connected external power supply with 6.3v and 8ma to ground and the external leg of the resistor - nothing...
    wouldn't it be simpler it I used npn transistor to close the circuit? I am on the verge of going the "safe" way - connecting the doorbell loop to the arduino so pressing the doorbell will short pin 3 to gnd and then activating a relay to close the doorbell circuit. this is far from being a good solution as if the sensor does not work the doorbell will not work as well, but this is stuff that I understand (to an extent 🙂 )


  • Admin

    @Moshe-Livne

    what is the voltage at the arduino input, when you apply the external power supply?

    Could you try and measure the voltage across the switch terminals in the door bell:

    1. when button isn't pressed
    2. when the button is pressed

    You need to simulate these two input voltages on the input of the circuit..


  • Hero Member

    @tbowmo this is not connected to the doorbell as I hate working in the air... so, its connected to my laptop for the 5v and debug and to a variable voltage power supply that i set to 6.3v (it shows 8ma are "used")


  • Admin

    @Moshe-Livne

    Yes, but you need to simulate the doorbell, so take some measurements on the doorbell, and copy those to your circuit. That is, if the signal on the doorbell is 0V when the button is pressed, then you should be able to short the input to your signal to 0V.

    Also, again, when applying 6.3V via your external powersupply, what is the voltage on the input pin on the arduino?


  • Hero Member

    @tbowmo i get 3.30v when power is off 4.7v when power is on. i think i used the wrong resistor... i am colour blind.... checking...


  • Hero Member

    @tbowmo no, its 67k so should be fine


  • Admin

    @Moshe-Livne

    What if you short circuit the input to GND, what voltage is there on the arduino pin then?


  • Hero Member

    @tbowmo When I connect the outside leg of the resistor to gnd i get 0 (both when the power supply is on or off) on the arduino pin


  • Admin

    @Moshe-Livne

    I think you are good to go, and try this on the actual doorbell 🙂

    This assumes that when you press the button to activate the doorbell, it shorts the input pin to GND.. otherwise it's ~ 6V


  • Hero Member

    @tbowmo I'll give it another try - it didn't work before. anyway getting near midnight here so I better get some sleep. will try it again tomorrow. Thank you for your infinite patience...
    Just a question, why not use a transistor to "sense" the closing of the circuit? is the voltage too high?


  • Admin

    you still need a couple of resistors and a transistor.. Here we have 2 diodes, and a resistor..

    But it could also be done with a transistor yes..

    / Thomas


  • Hero Member

    @tbowmo nope, still no go. strangely, when i disconnect the arduino from the computer (so it is not powered), it creates a short after a few seconds and the bell starts ringing continuously.


Log in to reply
 

Suggested Topics

  • 87
  • 8
  • 5
  • 7
  • 3
  • 1

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts