74HC595 shift register with LEDs bargraph output

For general Flowcode discussion that does not belong in the other sections.
Post Reply
andeug
Posts: 33
http://meble-kuchenne.info.pl
Joined: Thu Jan 07, 2021 1:42 pm
Location: Stockholm (SE)
Has thanked: 12 times
Been thanked: 2 times

74HC595 shift register with LEDs bargraph output

Post by andeug »

Hi,


I am working on a kitchen timer using an Arduino Nano, two 74HC595 shift registers, and 16 LEDs, but I'm having trouble determining which components to use. Would it be possible for someone to create an LED bargraph component, for example, and calculate automatically how many 74HC595 shift registers are needed? The LED bargraph should also have a customizable number of LEDs, and ideally should be made in 2D.

Am I missing anything? Does the existing Flowcode 10 library already have the components I need? LEDs are there, but not the 74HC595 component with individual LEDs (or an LED bargraph).


Andreas

medelec35
Matrix Staff
Posts: 2097
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 650 times
Been thanked: 705 times

Re: 74HC595 shift register with LEDs bargraph output

Post by medelec35 »

Hi Andreas
There is a 2D 7Segment 74HC595 component.
Select the Components ribbon, then then click on Search magnifying glass icon and enter HC595
All you will need to do is use the ShowSegments function.
Then you can control 8 LEDs in bargraph format. That will allow you to have 0, 1 or multiple LED's enabled.
Martin

andeug
Posts: 33
Joined: Thu Jan 07, 2021 1:42 pm
Location: Stockholm (SE)
Has thanked: 12 times
Been thanked: 2 times

Re: 74HC595 shift register with LEDs bargraph output

Post by andeug »

Hi Martin,


I have followed your guidelines regarding ShowSegments and have put together the project, which I've attached.
What I want to do is change the segments between A, B, C, D, E, F, G, and DP with a 1-second delay, to experiment with each LED.
bargraph 16x LED v1.0.fcfx
(11.61 KiB) Downloaded 19 times
The simulation shows that changing only segments A, B, and C, and I am unsure what I am doing wrong. Perhaps I should configure a different syntax in the Macro (and which one is that, for each segment?). Also, when I program the Arduino Nano, I get the same result as in the simulation.

Below is a picture of the development board I created for my project, which utilizes an Arduino Nano. I want to do a kitchen timer with 16x LEDs and time intervals as below:
IMG_0324.jpg
IMG_0324.jpg (195.56 KiB) Viewed 186 times
LED01: 1min
LED02: 2min
LED03: 3min
LED04: 4min
LED05: 5min
LED06: 6min
LED07: 7min
LED08: 8min
LED09: 9min
LED10: 10min
LED11: 15min
LED12: 20min
LED13: 25min
LED14: 30min
LED15: 45min
LED16: 60min

There is a buzzer (not currently mounted on the PCB at this moment) that should indicate when the time has passed.

Do you have any ideas or suggestions on how the main code and Macros should be structured for my timer project, to avoid overcomplicating it?


Andreas

medelec35
Matrix Staff
Posts: 2097
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 650 times
Been thanked: 705 times

Re: 74HC595 shift register with LEDs bargraph output

Post by medelec35 »

Hi Andreas.
I have created a demo for you that within Main counts from 0 to 8 then back down to 0.
It then calls the BarGraph user macro to light the appropriate LED/s
I won't complete your project for you as that it make it more difficult to learn.
A hint is within the BarGraph user macro have a decision branch to light the LED/s of the appropriate display.
Let me know if you need further assistance.
For the timing you can use a Timed interval component.
Attachments
bargraph 16x LED v2.0.fcfx
(12.45 KiB) Downloaded 18 times
Martin

chipfryer27
Valued Contributor
Posts: 1704
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 588 times

Re: 74HC595 shift register with LEDs bargraph output

Post by chipfryer27 »

Hi

You haven't done anything wrong as such, you just forgot that the seven segment display is actually seven individual segments that are addressed. Each segment has a binary value associated with it so you are using 8-bits (0-7). You are counting upwards and the display is correctly representing the binary number.

Sending 0 (is actually 0000 0000) = all off
Sending 1 (0000 0001) = Segment A
Sending 3 (0000 0011) = Segement A and Segment B
Sending 16 (0001 0000) = Segment E

So if you increase your count to 255 you will scroll through all segments.

For your test you may want to create a loop, and in the loop increment a variable, then output the variable.

Regards

EDIT....
Martin beat me to it.......<s>

medelec35
Matrix Staff
Posts: 2097
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 650 times
Been thanked: 705 times

Re: 74HC595 shift register with LEDs bargraph output

Post by medelec35 »

I decided to make it easier for you and add the full 16 LEDs, since I decided there is a better more efficient way than a decision branch.
You should find this easy to integrate your own project.

I have also moved topic from Feature Requests to General since the component already does what you have requested.
Attachments
bargraph 16x LED v2.1.fcfx
(13.17 KiB) Downloaded 19 times
Martin

Post Reply