Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Arduino 12V analogue input

Options
  • 18-08-2017 7:10pm
    #1
    Registered Users Posts: 390 ✭✭


    I would like to connect Arduino to brake light and indicator wire and register when the wire has current.
    How do I filter 12-17V down to 5V and also keep amps and interference to minimum?
    I am very new to electronics so please forgive my ignorance :o


«1

Comments

  • Closed Accounts Posts: 3,478 ✭✭✭eeguy


    spr1nt3r wrote: »
    I would like to connect Arduino to brake light and indicator wire and register when the wire has current.
    How do I filter 12-17V down to 5V and also keep amps and interference to minimum?
    I am very new to electronics so please forgive my ignorance :o

    Cheap and cheerful would be a voltage divider.


  • Registered Users Posts: 390 ✭✭spr1nt3r


    eeguy wrote: »
    Cheap and cheerful would be a voltage divider.

    How would I make one for this particular scenario? I have a few resistors that came with "Elegoo UNO R3 Project The Most Complete Ultimate Starter Kit". Would that be enough? How about heat etc?


  • Closed Accounts Posts: 3,478 ✭✭✭eeguy


    spr1nt3r wrote: »
    How would I make one for this particular scenario? I have a few resistors that came with "Elegoo UNO R3 Project The Most Complete Ultimate Starter Kit". Would that be enough? How about heat etc?

    Youtube would give you a better answer than I ever could.
    There's a ton of videos there.


  • Registered Users Posts: 9,605 ✭✭✭gctest50


    A few opto-isolators and something to protect the "car" side of them from overvolts etc



    Car 12 volty stuff is fairly horrible at times


  • Closed Accounts Posts: 3,478 ✭✭✭eeguy


    gctest50 wrote: »
    A few opto-isolators

    For analog? As per the thread title?


  • Advertisement
  • Registered Users Posts: 390 ✭✭spr1nt3r


    eeguy wrote: »
    For analog? As per the thread title?

    Did I write it wrong? I take it when I press on brakes and current is sent it is analogue isn't it? Or did I make it completely wrong and it is digital because it's either on or off?


  • Registered Users Posts: 9,605 ✭✭✭gctest50


    Depends what you want to do

    - if you just want to sense if there is power getting to the bulb it'll be digital ( on/off stuff )


  • Registered Users Posts: 390 ✭✭spr1nt3r


    gctest50 wrote: »
    Depends what you want to do

    - if you just want to sense if there is power getting to the bulb it'll be digital ( on/off stuff )

    Thanks for clarifying it. Analogue I take it when I need to 'measure' intensity of the signal - voltage, low or high and in between, right?

    I have since checked Youtube for optoisolator. Very neat device even though I don't understand it very well. Could I buy one somewhere in Dublin tomorrow? Ideally somewhere in South or Cental Dublin.


  • Registered Users Posts: 9,605 ✭✭✭gctest50


    Anyone should have them, not expensive

    maplin , rs , farnell


  • Registered Users Posts: 390 ✭✭spr1nt3r


    gctest50 wrote: »
    Anyone should have them, not expensive

    maplin , rs , farnell

    Thanks, I'll Google them out. Anything I should be aware of by using these optoisolators? Is there a specific one I should go for?


  • Advertisement
  • Registered Users Posts: 9,605 ✭✭✭gctest50


    the usual - low voltage one, high voltage ones, CTR , package :)


  • Closed Accounts Posts: 3,478 ✭✭✭eeguy


    spr1nt3r wrote: »
    Thanks for clarifying it. Analogue I take it when I need to 'measure' intensity of the signal - voltage, low or high and in between, right?

    I have since checked Youtube for optoisolator. Very neat device even though I don't understand it very well. Could I buy one somewhere in Dublin tomorrow? Ideally somewhere in South or Cental Dublin.

    OK voltage divider will work.

    Essentially it divides the voltage according to the ratio of resistors used. You can google voltage divider calculators to get the right resistor values.

    Ideally you'd like to limit the current to less than 20mA, which I think is the max of the arduino input.

    Optoisolator would be the second option. This is a little module that uses an LED and a light dependent transistor. So the 12V signal fron the indicator lights the LED and the light switches the transistor.

    A third would be a 12V relay. The 12v signal triggers the relay and which switches 5V to the arduino input.

    Estmx on adverts.ie is based in Santry and has a TON of arduino stuff. Not much more expensive than what you'd find on Chinese websites. Definitely worth a look.

    http://www.adverts.ie/7747398


  • Registered Users Posts: 9,605 ✭✭✭gctest50


    And don't connect any of this to a car you are driving on the road

    If it goes wrong it may prevent the brake lights or indicator from turning on and kill someone


  • Registered Users Posts: 390 ✭✭spr1nt3r


    eeguy wrote: »
    OK voltage divider will work.

    Essentially it divides the voltage according to the ratio of resistors used. You can google voltage divider calculators to get the right resistor values.

    Ideally you'd like to limit the current to less than 20mA, which I think is the max of the arduino input.

    Optoisolator would be the second option. This is a little module that uses an LED and a light dependent transistor. So the 12V signal fron the indicator lights the LED and the light switches the transistor.

    A third would be a 12V relay. The 12v signal triggers the relay and which switches 5V to the arduino input.

    Estmx on adverts.ie is based in Santry and has a TON of arduino stuff. Not much more expensive than what you'd find on Chinese websites. Definitely worth a look.

    http://www.adverts.ie/7747398

    Thanks a lot for detail reply. I'll have a look. I do have one of these relays that I ordered in case I wanted Arduino to control the lights, need to check, maybe I can use them in reverse.

    As for my actual project I want Arduino to sense brake bulb being on by connecting it to existing brake wire and do (haven't decided but will involve LEDs) X.

    This lad on Adverts is a legend. A bit far but if I get few items together might be worth it. Thanks.


  • Posts: 5,238 ✭✭✭ [Deleted User]


    gctest50 wrote: »
    If it goes wrong it may prevent the brake lights or indicator from turning on and kill someone

    :confused:

    How do you reckon that's possible GC?


  • Registered Users Posts: 390 ✭✭spr1nt3r


    :confused:

    How do you reckon that's possible GC?

    If I mess something up eg. short or simply not provide signal back to lights if connected in line. It's a valid point, I'm only a newbie, things can go wrong and I would not necessary know immediately.


  • Posts: 5,238 ✭✭✭ [Deleted User]


    Test the circuit before you sign off. If you short it the fuse will go.
    Sorry responses like don't do it you might die just withers my tullips. No offence GC, your input on many a matter is helpful.

    I'd run a new fused power feed from a car USB port (10.5v > 16v in -> 5v regulated out; €2) to power the arduino and use a clip over hall sensor on the stock wiring to register current.

    You may run into problems piggy-backing multiplexed lines if that's what they are.
    Wherever possible I try to avoid splicing stock circuits a lot of the time that means making jump looms like this.

    Temp%20Gauge%20Splice_zps4vy5bsjb.jpg

    It's an adapter for dash voltmeter taking power off the temp gauge (brown = red, blue = black, my motor my rules I'd get proper colour coded cable for anyone else...fight11.gif)

    You might be able to use the switch on the brake pedal to trigger transistors depending on it's topography.


  • Registered Users Posts: 390 ✭✭spr1nt3r


    Thanks for detail info. Where did you get cables for your auto if you don't mind me asking? There is electrical supplier in Ballymount but I think he only does household stuff. I saw somewhere 14awg or better wire is recommended. Think it's 2mm here in Europland?


  • Posts: 5,238 ✭✭✭ [Deleted User]


    Auto-electrical suppliers. DSL in Finglas are ok but I've never asked them for any hard to get items so not sure where the limits of their stock lie. Asked them for 10 blade fuses once and he gave me 100 because it was cheaper.

    You're looking for thin wall automotive cable. I get it in the Uk cos that's one of my bases and I've a place up the road gives me trade discount.

    Demense in Tallaght have a serious collection of copper round back, where I get my 95mm² but it's industrial so phase colours...adding the price of heat-shrink is a bittova kicker.

    Stay away from local domestic places they just lead you up the garden path with NYMJ tripe and light duty alternating current switchgear.

    Stranded flex for automotive always. Direct current components for direct current applications.


  • Registered Users Posts: 3,866 ✭✭✭ozmo


    The 12V in the car is normally over 14V - but can spike which could crash or burn out an arduino - the usual safe way would be to use a relay, solid state relay or some kind of optoisolator as mentioned - this totally isolates it - you may need to debounce the signals from an mechanical relay.

    But what about maybe using something that can monitor the signals without taping into or cutting the wire -

    Possibly something like this maybe?
    http://www.mlabo.com/mcs_md_series_en.html
    It can detect when DC current is flowing in the wire.

    Or - what about a Light Sensor - since you seem to want to monitor light bulbs? They are cheap and easily found. https://en.wikipedia.org/wiki/Photoresistor

    “Roll it back”



  • Advertisement
  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 91,566 Mod ✭✭✭✭Capt'n Midnight


    To get 5V just get a pound shop car USB adaptor, they generally work up to 24V

    To check if indicators are working, use your hazards, takes a few seconds.

    For brake lights check your rear view mirror when backed up to a white wall or low window or glass door.



    In theory you could measure current through wire, lots of old electronic "make work" projects did this. One novel way was to measure the difference between both wires, so you'd detect if one bulb went.



    Anyway it might be quicker and cheaper to replace the incandescent bulbs with LED ones which are far less likely to blow.

    checking the bulbs manually vs. designing a system to do it ?
    https://xkcd.com/1319/

    you could use a Hall effect sensor to measure current, or other current sensors - but remember if you change to LED then they will draw less current.


  • Closed Accounts Posts: 6,869 ✭✭✭PeterTheNinth


    gctest50 wrote: »
    And don't connect any of this to a car you are driving on the road. If it goes wrong it may prevent the brake lights or indicator from turning on and kill someone

    Yeah I would take this approach as well. If you say you are not very comfortable with electronics, then I would opt for an approach that is as "hands off" with regard to the car's own electronics as possible. And remember you do have to get it through the NCT some time in the future as well. If they see that you've been altering the manufacturers own circuits, they may not be happy to sign off on it.

    I did a few bits on my own car, but I always take the approach that if there is even a small change that what I'm doing could disable the car, then I do something else.


  • Posts: 5,238 ✭✭✭ [Deleted User]


    I delete headlights left on, keys in ignition and no seat-belt alarms with prejudice.
    Gawd-awful annoying things in many more suituations than they are helpful imo.

    Good hackers augment and make their modifications reversible. Meaning instead of compromising existing circuits lay new ones beside it and follow the course of lowest impact where interaction is necessary.


  • Registered Users Posts: 390 ✭✭spr1nt3r


    Big thanks to everyone. Optocoupler / optoisolator seems like a way to go.

    I do have one question though, I have 12V in and 5V out required. Where eg. Sharp PC817 has up to 6V in and 80V out. I need the reverse don't I? Since I want to monitor 12V rail rather than the other way round.


  • Closed Accounts Posts: 3,478 ✭✭✭eeguy


    spr1nt3r wrote: »
    Big thanks to everyone. Optocoupler / optoisolator seems like a way to go.

    I do have one question though, I have 12V in and 5V out required. Where eg. Sharp PC817 has up to 6V in and 80V out. I need the reverse don't I? Since I want to monitor 12V rail rather than the other way round.

    You need a buck converter.

    https://tinyurl.com/yacw7bfo


  • Registered Users Posts: 390 ✭✭spr1nt3r


    eeguy wrote: »
    You need a buck converter.

    https://tinyurl.com/yacw7bfo

    Not trying to be smart or anything but why buck converter? I just need to know when the signal is passing through a cable. Optoisolator seems like a safe and sound thing to do.
    The only worry (and lack of understanding) I have is that most of them seems to be listed as high voltage out, low voltage in. Which is pretty much what I'd use relay for that I already have. But I need to monitor the signal not to control it.


  • Closed Accounts Posts: 3,478 ✭✭✭eeguy


    spr1nt3r wrote: »
    Not trying to be smart or anything but why buck converter? I just need to know when the signal is passing through a cable. Optoisolator seems like a safe and sound thing to do.
    The only worry (and lack of understanding) I have is that most of them seems to be listed as high voltage out, low voltage in. Which is pretty much what I'd use relay for that I already have. But I need to monitor the signal not to control it.

    Oh right, I thought you needed to power something from the 12V battery, like the arduino.
    A buck converter is a switching power supply that's used to efficiently step a high DC voltage down to lower voltage. It would be used for example in a car phone charger that's plugged into the cigarrette lighter.


  • Registered Users Posts: 390 ✭✭spr1nt3r


    eeguy wrote: »
    Oh right, I thought you needed to power something from the 12V battery, like the arduino.
    A buck converter is a switching power supply that's used to efficiently step a high DC voltage down to lower voltage. It would be used for example in a car phone charger that's plugged into the cigarrette lighter.

    Got that. I will more than likely use one to power the Arduino. Still need to use something like optocoupler for connecting the two...


  • Registered Users Posts: 390 ✭✭spr1nt3r


    Me thinks I got to the bottom of this:
    http://playground.arduino.cc/uploads/Learning/Level_shifting_4_arduino.pdf

    Me still not understands how the hell they are connecting optocoupler to 12V that's supposed to be 3V rated...


  • Advertisement
  • Closed Accounts Posts: 3,478 ✭✭✭eeguy


    spr1nt3r wrote: »
    Me thinks I got to the bottom of this:
    http://playground.arduino.cc/uploads/Learning/Level_shifting_4_arduino.pdf

    Me still not understands how the hell they are connecting optocoupler to 12V that's supposed to be 3V rated...

    They're dropping the voltage across the resistor.
    See the first note on increasing the resistance value for higher voltages.

    If you look at any beginner LED project they usually have a 2-300 ohm resistor in series with the LED when powering from a 5V supply.


Advertisement