General Expert Advise needed

Hi All,
This is all new to me, my only programing experience, prior to a few weeks ago was Basic on Commodore 64.

My reason for programing now is more project driven ( i just need to control some LEDs in a model project but have found this interesting, but before i go to fare down the programing rabbit hole.

Can some please advise if it is possible carry out the below tasks all in one sketch or will i need to have multiple sketches and nanos?

i have learned very quickly delay is not your friend.

What I need to accomplish

is as per below

  1. *Section 1

  2. Pin out 0402 Leds

  3. Pin out 0402 Leds

  4. These alternate should cross fade 1 second

  5. Brightness should be quite low 5%

  6. Button A Pin in 3v or lower (resistor to suit)

  7. Button Task

  8. Cross fade increased to .5 sec

  9. Brightness should be 80%

  10. Section 2

  11. WS2812 (bank 1)

  12. Pin out

  13. NUM_LEDS 12

  14. Button B Pin in 3v (task start stop)

  15. Leds 0 & 11 (12) constant separate task

  16. should flash red 0.25s

  17. should flash White 0.25s

  18. Loop

  19. New Task

  20. Led from 10 to 2

  21. Should flash White to Black sequentially (from Led 10 to led 2) timing set 0.5 sec (but may need to adjust separately of other tasks)

  22. Led 1

  23. This should follow the sequence above action after Led 2 has completed task.

  24. Led 1 should Flash Red (0.5 timing set sec) (but may need to adjust separately of other tasks)

  25. Led 1 should Flash Amber (0.5 timing set sec) (but may need to adjust separately of other tasks)

  26. loop

  27. Section 3

  28. WS2812 Bank 2

  29. pin out

  30. NUM_LEDS 16

  31. Button B Pin in 3v (task start stop)

  32. Starting from Led 15/(16) to led 0

  33. should flash Yellow/ black sequentially

  34. This should be 2 on 2 off chasing sequentially 0.5sec

  35. Loop

My question is this achievable

Thank you in advance

That was good experience!!
And, while I don't know anything about LEDs, what you are talking about is timing signals, and sounds reasonable.

1 Like

Sounds doable.

  • Master the examples that come with the Arduino IDE.

  • Start with a schematic showing all what is in the project, this can be changed as you go.

  • Master how to make TIMERs based on millis( ).

  • Learn what is and how to use the State Machine programming technique.

4 Likes

Have a look at the MultiBlink code I have here (https://github.com/MajicDesigns/MultiBlink).

You can configure each of the patterns you have stated easily as static data in the code. Multi_Blink5_Neo is designed to word in conjunction with the FastLED library to do Neopixel type displays. You will need to modify the code enable/disable sequences based on events but it is easily doable by setting the enabled property of each sequence.

1 Like

It is very possible. A depends on your hardware skills and or willingness to learn. You will also need to learn how to write non blocking software. I would highly recommend before going any further getting a copy of the Arduino Cookbook, it has just about everything you want to do in it. First skim it then read the sections that apply to your project. There are also some good tutorials and some not so good on line you can watch.

1 Like

Further reading that will come handy

2 Likes

Hello toxicbb

My advice:

Take a view into the IPO model to gain the knowledge.

Have a nice day and enjoy coding in C++.

1 Like

The blinking / fading / leds as a running light etc. is surely doable by a single microcontroller.

What I do not yet understand is some points of your list

Do you mean you have to learn which is the anode / kathode of an SMD 0402 LED?

what is the difference between 2. and 3.

what do you mean with

no idea what this means

what do you mean with

what do you mean with

It might be that this description is sufficient for you as you know all the other details of your project.
You should write an overview about your project.
best regards Stefan

2 Likes

Sounds interesting, and I'm looking forward to seeing you progress with this.

It concerns me that at various points in your list you put 'loop', to be clear: in case you think you do all the things listed above loop within loop, and spend several seconds or minutes or even hours getting from the top of the loop function to the bottom, that's not how it works. The loop function should go round many thousands of times in one second, updating and changing things that need updating and changing as needed. The tutorials already linked to above will help you to understand this, but until that all makes sense to you, you will struggle.

As for how many devices you need, I don't see anything in your list of requirements that can't be done by one processor in terms of processing power, I'm not sure about the numbers of pins you need.

Start small, get one simple thing working first.

Good luck with your project.

3 Likes

sorry to confuse this is just an overview script of what I need to process

yes using this reference in my o402 is a reference to SMD single leds, so as not to confuse for the digital signal to a smart SMD Led such as WS2812 .
Button reference refers that I need a button/control input on a pin that with a low voltage from an outside source, as I am alternating between 2 separate Leds they will need to be on different pins, appreciated your input

how do you plan to deal with brightness ? just changing the max of a PWM duty cycle ?

still confusing what you are writing here.
If you use a real and typical button. This button has a contact that is opened/closed through a mechanical force.
Electrically this typical button is only connected to the microcontroller and nothing else. The voltage needed for the a typical button comes from the microcontroller. There is no need to connect a typical button to some external voltage supply.

As you are writing about 3V do you talk about some device that is electronically in itself??

To be able to adapt explanations to your knowledge-level
you should write information about how much you know about electronics and programming.

From your postings so far this is unclear SMD numbers might say you know quite a lot about electronics. Some other things make me ask "what is her/his knowledge-level about electronics?

best regards Stefan

Post a schematic showing all components used.

from what I gather

  • Arduino Nano
  • 2 SMD 0402 LEDs with suitable current limiting resistor (required to fade, so PWM needed for those probably)
  • 2 buttons (called ButtonA and ButtonB)
  • 2 WS2812 strips, the first one (bank 1) with 12 pixels and the other (bank 2) with 16 pixels
  • suitable power supply for the strips & nano

it seems some timings could be adjusted, so there needs to be some sort of UI or API too but this part is unclear.

What is the model you’re making?

Hey Stefan

Thanks for taking the time to read my post and follow it is greatly appreciated, I was going to use the button code to read and act on the signal which can be between 5v and 3v
the signal will actually be 12v but a 530ohm resistor should be sufficient to reduce current to something and Arduino can safely accept without risk of any overvoltage. if this is the case I'm open to suggestions hence the post, I have tried a few Arduino AI sites but either my queries are not framed well or the AI still has to be refined more as still keep throwing the delay command even when it is told to not use delay.

A button/switch is only a way to either open/close a circuit, from what I have been able to learn is, that the button command is just checking if there is a signal yes/no and act on the result, depending on the criteria set in the program, I am purchasing a special module.

(https://tenacontrols.com/product/complete-android-bluetooth-controlled-lighting-board-and-system/)
that controls a lot of light functions but I want to put some of my own twist to some of the functions, so will use the outgoing power signal to activate the sequence on the Arduino.
as I said haven't done any programming in over 40year and even then it was in BASIC. simple string loops if-then statements, certified MSCE NT4 not really electronic or programming but makes your brain work in a certain diagnostic way, quite a few years as small engine specialist, so have to work on mower marine and automotive circuits, and most importantly google and youtube are my friends, never be afraid to learn, it can only cost time.

SMD numbers are no special skill only a size of the SMD. An 0402 part is 40 mils (0.040 inches) long and 20 mils (0.020 inches) wide. I will be using a range of SMDs in the project all sizes from 0402 to 1206 some 3mm and 5mm Leds also WS2812 Chip 2020 strips, 1260 SMD COB strips and 5050 light strips.
also i did large Christmas light displays for quite a few years and had over 20,000 leds running.

so, in essence, I'm the proverbial bottom of the pyramid, I know a little bit about a lot of stuff, but what I don't know there is the internet.

Using a current-limiting resistor is not the best method for interfacing 12V-signals
You should use a well calculated voltage-divider.

You linked to the website itself. Do you want to buy

this

module?
image
or something different.

The device shown in your link is something completely different than a mechanical button!!

So far you have been only partially followed the advice given in the
"how to get the best out of this forum"-tutorial.

Sure there is the internet. And as long as you use website and videos you can do this in every way you want. The interaction with other users in a user-forum is different.

So if you want to proceed quicker than:

  • doing a quick short posting
  • waiting 1 hour for an answer where the answer is only asking for left out details
  • doing a quick short posting
  • waiting 1 hour for an answer where the answer is only asking for left out details
    ... repeat repeat repeat repeat repeat repeat repeat repeat repeat

and
if you want the sympathy of the users here read this introductional tutorial and follow the advice as close as you can.

best regards Stefan

yes.

you can program all "tasks" on your own or you can use a library to make things easier for you.
I suggest you start with the a simple program from the IDE "blink without delay". If you got it working and don't want to write much code, have a look at my library:

Noiasca Took Kit for LEDs - Arduino Effect Library for your LEDs (rothschopf.net)

It offers several LED effects to run in parallel and a simple button.
Furthermore you can mix LEDs on discrete Arduino pins and WS2812 stripes (or several other "port expander" variants).

1 Like

always search first on the Project Hub:

https://projecthub.arduino.cc/

https://projecthub.arduino.cc/search?value=led

Thank you again Stefan, for your constructive criticism, I never asked for sympathy,

Please don't take this the wrong way.

My only question was if what wanted to achieve could all be in a single sketch on the same board.

As learning a new programing language including acceptable terms and references will take considerable time.

And I felt it better to go to a lernard a community first and ask if it was possible before I invested time and effort into for all i knew may not have been possible.

Many responded overnight (different time zones, or they don't sleep) with yes it is possible.

I did not ask for anything more. and was considering my options on the positive responses I received, while reading during my break at work. and had decided that i would investigate all i could on this site when I had time to review and take it in and experiment some more, you polity asked questions, and in turned answered as best i could at the time.

In the end a nano is only $3.50ea from Aliexpress and could easily just run 3 boards, $11 wont kill me on the project, I asked the question because it seemed wasteful and a bit of a fun challenge.

I look forward to more constructive criticism. :slight_smile: