For my Smokedetector Project I need a special advice:
I have private smokedetectors, operated with a 9V battery. The smokedetectors are connected together with a 2-wire cable.
If one detector detects smoke it is putting a signal (up to ~8 Volt) to the cable. All other detectors are detecting the signal and sending an audio alarm.
I want to detect this signal with my arduino. As the input is only designed for 5 Volt I need to convert this signal down to 5 Volt.
From my understanding I can do this with 2 different systems:
Voltage Devider: Here I am not sure how to calculate, as the signal isnt a static 8 Volt Signal, it can be also lower, down to 5 Volt.
I2C Logic Converter
I tired to do it with a logic converter http://www.amazon.com/Shanhai-DFRobot-Converter-convert-converter/dp/B00HFVOKRG
Unfortunatley it is now working as expected. If I but a 5 to 9 Volt Signal on the second side of the converter I get 5 Volt on the primary side. This is ok. But if the signal on the secondary side is 0V (open line) , then I get 2 to 3 Volt on the secondry side.
How did I connect the Converter:
Vext2 to 5V
GND and SCL to GND
SDA to digital input
Vext1 and SDA to the first line of the smoke detector
GND and SCL to the other line of the smoke detector
Either I am doing something wrong or I need a different approach...
A resistor and zener diode is probably the simplest approach. 10k resistor and 4V7
zener as a voltage divider - this will read HIGH if the input is above about 3V and
LOW if it is < 1.5V
You need to check the low voltage is that low.
A voltage divider works fine. You just have to detect the voltage only once. You should calculate the divider to give max 5V out for 9V in. 47k + 56k will do fine
Alternatively use a 3v9 zener and a 10k resistor. Connect cathode of zener onto line you wish to detect with anode connected to the 10k and the free end of the 10k connected to the common ground of detectors and arduino. Input to arduino is at junction of zener and 10k. Zener will only conduct when there is > 4 volts applied to its cathode and it will hence "cut" 3.9 volts from the voltage detected, so giving a nominal 5 volts at the arduino input.
A logic level converter is not the way to do it. However:-
But if the signal on the secondary side is 0V (open line) , then I get 2 to 3 Volt on the secondry side.
You seem to be equating an open circuit with 0V, they are not the same thing. An open circuit is called a floating line a 0V signal is one where current can sink back into the ground. So what you see is what might be expected.
The real safe way to do this would be to use an opto isolator. Then have the high voltage side drive the LED through a suitable resistor, then have the emitter of the output connected to the ground and the collector to the input pin. Then enable the pull up resistors on that pin. Here a floating input to the opto's LED will look like a logic zero to the Arduino.
Thanks for the feedback, I will try first with the voltage divider.
Another question: The smokedetectors doenst care if it is +8 or -8 Volt, so you can connect the 2-wire however you want. If I use now the ditital Input, I have to take care about the polarity, so I have to check all Smoke Detectors, if they are cabled the same way (polarity).
Is there any easy way to change -8 Volt to +8 Volt, so that I do not have to take care about the polarity on the Smoke Detector side?
Use a bridge rectifier. Negative output of bridge to ground on arduino and positive output to your voltage divider/opto isolator or whatever. You can get opto units that don't care about polarity (AC sense input) so this would be the most secure way to go