some update : i have dicided that i will use gps for speed.
but as for the rpm. oldspark i dont really get what you are saying :D could you try it simplier, cause it seems i am bit noob ? :)
i have found out that the car uses hall effect sensor, witch indeed gives ground or not. but, how could i read that from an external source?
That then is your input.
It is either GND, else (probably) +5V or +12V when "open" and being pulled up by whatever it connects to (an ECU or ignitor).
Hence sample it thru a resistor (maybe 1k?) and a reverse-biased diode to the Arduino's +ve supply (+5V) to prevent voltages exceeding +5V (plus the diode drop => ~5.6V) to a suitable Arduino input.
It hence pulses between 0V (GND) and +5V.
dude. thank you SO much. i would have never thougt that, when it was not GND, it would be 12v. but it turns it is!! so yes, just a voltage divider and its good to go ;) i will post the final results when i am done!
As long as you realise (and I think you do) that the diode is reverse biased - it only conducts if the (input) voltage goes higher than the Arduino's onboard +V, hence not blowing the Arduino inputs.
If the diode were the other way, it would be supplying Arduino +V to the sensor (Hall effect sensor) which could blow it, though the series resistor would limit current (and in this case with say 1k or higher, NOT blow the sensor).
It is not a voltage divider, though that could be used instead, but even then the diode could be added for protection.
Reverse diodes to both power rails (+ve & -ve) are often used to protect inputs. Many digital chips use that method (aka voltage clamping??). (And most digital chips have specifications that inputs tolerate Vcc +0.6V and Vdd -0.6V - ie, their +ve supply and -ve supply each extended by a diode;s voltage drop.)
But 2 else 1 reverse biased diodes are often added to circuits that have inputs from other circuits or supplies, or with other voltages or noise (spikes etc). (EG - they are essential for inputs taken from coils (inductors) such as relays or Ignition Coils (points, ignitors) etc.)
An alternative is to use a Zener diode of a suitable voltage. (They conduct like a diode in the normal direction, but "break down" and conduct in their reverse direction when the voltage exceeds their breakdown voltage.) For example, if the voltage needs to be limited to 5V, then through a resistor to a reverse biased to GND 4.7V Zener. That limits the voltage to ~4.7V, and also to above "GND -0.6V". That's essentially a Zener-type voltage regulator which is a popular method for powering low current loads. (Low current because otherwise a high Wattage resistor and Zener are required.)
I suggested the protection diode because then the +ve voltage that the Hall effect sensor output goes to is irrelevant (ie, 3.3V, 5V, 12V, 14.4V). The diode clamps it to no more than the Arduino supply (plus the diode's voltage drop of ~0.6V) and the resistor limits the current to what the diode can handle (but supply enough current to drive the (Arduino) input).
If you know the pull up voltage of that sensor, then you could use a voltage divider instead. You could still add the diode(s) for noise or extra protection, and you would if that sensor was triggering a coil (but it isn't).
The voltage divider is probably best... What if the diode fails in open circuit mode? Nothing then limits the input voltage....
My only other comment refers to "open collector" outputs. Your Hall effect sensor is almost certainly a Hall effect module (eg HKZ101) as opposed to a "raw" Hall effect sensor.
Such sensors are usually "open collector output" meaning that their output is a grounded transistor which is either GND when on, or floating when off. It's no different than ignition points on older cars etc - it is only their "load" that pulls them up to whatever voltage.
OC (Open Collector) switching is used on CPUs and many digital chips.
The advantage of OC type outputs is that you can interconnect various circuitry irrespective of their supply voltages. EG - a 5V CPU can use a 3.3V memory, or a 12V ECU can signal a 5V Arduino - only their GNDs need be common.
Another advantage is that you can connect them all together for an "OR" type function - eg, when CPU output OR Hall output OR manual kill switch is ON (=GND) - you don't need diodes to isolate the different outputs to prevent possibly damaging backfeed if they were +V outputs.
Damn - another 101 ramble.
well. after all it will take some time until its done, because i have decided i will implement, as many things from the car as i can! actally, if u hook up, 12v relays, in your instrument cluster light indicators, then you can give them to arduino as normal switches!
Yes, that is one way, and in some ways is simple because a relay coil is easy to power from dash lights (provided they are not dimmed) and there is no problem with voltages - ie, the relay contacts can be connected to the Arduino as a normal switch.
On the other hand, it does require the relay, and why not use a voltage divider instead? Hence have an Arduino analog input read (say) if <1V, then lights are off, and if >3V they are on.
Also, if the dash lights are dimmed, the relay will have problems. Hence run the relay from the light switch (before the dimmer), or again, use the analog input.
If it's a digital aka PWM dimmer as used on most modern cars or cars with LEDs, then through a diode to an RC network should provide the normal +12V (or 5V or 3.3V etc) when the lamps are on - even if dimmed.
If it's an analog dimmer - whether transistorised or an old type rheostat aka (high power) variable resistor - then probably the analog input needs to be used, and the voltage levels experimented with.
Final "answers" depend on what you want to measure or use, and how many Arduino inputs are available.
I usually have a list of desired inputs, and the match them to suitable or available inputs.
And there are ways of multiplexing inputs to use a single Arduino pin or input. EG - why waste 3 inputs for 3 switches? Why not have the switches go through different resistors so the Arduino senses different voltages depending on which switches are on? But that is an option if you don't have enough inputs, or that you can do later if you add other inputs and run short).
i totally agree that a voltage divider would be the best way. but the problem is that i am afraid that my board will become to big, and i will get lost!! (don't forget that its my first project). so i try to keep it easy! as for the dimmer, in my case, the instrument panel is so f!@# up that you should wish that the lights get a voltage at all :P (they take constant 12 v ;) )
You really should be getting a shop manual to make sure you have the right ranges on your sensors. You will save yourself A LOT of time if you do that.
And as for something taking up board room...
Voltage dividing in majority of cases is a simple two resistors. I kind of glazed over Oldsparks information but even with the protection he mentions you still have a very small footprint per sensor. If you REALLY want a small footprint then you can build your own board and use surface mount components and have every sensor you can think of added to a board less than 3" x 3".
Otherwise simple perf boards are cheap and you already said your dash is trashed.
Relays are NOT a good way to go.. For the reasons Oldspark mentioned plus relays tend to have a slight delay regardless of the type. And most relays have a mechanical clicking as well. Do you really want multiple clicks when your lights are flashing? Plus I haven't come across a relay yet that is anywhere near the size of 2 resistors... Not to mention Relays are mechanical devices and wear out. With resistors and diodes they are not mechanical so they don't wear out. The only issue with resistors and diodes is to make sure you don't "let the smoke out" other wise they work better in such an application. Also realize that your vehicle does NOT produce 12 volts so your resistor sizes will be different that for 12 volts.
As to letting out the smoke. Since you are using these as sensors and not driving anything you should not have anything to worry about unless you accidentally short out the circuit. (In other words don't solder when you are tired. ;) )
When I say your car is NOT 12V remember that a dead car battery still shows over 12V normally and a normally running vehicle is closer to 14 volts when running. Keeping this in mind you want to make sure your making use of the diodes as Oldspark mentions to regulate anything above the voltage you set them up for. Automobiles have spikes of voltage well above 12 volts while starting and at other times so it is important to protect your circuits. But still, 2 diodes and 2 resistors is still less board space than one relay which you will still need to use at least one resistor with anyhow to properly prepare your input to the aduino. I haven't played with an aduino specifically but any other A/D convertors I have used you have to use a resistor to limit the current through the input otherwise you basically have a direct short through the input.
The voltage divider also makes sense for another reason over a relay. If you use a relay you need a double throw type relay. One being to the voltage you are passing to the Aduino and the other to ground. Reason being is that the input to the Aduino will read the +voltage when the relay contacts fine but when there is no connection most multipurpose I/O ports will "float" and see random results and you could have a false reading. If it is grounded when inactive the I/O port will have a valid reading. When using a voltage divider you are always providing a path to ground so it should never float.
I should note that some boards setup for inputs may have additional electronics incorporated that allow you to directly short the pins and may also protect against a floating "open" contact but boards that allow you to use any I/O pin as either an input or an output may not have anything added to them to provide flexibility. But using the resistors with the diode protection that old spark mentioned is your best solution for many reasons.
(God, I think this is the first thread I have been in full agreement with oldspark on something.. ;) )
You mean you still haven't figured out the error else misunderstanding of what your instructors said about charging parallel batteries? They are wrong if that is what they taught - noting that using a failed/collapsed battery can add credence, but we are talking about normal mismatched batteries etc, not incompetent set ups that include stuffed batteries (which for AGMs in particular is a safety and explosion issue).
The relay for the Arduino needs only be single pole. It's used as a (floating) switch - it merely connects 2 pins on the Arduino. It does not connect vehicle voltages. If it did, you'd need the voltage divider etc and omit the relay entirely (unless the relay was used to gate (switch) the signal only at certain times as determined by some other circuit).
As to Arduino space, IMO all these input interfaces should be on external boards.
Resistive dividers etc could be placed at the source tap point (eg, dash or light switch) though my suggestion is to take the source wire to a central board with the resistors etc. That board can be more easily changed for different resistors or updated circuits (caps etc) should the need arise.
Plus IMO the diode protection should be at the Arduino end to snub any induced noise on the source wires. Same for the RC filters.
But I agree with settra about keeping it simple. (But as to a relay being simpler than a mere voltage divider plus reverse-biased protection diode? Software and calculation-wise maybe, but physical hardware and wiring wise... (IMO no.).)
But that's the beauty of these projects - it can be done one step or circuit at a time, at least in terms of checking initial performance (ie, set suitable break points or check loops). (It is also the recommended procedure for any design - especially software. But a few (like me LOL) might program the lot and THEN deal with problems if they occur...)
Hence interfacing thru other board(s) rather than on the motherboard or precious shields etc. And on "centralised" boards rather than scattered at sources behind gauges or in engine bays etc. Apart from the filtering and protection close to the Arduino end, it makes for easier component changes and additions as well as easier removal or transference to other vehicles.
Certainly IMO all initial interface circuitry should be considered prototype and disposable until final performance is confirmed. Even when certain interfaces work, it is common to later realise a better method, or need to change to accommodate new or unforeseen additions. And by prototype I mean "anything that achieves the desire" - ie, not specially design PCBs etc, but often "flying bird's nests" etc.
[ FYI - it's amazing how many "prototypes" survive in my vehicles - whether alligator leads/clips to temporarily connect washer bottles, or "air soldered" ICs with resistors etc (ie, bird's nests). But that's another story... ]
The one thing I reckon I can guarantee with uPC type projects like this (apart from bugs etc) is that as your uPC and other systems and electrical/hardware knowledge increases, you will hit on far superior or more elegant ways of doing things. That's even for a "stable" design where you don't want to add new interfaces or functions.
Hence don't put excessive time or effort or cost into initial perfection. Treat it more like a quality circle - an emphasis on initial planning and thought, but then iterative improvements, changes and additions to the final (or prototype) product.
BTW redheadedrod - I thought we generally did agree on things. Sometimes we may correct each other on details, but the general thrust we agree on. The parallel batteries whilst charging is the only exception that comes to mind, but you are incorrect about that. As I say, either there is a misinterpretation of what was demonstrated, or it was an exceptional example, or your instructors were wrong. (I challenge them or whoever to restate what was demonstrated and its conclusions.)
Going to leave sleeping dogs lie for the most part... And we will disagree about charging Parallel Batteries because I have seen demonstrations and have seen things with my own eyes that prove your ideas wrong. But beyond that we do seem to agree on most things. Beyond this I won't comment more.
Originally Posted by OldSpark
I do hope the starter of this thread can see the importance of getting a shop manual for his vehicle. Will save a lot of time and possible broken hardware.
This looks like a manual that could help out.. And it took me literally 30 seconds to find this book...
This likely would have everything you need in it and save you hours of troubleshooting.