Do you use one resistor for both LEDs ?Un4Seen wrote:if I try to simulate an opening signal on both inputs at the same time, the LEDs are very dim, if I only simulate one opening signal, the appropriate LED (connected to 5V through a 740R resistor) is bright enough.
No.Un4Seen wrote:A scary thought has crossed my mind... When you connect something to the Pi's programmable GPIO pins (like an LED), you do it through a resistor, which protects the Pi's GPIO pin against too large currents. Now, if I connect the CD4016BC, shouldn't I add some resistors in series with the Pi's programmable GPIO pins?
This chip (like all other logic chips available on the market today) have very large input resistance already "embedded". They are all voltage-driven.Un4Seen wrote:Won't I fry my Pi pins without the resistors?
One LED is green, the other is red. I use two resistors for driving the LEDs (one resistor for one LED), but I used a common resistor to connect the CD4016BC inputs to 5V in order to simulate the Pi signals.FLYFISH TECHNOLOGIES wrote:Do you use one resistor for both LEDs ?
I suppose I could use a smaller value resistor, but my experiments in the past have shown that modern standard LEDs are quite bright even with 0.5-1 mA of current passing through them and a 740 Ohm resistor should result in 4-5 mA of current in green and red LEDs. I admit, my experiment was with white and blue LEDs...FLYFISH TECHNOLOGIES wrote:Not related to this observation, but 740R is also quite high. Most circuits (including mine) have resistor 470R for 5V supply and 270-330R for 3.3V. These values are for green and red LEDs, where blue and white ones, for example, need even lower values.
Thank the heavens!FLYFISH TECHNOLOGIES wrote:No.
Thank you, again, Ivan! I have learned a lot from you in this thread. That knowledge is even more valuable than the thermostat circuit itself. I am truly grateful.FLYFISH TECHNOLOGIES wrote: This chip (like all other logic chips available on the market today) have very large input resistance already "embedded". They are all voltage-driven.
LEDs are current-driven. Therefore, they suck current which needs to be limited with resistor. For voltage-driven elements, this reisistor is not needed.
Interesting parts are transistors, where you have both types (if classified by this criteria) - some transistors need resistor (bipolar transistors, like NPN or PNP), where some don't (FETs, like MOSFET, IGBT, JFET etc.)...
Yes, for "home use" your values are ok... but I use resistors with lower values anyway...Un4Seen wrote:I suppose I could use a smaller value resistor, but my experiments in the past have shown that modern standard LEDs are quite bright even with 0.5-1 mA of current passing through them and a 740 Ohm resistor should result in 4-5 mA of current in green and red LEDs.
The solution would be to supply also transmitter from mains (= from 3.3V available on RasPi's GPIO). To decrease this voltage a bit to be within battery voltages, you could add one diode (eg. 1N400x; x=1..7) for some voltage drop.Un4Seen wrote:the thermostat circuit will run from batteries, so it will always have power.
You should not experiment it that way... these chips have various internal protection diodes on inputs which then start to conduct and "supply" the chip - these protection diodes are not designed for this purpose and this is a stress for them.Un4Seen wrote:If I disconnect the CD4016BC only from 5V
Nope, you already have pull-downs...Un4Seen wrote:After thinking some more about it, I suspect that the problem is that when the Raspberry Pi loses power, it does not send any signal to the CD4016BC input pins, which means that the inputs of theCD 4016BC will be floating
Hard to tell... you already have pull-downs to control behaviour when RasPi is not running your script, but when voltage is applied also to transmitter at the same time, this is another story...Un4Seen wrote:I do wonder, though what exactly will happen in the exact moments when the power is lost or when the power comes back.
The good news is that this switch chip is only a "dumb chip", without any brains, so it comes into final state very quickly.Un4Seen wrote:Could it happen that because of some internal circuitry the thermostat will go offline a brief moment later compared to the CD4016BC and because of that its buttons will register some pressing?
I didn't write final voltage number. Voltage drop varies also with current, but the battery-powered devices have good tolerances to accept various types of batteries and work well also when batteries voltage drops a bit...[/quote]Un4Seen wrote:You mentioned that the 1N400x diodes drop just enough voltage to get from 3.3V to 3V
Connect CD4016BC to 3.3V and add voltage regulator in the circuit.Un4Seen wrote:I was wondering if there's a solution to drop enough voltage so that I can supply it not form the 3.3V pin but form the 5V pin, because I'm already connected to the 5V pin, so it would be one less wire...
Close to zero when not transmitting and probably around 20-30mA when transmitting... you can measure this, to be sure.Un4Seen wrote:I don't know how much current the thermostat drains from the batteries
Better to use one diode with 3.3V.Un4Seen wrote:I just read somewhere that a regular diode, like the 1N4007 (which I happen to have at home ) drops about 0.65-0.7V. So, connecting 3 of those in series could be used to go from 5V down to 2.9-3.05V, which should be fine. Or I could just use one and connect to the Pi's 3.3V power pin, one extra wire is not the end of the world after all.
I'm not going to repeat myself again... keep wires short.Un4Seen wrote:I'll use a UTP cable between the thermostat's radio transmitter and my circuit.
I agree.Un4Seen wrote:The voltage regulator is a nice addition in the sense that with it I could delay the powering on of the circuit, but I'd rather not complicate things until it proves to be really necessary I'll just take the power form the Pi a few times and see how things behave. If I'm not satisfied, I'll look into the voltage regulator based solution.
This is always a dilemma when there are more approaches possible... It's up to you...Un4Seen wrote:I'm starting to wonder if we're over complicating things... after all, I could use a ULN2003 to drive two low power relays to connect the thermostat's button ends when powered.
Ok, you're welcomed.Un4Seen wrote:Whatever will turn out, I thank you for your most valuable help, Ivan
Place a resistor between these two wires and measure voltage drop on it... then the measured value must be "reasonable".Un4Seen wrote:So I tried to measure the voltage between these two free wires
They cannot cause any influence in this your case.Un4Seen wrote:Could the other components influence the voltage? between the same + and - power pins between which is the diode, there is also a 100 nF capacitor, the CD4016BC and a DS18B20 temperature sensor.
Decrease the resistors which are in series to the switches,Un4Seen wrote:Unfortunately, the system is not perfect. When the Pi "presses" the buttons (connects them via the CD4016BC's output) it behaves a bit randomly, meaning that sometimes one press is registered by the thermostat as one press, other times as two presses and some other times as zero presses.
Bash minimal sleep time is 1 sec, right ?Un4Seen wrote:I have a bash script for repeating the push-release sequence as many times as needed and I use sleep inside it.
A quick dirty hack could be a sheet of A4 card-paper placed between RasPi and the transmitter. It would prevent air flow between two of them.Un4Seen wrote:But I fear that because the Pi is so close to it, when it measures 8 degrees, that might actually be only 4-5 degrees in reality (farther from the Pi).