I have a problem with my arduino aplications. I control PCF8474 8 bit I/O expander using Arduino UNO with I2C serial comunication. I have connected 8 reed relays on my I/O expander.
The problem is that everytime Arduino is turned on or it is reset, all reed relays turn on, beacouse whey we reset arduino all the digital outputs go HIGH.
Does anybody have an idea how to solve this problem? I would like to get application when I turn on Arduino, any of relays does not turn on.
When Arduino is turned on or reset, the outputs go HIGH for half a second, and then go to ''normally'' LOW. I want to solve that when I reset arduino outputs do not go HIGH for half second, but stay always LOW when you reset it.
I dont need to show my schematic for this, the problem is clear.
And in contrast, I did explain the problem properly. It is indeed abundantly clear.
Due to the way the PCF8574 8 bit I/O expander works, its outputs are active LOW, so you need to wire your reed relays from its outputs to the 5 V supply.
Then as it starts up, the relays will not be actuated.
Whether or not you show your schematic is up to you, but that is the solution.
7.3 Quasi-bidirectional I/Os
A quasi-bidirectional I/O can be used as an input or output
without the use of a control signal for data direction
(see Fig.15). At power-on the I/Os are HIGH. In this mode
only a current source to VDD is active. An additional strong
pull-up to VDD allows fast rising edges into heavily loaded
outputs. These devices turn on when an output is written
HIGH, and are switched off by the negative edge of SCL.
The I/Os should be HIGH before being used as inputs.
Perhaps you should make a habit of reading datasheets when you want to use mysterious electronic devices that you clearly do not understand.
When Arduino is turned on or reset, the outputs go HIGH for half a second, and then go to ''normally'' LOW.
The Arduino outputs themselves will "float" during a power cycle (except for pins 0, 1, and 13.)
But you're talking about the outputs of the IO expander? I don't think there's anything you can do on the arduino side about those...
codlink:
I love when people come here asking for help, but then state that their code and/or circuit is top secret. It makes me laugh out loud.
S/he is a newbie, not one of our long-term members. Now, it would be really funny if I were to ask that question (and painfully embarrassing, too.) The hard part is to convience a person to provide the circuit and the full sketch. In post #2, Andraz23 respond with an attitude.
@Andrez23: the yellow "stars" under the alvatar means this individual has been around for a long time and the more stars, the more interactions they have had. Paul__B is a great resource and he will not ask twice for what should have been provided the first time: How to use this forum - please read
Frankly, the circuit is quite irrelevant in knowing what the problem is, since we completely know the behaviour of the PCF8574 8 bit I/O expander.
It would nevertheless be rather practical if he wishes to rewire it so it operates correctly, to show his present circuit in order for us to advise the best way to do this. The fact that he got it so badly wrong in the first place would seem to suggest that he could use some assistance, wouldn't you think?
mrburnette:
...the yellow "stars" under the alvatar means this individual has been around for a long time and the more stars, the more interactions they have had.
I've never even noticed those before. I see I have one. How are they determined?
Ok, thanks Paul_B and everyone for all answers and advices.
Sorry to those who my posts are being stupid or I don't know whatever. I'm just completely beginner in this stuff so please understand why my stupid questions...
so here is my schematic of application ...
This is how arduino is connected to PCF8574 8 bit I/O expander:
So the idea of whole application: When Arduino tells I/O expanders to produce 5V control signals for MOSFETS on their outputs, MOSFETS turn on and the current flows from external 9V battery supply trough reed relay (so relay turns on), resistor, LED diode and mosfet to the ground.
So problem is that everytime I turn on Arduino all relays turn on, so now I will try to rewire my application like Paul_B is telling me. But I don't exactly know how I will do that...
If you wish to use the PCF8574 for this purpose, you need to invert the data pins between it and the FETs with something such as the gates in a 74HC14.
It would be much easier to use TPIC6B595s to drive the reed relays directly (as this IC contains the FETs as well as the "kickback" diodes missing from your schematic), using the SPI (hardware or software) interface instead of the I2C. You can chain a reasonable number (up to about ten) of these on the same three Arduino pins.
As it is, why do you show resistors in series with your reed relays and what voltage/ resistance specification are the coils?
If you wish to use the PCF8574 for this purpose, you need to invert the data pins between it and the FETs with something such as the gates in a 74HC14.
It would be much easier to use TPIC6B595s to drive the reed relays directly (as this IC contains the FETs as well as the "kickback" diodes missing from your schematic), using the SPI (hardware or software) interface instead of the I2C. You can chain a reasonable number (up to about ten) of these on the same three Arduino pins.
As it is, why do you show resistors in series with your reed relays and what voltage/ resistance specification are the coils?
Paul__B, I really appreciate your advices, tnx very much.
So the ''kickback'' voltage when mosfets turn off was about 250 V and I already solved that by adding diodes that I wired back to external 9-12 V source source at coil like you can se at picture bellow:
So what I wanna do with this application: If you look at picture above, I wanna control reed relays using microcontroler Arduino. I HAVE TO CONTROL 24 REED RELAYS. (at the picture above there are only 4). The relays turn on when there is a 5 V voltage at the coil. The coils have 500 ohm resistance and 10 mA current. So I added 220 ohm resistance in serial with 500 ohm coil and FETs resistance R_DSon=30 ohm and I got voltage divider like at picture below:
Beacouse Arduino doesn't have enought outputs to control 24 Mosfets, I am using 3 8-bit I/O expanders that comunicate with arduino using I2C. They have 5 V outputs and they are connected to mosfets gates.
Paul__B, I think that I cannot use TPIC6B595 with SPI becouse I need at last 24 outputs. Do you have any idea, how could I control 24 relays with arduino? The application must work with 9-12 V (battery of other external source.
This TPIC6B595 shift registers looks very interesting for solving my problem! Since I don't know a lot of shift registers I would study how they works and try to use them in my application.
Tnx very much, and thanks for all your advices in the future
Andraz23:
This TPIC6B595 shift registers looks very interesting for solving my problem! Since I don't know a lot of shift registers I would study how they works and try to use them in my application.