Help defining my Project code scope - RGBLED Device with multiple patterns

TL:DR (Key parts bolded)

Hey all,

So quick bit of background, I am working on a project; RGBLED integrated Miniatures and models, I have found that while I do have the resources and skill-sets to learn to code (C&I engineer), I just don't have the experience or time to dedicate to this while managing the other parts of the project. As such, I have started to use Fiverr, i have never used it before and I would like help making sure my project scope is well defined and clear with what I want achieved.

I am looking for advice and criticism across the whole project, so please feel free to jump in and add your 2 cents wherever! But my main focus from this topic is the Code specification/scope.

[u]The Project:[/u] (Project Example Video)

The project is to create bases for wargaming miniatures that can be 3D printed in a clear material, that then has a small circuit placed underneath, then depending on how thick you paint the base alters which part of the base glows.

The idea is to be able to create a 'lava themed' or other 'themed' bases that have a dynamic lighting effect.

[u]The Circuitry:[/u] So I am relatively happy with the circuit, this can/will change based upon how the code ends up operating, I can get this part sorted, but I need assistance getting the code right.

  • Circular PCB - Dimensions = roughly 30mm circumference, height as thin as possible (most likely 10-15mm assuming CR2032 holder, PCB, SMT LEDs)
  • 3x RGB LEDs
  • Arduino program - ATTiny or ATMega microcontroller
  • Button control for LED Pattern/colour/brightness

This similar product below highlights the rough size of the PCB I would aim to manufacture. |500x309

[u]The Code:[/u] So based upon the circuitry specifications above I am assuming that the code would look something like;

  • A collection of patterns - maybe in case statements
  • 1 button that cycles through the patterns when pressed
  • 1 button that cycles through brightness
  • 1 or more buttons that alter the colours in the pattern - this bit here is where I think it might be complicated? what if some patterns have multiple colours? like a fade transition?

My Questions: So the part i could do with help is understanding exactly how this could/best way to have this function is? I would assume the gold standard would be to use interrupts? So lets say you want to change the pattern, you push the button and an interrupt is called, the pattern variable increments and the code returns to where it was (previous pattern), once that PatternFunction is completed, the code would cycle back round, check the case statement and move to the new Patternfunction.

Colour choice seems to be the most complicated part? So pattern wise I intend to utilise patterns like the ones found here; (Pattern example code) this is a great resource and has been massively helpful. I would obviously only be using a selection of these effect styles as I only have 3 RGB LEDs and the chasing effects are probably a little pointless for my project.

From this it seems that most patterns are either a single colour, or two colours (fade between etc), thus in my mind the best way would be to have 2 variables; colour1 and colour2. These could then simply be a button that cycles you through the colour spectrum for one. for single colour patterns, colour2 does nothing.

I could, make those analog inputs with a variable pot and thus allow the user to adjust the colour that way?

Would the largest issue be viewing the colour as you change the variable? as if i use an interrupt the colour being displayed by the RGB LED will be static (whatever was last sent), so how do I get around that? Do i include an update of the LED colour within the interrupt?

Anywho this is getting a little long for the first post, so I will leave it there, please comment/critique, id love to get some feedback as how best to proceed here.

Solar

Why not start by defining the problem with specifications including a flow chart and schematic. Define what is the expected outcome. Purchase the Arduino cookbook and read it, this will give you some basics. also use the online tutorials and videos available, there are many good ones on this web site. At this point you will be able to define the problem and may have already solved it.

Forget keying on the size of a circuit board. Work on getting the project to work. Then begin reducing the circuit board size and component size. Understand that as the size is cut in half, the cost of components and manufacturing is probably X10.

I had an engineer customer several years trying to develop a pocket sized laser range finder and gave up after finding the cost to REALLY make a small device using technology and components such as used in today's smart phones ran the cost up to about the cost of a smart phone, per each.

Paul

gilshultz: Why not start by defining the problem with specifications including a flow chart and schematic. Define what is the expected outcome. Purchase the Arduino cookbook and read it, this will give you some basics. also use the online tutorials and videos available, there are many good ones on this web site. At this point you will be able to define the problem and may have already solved it.

Thanks for some solid info, I will do just that and flow diagram it out.

Its not that I couldn't do the work, it was more that I am already working a full week, doing like another 10-15 hours work a week on the project in other areas and then trying to find the drive to do another thing. When if i had a decent spec that someone could work to I could basically trade 2-3 of my work hours to get it completed.

This is also one of the key parts that i need done, and i'm procrastinating. (the irony being the time spent in this post would probably have been enough to get a fair chunk of that work done! :fearful: )

I also didnt want to do the circuit diagram and then find someone says the code wont work on that because of X, or Y or limit their code. I already have a rough circuit and some running code, but I used an ATTiny45 but am already running into code size issues. Looking at ATMegas now.

Paul_KD7HB: Forget keying on the size of a circuit board. Work on getting the project to work. Then begin reducing the circuit board size and component size. Understand that as the size is cut in half, the cost of components and manufacturing is probably X10.

I had an engineer customer several years trying to develop a pocket sized laser range finder and gave up after finding the cost to REALLY make a small device using technology and components such as used in today's smart phones ran the cost up to about the cost of a smart phone, per each.

Paul

Thanks for the advice Paul, I will be aware of that, generally I think I should be ok, considering its a chip, some RGB LEDs, buttons and a battery holder, I am not set on the size, if it has to be bigger it has to be bigger, but the sizing above basically allows it to be installed in the typically smallest sized bases (32mm) and looking at components/count of their design vs their sale price gives me an idea of whether I would be able to match this size.

Attached a rough flow diagram. (Edit photo is failing to attach, will redraw out in an MS package later) So questions;

  • if you have an interrupt to change the colour in a function, how best would it be to view that change? I could have the colour displayed on all LEDs within the interrupt? And use a button to exit the interrupt instead of auto exiting?
  • I suppose the interrupts must alter the saved variables, and then the patterns must make a copy of those, so that they can alter the colours as the pattern loops, and then when the code loops back round, it can load in the colours saved?