Can somebody explain to me in childslanguage why the 74HC595 in a lot of tuto's is presented as THE way for controlling multiple leds while it cant even provide enough power for 8 leds?
I tried to understand the topics I read but for now it is still foreign for me.
Also, I read that someone used a capacitor to make the HC work but I did not understand why?
Lastly, can I use the 74HC as digital input multiplexer? To read out 8 digital sensors?
74hc595 are cheap and readily available. It can provide enough current for 8 LEDs. Not the 20mA maximum most LEDs can handle, but 5mA is enough for modern high brightness LEDs to be seen even in bright conditions.
If you want to drive a matrix of LEDs, then you may need to use that maximum led current, because the multiplexing means each led will only be on for a fraction of the time. This is where 74hc595's limitations become a problem.
All chips should always be accompanied by a decoupling capacitor. Normally 0.1uF ceramic type is best and should be physically as close to the chip's power pins as you reasonably can. Without it, the chip may misbehave or cause other parts of the circuit to misbehave.
Reading 8 "digital sensors" with 74hc595? The answer depends entirely on the sensor. What do you have in mind?
Led displays are often wired as a matrix internally. Post a link to the displays you want to use and we can advise. Max7219 is often a suitable driver. Or ht16k33.
So from VCC to ground (Capacitor)? I remember there is an error in the tutorial here on arduino.cc?
Correct. Yes, there is a famous error where a cap is shown between the Arduino and the clock, data or latch lines, so don't do that.
This is how you post a link on this forum:
The forum does not automatically parse web addresses into links, but it's only one extra click.
It might be possible to multiplex 8 of those sensors using a 74hc595 and some clever circuit, I can't immediately think how. 74hc165 would be a more obvious choice.
PaulRB:
All chips should always be accompanied by a decoupling capacitor. Normally 0.1uF ceramic type is best and should be physically as close to the chip's power pins as you reasonably can. Without it, the chip may misbehave or cause other parts of the circuit to misbehave.
I only have a bunch of these right now, will that work as well?
Sareno:
I have 7 sensors (3144 Hall Effect Sensor - 3144HALL) that I need to read to get the RPM from 7 shafts. 7 pins of the arduino is a bit too much!
Hall effect sensors measuring shaft rotation is not a good application for a multiplexer, because the sensors generally are going to be outputting a very short pulse, and the arduino needs to respond to that while it is still active. You would probably want to connect the sensors directly to the arduino inputs, and then have an interrupt service routine (ISR) that responds whenever the input levels on any of those pins changes (a pin-change interrupt). Might be possible to get away with the multiplexing if the shafts were rotating very slowly, or you only wanted to measure one shaft at a time.
david_2018:
Hall effect sensors measuring shaft rotation is not a good application for a multiplexer, because the sensors generally are going to be outputting a very short pulse, and the arduino needs to respond to that while it is still active. You would probably want to connect the sensors directly to the arduino inputs, and then have an interrupt service routine (ISR) that responds whenever the input levels on any of those pins changes (a pin-change interrupt). Might be possible to get away with the multiplexing if the shafts were rotating very slowly, or you only wanted to measure one shaft at a time.
That might be a challenge, the UNO only has 2 interrupt pins, I need 7.
Maybe I should add a Arduino Micro that has 20 digital pins for reading the hall's and writing SD. Would that be powerfull enough? Maybe I can also control the lights with the micro so I have the first arduino for GPS/Gyro etc.
It may not be a problem to multiplex the inputs, it depends on how frequent you need to update the RPM and with what precision.
You can measure the period time and then calculate the RPM, this means you can measure each RPM input in less than two revolutions or use a few more revolutions for better precision.
I cannot remember if it is directly supported by the timers, but it can be done this way:
Setup a edge interrupt when input goes low or high, but only one of them.
Select input
Set start flag
When interrupted save micros() value, set count to 1 (or more)
On next interrupt, decrement count, if count == 0 save time from first micros and set done flags
When done is detected, the main routine can calculate RPM and continue from 2
You need to control start and done flags a bit more than I explained above.
Sareno:
Can anyone please respond to my CAP question a bit earlier? Will those work as well?
No one answered that because the question didn't make sense. Did you intend to attach something, a picture or a link, to that post? We don't know what you mean by "these" or "those".
PaulRB:
No one answered that because the question didn't make sense. Did you intend to attach something, a picture or a link, to that post? We don't know what you mean by "these" or "those".
Huh? Strange, I am very sure that I did the link thing... Sorry..
Right kind of cap. Wrong value. Maybe if you put 5 in parallel for each chip, that would be ok for now. But order some 0.1uF = 100nF, they cost pennies.
PaulRB:
Right kind of cap. Wrong value. Maybe if you put 5 in parallel for each chip, that would be ok for now. But order some 0.1uF = 100nF, they cost pennies.
Too bad. It is not about the cost, it is about the fact the shop is closed now
Sareno:
Too bad. It is not about the cost, it is about the fact the shop is closed now
Well, you will just have to wait, will you not?
Some things - such as decoupling capacitors - are important.
If the Hall encoders are generating only one pulse per rotation, you probably do not need to use interrupts in any case. If you put all seven on the same "port" on the Arduino, they can be read as a single byte operation in your polling and processed accordingly.