In need of direction, with a small project

Thread Starter

Alln3w2m3

Joined Jun 20, 2023
57
There is a possibility that my suggested method could cause a flash when the button is pressed. I have no way to tell without testing it. If that was the case, it could probably be suppressed in the latching circuit you need to make it work anyway.
I've been looking into the microcontroller route and I agree it will work the best. It will allow a lot more flexibility later if I need to change, alter, or add some different features.

This might be an overly simplistic way to look at this but I was trying to compile a parts list. Not specific values, just the part types so I know what I looking for. I know I'll need the microcontroller, a switch/button of some kind, batteries and the harness for them, LED's, and any sort of connections that the application requires. I assume I still need the drivers for the LED's as well. Is there anything else obvious I am missing?
 

Thread Starter

Alln3w2m3

Joined Jun 20, 2023
57
Here are a couple of possibilities for you.

This is a COB (Chip on Board) timer module, it's 9mm x 12mm and can be programmed with a resistor for a time between 2 seconds and 1000 hours. I wouldn't count on much accuracy on that hundreds of hours side of things, but for minutes you should be able to calibrate it pretty well. They are about a buck US a piece. (Disclaimer: I have not used these, but I ordered a few to evaluate them because they look useful.)

This is an LED driver that can do up to 1.5A. (much more information here) It will handle that LED, but you will probably want to put some kind of heatsink on the chip. I have used these modules and they are very good. Critically, they have a CE (Chip Enable) pin, this turns the driver on and off, so it can be used as an interface to the timer. It runs about a dollar and a half a pop.


Your pushbutton switch would have to use some simple circuitry to latch a power supply to the LED and start the timer at the same time. The CE pin is active high which means it turns on the driver when a high logic level voltage is present. The timer is active low which means it connects its output pin to 0V, or logic low, which is close to that.

By connecting the timer's output pin to the CE pin, along with another connection from CE to Vcc (the supply voltage source) through a pull-up resistor, the effect would that the timer would hold CE low until it expired then the connection to Vcc through the resistor would pull It high, turning it one.

The push-on-push-off function would have to be part of your latching circuit, or, you could use separate on and off buttons which would likely be simpler.

Now, all of this said, I would ditch the timer (the driver's a great option, they work well). I am going to make a suggestion that will be greeted with cheers from some and jeers from others, but I am going to make it anyway:

I would use a small MCU (Microcontroller Unit), probably an ATTiny 13A, which is a tiny 8-pin DIP or even an SMD component that can be programmed to do all of the on-off and timing functionality. They are cheap as dirt and easy to program.

Yes, you have to be willing to learn how to do that. But you can use the Arduino IDE (the development environment and framework for Arduino) and a very cheap, readily available programmer to do everything. Once you do learn this stuff, you will be in control of something like magical powers. You will be able to take tiny little chips and bend them to your will, not replying on complicated circuits or other people's ideas of what you might need.

If you are at all inclined to try this route, I strongly encourage you to do it. It's really, really useful; it's fun; and it's a start in a whole new world of microcontroller wonder.
Is there any reason I couldn't use a product like this?: https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html

I don't mind learning how to construct my own pcb with the other microcontroller you suggested. I'm just wondering if one already built offers any addition flexibility for more functions later (in addition to the timing requirement).
 

Thread Starter

Alln3w2m3

Joined Jun 20, 2023
57
Aliexpress is a better option for the pre-made solutions. Here is one from there. The manufacturer has a couple of options. Its a 3W driver which is over the 2W needed for that LED that I linked to. If nothing else, one more place for ideas.
Apologies for the late question. I saw the individual driver chip you linked and the preassembled board. This is probably a dumb question but what is all the extra stuff on the preassembled version and how would I know what pieces to add if I use the individual chip?

I believe I am going to use a microcontroller for the simplicity and the ability to add features later. I'd love to make a single unit where the led and driver are mounted with the microcontroller.
 

Ya’akov

Joined Jan 27, 2019
9,277
Is there any reason I couldn't use a product like this?: https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html

I don't mind learning how to construct my own pcb with the other microcontroller you suggested. I'm just wondering if one already built offers any addition flexibility for more functions later (in addition to the timing requirement).
There is no reason that you couldn’t, and the XIAO is a very nice dev board, but the question is, why that one? There are many options some smaller and some larger, with many features, and at varying prices—higher and lower.
 

Thread Starter

Alln3w2m3

Joined Jun 20, 2023
57
There is no reason that you couldn’t, and the XIAO is a very nice dev board, but the question is, why that one? There are many options some smaller and some larger, with many features, and at varying prices—higher and lower.
No specific reason other than I knew it was an arduino chip and the smallest I could find. The idea of it seemed to simplify the whole design. I'm still stuck in the "I don't know what I don't know" phase. Like an earlier comment, I don't know whether I'm wiring an LED assembly to a driver unit or assembling my own pcb with all the required components. For my particular purpose, I wouldn't mind that second option so I can package it how I want, but I know that more complicated.
 

Ya’akov

Joined Jan 27, 2019
9,277
No specific reason other than I knew it was an arduino chip and the smallest I could find. The idea of it seemed to simplify the whole design. I'm still stuck in the "I don't know what I don't know" phase. Like an earlier comment, I don't know whether I'm wiring an LED assembly to a driver unit or assembling my own pcb with all the required components. For my particular purpose, I wouldn't mind that second option so I can package it how I want, but I know that more complicated.
Well once very important thing is what may at first seem a subtle distinction but once you can incorporate it will make many things a lot clearer, and the is the meaning of “Arduino”.

An “Arduino“ isn’t really a thing. The closest you will get is one of the boards produced by the Arduino organization or its clones. The Uno, Mega, Yun, and others, whose legitimate names are preceded by “Arduino” could reasonable be called Arduinos along with their pin compatible clones.

But this is not determined by a chip, not a particular board, rather by compatibility with the Arduino framework. The magic of Arduino is the way that the Arduino framework and the IDE that is a part of it, hide the confusing details of dealing with embedded processors.

When something is “Arduino Compatible” it means that someone has created the configuration files, scripts, and libraries to function in the Arduino framework. The extent of ”compatibility” can vary widely. It can range from the same level of support you’d get when using an “Arduino” to partial support that requires a great deal of the arcane wizardry you’d need to know to deal with the board outside the Arduino framework,

The example you chose of the XIAO is a good one. Seeed Studios is an excellent company. They produce fine products and provide solid support for them—including Arduino integration. That particular one would be a fine choice. But, you can see the MCU (Microcontroller Unit, which is a CPU with on-board peripherals) in that case is a SAMD21. A very good MCU but also very different from the original AVR chips used on “Arduinos”.

The same board is also available with an Espressif ESP32 chip, another great MCU with really excellent support for WiFi, Bluetooth, and other radio technologies. The Arduino-designed boards with their ATMega AVR chips, the XIAOs with their SAMD21 and EXP32 chips, and all the other compatible boards—even the Raspberry Pi Pico, which is literally an RPi using a chip designed by them are all Arduinos when the term is loosely used to mean ”compatible with the Arduino framework“.

And this definitely a very important attribute! That compatibility makes them useful to someone who knows that framework, so you certainly want to know it. But after that, it’s just a source of confusion. It comes down to this. What you are about to learn as about a lot of layers.

They range in abstraction from extremely concrete such as the minute, hardware specific details of writing your program to the chip’s memory (”programming” or “burning”), to extremely abstract like the functional libraries that let you use the peripherals on the chips and ones you choose to connect outboard. Between them are things like the code needed to translate the library’s functions to specific needs of the MCU.

Always keep in mind that terminology is very important because it can hide or reveal important ”truths” about hardware and software. If you don’t know a term, read about it. It really would be best if you didn’t let a term you don’t understand go by without finding a definition. You would literally, automatically over a short time find yourself in the top 20% of experts. No joke, try it.

Also, if you have to do something to make a project work, don’t just accept it as magic—ask someone, read, figure it out yourself but unmask the mystery. This is so critical to really getting good at this stuff. And for those times when you find it is entirely over your head, write the question down for when you are ”taller”, because you will be, and figure it out then,

It makes me happy to see you starting out on the road to using MCUs. Though I have waxed rhapsodic about becoming an expert, do know that you don’t have to do that. You can do an amazing number of things with the Arduino framework, dev boards, and modules knowing very little, and if that’s your speed there is really nothing wrong with it.

To be honest, your expressed interest is exciting but the last thing I want to do is scare you away so:

Buy a XIAO, buy a cheap starter sensor and component kit, install the Arduino IDE, and play with it—make an LED blink, make an LED toggle on and off with a momentary switch, make buzzer sound for 5 seconds when the lights are turned on, make up other things. Have fun. Then you should have little problem doing your current project with it and expanded your use of “Arduinos” to whatever your imagination comes up with.

Ask any questions you have, there is a lot of help here, from helpful folks. Don’t be afraid if the questions seem “foolish”, the people answering you had to ask those same foolish questions. Good luck.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
19,630
Here I see the "Nuts and Volts" mindset at work. Not understanding the circuit or what the components are doing, using software as the only tool to make changes. Certainly any timer function can be created with enough code, but will an individual gain any insight or ability to understand what any portion of the circuit does?? Probably not!
To learn about how circuits function, it is important to utilize circuits. Using code to operate a processor will not provide that learning. Those are two vastly separate skill sets, both useful but totally different.
 

Ya’akov

Joined Jan 27, 2019
9,277
Hello, @MisterBill2.

Here I see the "Nuts and Volts" mindset at work. Not understanding the circuit or what the components are doing, using software as the only tool to make changes.
I've seen you say this before, and once again I am baffled by it.

Certainly any timer function can be created with enough code, but will an individual gain any insight or ability to understand what any portion of the circuit does?? Probably not!
Here we start to go off the rails. Why do you suddenly assume the goal of writing code to create a timer is to "gain insight and ability to understand circuits". Clearly the goal is the timer, not something else.

Where did anyone claim that that learning about how to program was a path to learning how to design or use circuits?
If using circuits teaches about circuits why doesn't programming teach about programs?

You can point to the unfortunate practice of cargo cult programming, but in fact this same thing happens with circuits. There is nothing about them to make them immune to copying blindly and adjusting them until they "work".

Can you support this assertion in any way that doesn't allow me to simply substitute "circuits" for "code" with equal truth?

To learn about how circuits function, it is important to utilize circuits. Using code to operate a processor will not provide that learning. Those are two vastly separate skill sets, both useful but totally different.
It is very hard to have a concise response to this. There is so much unpacking to do, but here's an attempt.

You are, by implication claiming several things:

  • 1. Using circuits instead of programs is a goal, though unstated by the TS
  • 2. Using circuits teaches about circuits and how they work
  • 3. Using software doesn't teach about circuits and how they work
  • 4. Programming software is a useful skill, but somehow circuits is so important it completely eclipses code

1. I see no basis for this claim. You might be saying "circuits should be the priority" but there's no justification for that. The TS wants something that does something, that's his goal. If he also wants to learn circuits, that's a different goal. The fact that he is so interested in learning to use MCUs suggests that circuits are not his priority and I can't for the life of me understand why you think dropping into his thread to rail against using MCUs is appropriate.

If it is any consolation, circuits are required to interface the sensors and actuators needed when building any useful project, so the TS can't escape the using them, which brings us to 2:

2. I think this is true enough, but with the same limitations are using software: there is no need to learn more than the minimum to cobble together something that "works", and copying and mangling is effective if a person doesn't care about it. There is nothing inherently superior about circuits that elevates the casual user to a serious student.

3. This is merely a straw man. No one, anywhere suggested that it does. This is a very strange shift from "programming doesn't provide insight into programs", if I may neologize, perhaps argumentum prestidigitum—argument by sleight of hand. Swapping out "coding doesn't teach about circuits" for "coding doesn't teach about code" is, in its way, masterful mental gymnastics.

4. This is more of the same ground assumption that circuits are the moral fabric of electronics and no matter how useful MCUs and programmable devices are, unless you've learned circuits, you are just one of "those people".

The problem with this and with this entire argument is that people can be exceptionally successful at building electronic devices without knowing much about circuit design. Is it a "good" idea to learn circuits to be a balanced practitioner in electronic arts? I would say yes.

Is it a moral imperative that trumps learning something which is very arguably more powerful and productive? Clearly on this point we disagree.

Did you argue against ICs because they didn't teach about discrete transistors? Maybe you did, but I doubt it.

Bill, do you know how to program MCUs? I really don't know, but I suspect all of your excellent knowledge of circuits have given you no "insight into or understanding of how any portion of the code works".

And, if "using software as the only tool to make changes" is somehow bad, surely. "using circuits as the only tool to make changes" is much worse! Software revisions are practically free, don't require a soldering iron, and can be tested in seconds. Contrast that with hardware only revisions. Hardware loses badly.

But, this is just another straw man. Using software where it is the best choice and hardware where it is most effective is clearly the optimal way. And optimization is the heart of engineering. It doesn't matter if someone starts with software or hardware so long as they produce functional, sustainable solutions they are doing what engineers do.

Today, the MCU is a genuine boon to electronics design for so many reasons, and the complexity of the MCU ranges form the tiny 8-pin wonders that let you effectively create any logic chip you need with the bonus of ADC, DAC, PWM and more while being cheap as dirt to feature rich chips with integrated wireless communications and hardware support for a huge range of I/O options.

Wherever you land on this spectrum you have a method of lowering the component count, and providing fast and free revisions, MCUs do replace circuits with a superior method in many cases—but not all, and no one worth listening to has made this claim.

Please, @MrBill2, refrain from spreading FUD and confusing neophytes into thinking they are doing something wrong. They aren't. MCUs are completely valid as an approach to design and implementation of electronic controls, of real world interfacing, and in that arena are almost always superior to discrete circuits particularly for neophytes comfortable with computers, software, and programming.

Those times when they aren't, when they are overkill or otherwise unsuited, it is good to point that out and offer an alternative. But to characterize starting with MCUs, as you do, morally inferior, a dysfunctional "mindset", is just plain wrong and misleading.
 

Thread Starter

Alln3w2m3

Joined Jun 20, 2023
57
Let me break the tie before this becomes a pissing contest for fan boys in either camp: I can see both your points. Given I'm the new guy not entrenched or indoctrinated yet, I'd call that a win.

For the purposes of this particular project, Ya'akov's help has been invaluable. I am trying to solve a very specific problem with a project I've been mulling over for almost 15 years now and I've never had the knowledge to do it, not even knowing where to find it. This arguments get in the way of that. I have a very particular need that a microcontroller lets me solve and adapt later.

To MisterBill2's point, I do plan on learning the more indepth workings of circuits. This project may need to shift into more custom pcb building, but again, I'm probably still using a microcontroller because of its flexibility and I won't be able to tear apart this particular circuit every time I need it to do something different. I'm trying to solve a problem, not develope a new hobby. If I go that route, I will learn everything. Right now, I just want my project done finally.
 

Ya’akov

Joined Jan 27, 2019
9,277
Let me break the tie before this becomes a pissing contest for fan boys in either camp: I can see both your points. Given I'm the new guy not entrenched or indoctrinated yet, I'd call that a win.

For the purposes of this particular project, Ya'akov's help has been invaluable. I am trying to solve a very specific problem with a project I've been mulling over for almost 15 years now and I've never had the knowledge to do it, not even knowing where to find it. This arguments get in the way of that. I have a very particular need that a microcontroller lets me solve and adapt later.

To MisterBill2's point, I do plan on learning the more indepth workings of circuits. This project may need to shift into more custom pcb building, but again, I'm probably still using a microcontroller because of its flexibility and I won't be able to tear apart this particular circuit every time I need it to do something different. I'm trying to solve a problem, not develope a new hobby. If I go that route, I will learn everything. Right now, I just want my project done finally.
That‘s very diplomatic, and I am glad you have a balanced view. Learning about circuits is a very important aspect of being a rounded maker who uses electronics.

Just to be clear, that isn’t what this is about, and I am certainly no “fan boy”. This isn’t about that at all. The content of my post should be very clear, and though I am glad you are not confused or dissuaded by Bill‘s off-topic whinging, others may be. I was addressing something for people who don’t know there is no basis for the complaint.

You actually repeated several ideas I mentioned in the post. So you don’t really understand Bill’s “point” if you think you addressed it. In any case, this is neither a circuit clan vs. MCU clan thing, nor is it a personal attack on Bill, who is a respected, knowledgeable, and very helpful regular here.

This is about exactly the balance and pragmatism you expressed, and about saying out loud that there is nothing wrong with learning about MCUs and their application before learning about circuits. You will learn unavoidably learn about circuits along the way to the extent you need to know.

And, if at some point what you want to do is more efficiently done with a few transistors, or some discrete logic, there will be plenty of people to point it out to you. If you decide to work on something that handles analog signals, you will almost certainly need at least front-end analog circuitry, if not a complete analog circuit, so naturally you will learn as you go.

It is precisely the idea that “circuits vs. software” is a false dilemma that I was addressing, along with the unspoken but ever present idea, in some quarters, that using MCUs is not “really” doing electronics.

Again, thank you for the balanced response, it’s very good. And the impulse to do some peacekeeping as excellent but, fortunately, really unnecessary. There is no underlying war being fought here, just some (apparently) curmudgeonly grumbling that has the potential to do completely unintended damage and I was finally compelled to address.

I apologize that is was in your thread, and I won’t be talking any further about it so the topic drift doesn’t increase.
 

Thread Starter

Alln3w2m3

Joined Jun 20, 2023
57
Hey, as long as it's not another "one battery won't work" post, it's all helpful. I appreciate everyone's inputs. I did order a beginners circuitry kit to mess around with.
 

MisterBill2

Joined Jan 23, 2018
19,630
WOW!! A very well thought out, accurate, and to the points rebuttal to my evidently excessive comments.
Indeed I was a rather intense in my response. I will avoid such responses in the future, at least that is my plan and intention.

What I am rather critical of is an entity that claims to be for the electronic experimenter and hobbyist but is functionally a product pusher for assorted modules and packages, never providing information as to how any circuit functions. I don't know if others recognize that or not.
Representing oneself as an electronic hobby publication while only pushing modules is the big gripe. Never mentioning that a function can be implemented in any manner except with a processor module is not doing anything to educate a hobbyist, is it??

Those organizations that publish application notes are quite different in that there is no representation that they are doing anything except providing help toward successfully using their products. And even in providing that information there is often a discussion of how the circuit works to deliver the required results.
 

Ya’akov

Joined Jan 27, 2019
9,277
WOW!! A very well thought out, accurate, and to the points rebuttal to my evidently excessive comments.
Indeed I was a rather intense in my response. I will avoid such responses in the future, at least that is my plan and intention.

What I am rather critical of is an entity that claims to be for the electronic experimenter and hobbyist but is functionally a product pusher for assorted modules and packages, never providing information as to how any circuit functions. I don't know if others recognize that or not.
Representing oneself as an electronic hobby publication while only pushing modules is the big gripe. Never mentioning that a function can be implemented in any manner except with a processor module is not doing anything to educate a hobbyist, is it??

Those organizations that publish application notes are quite different in that there is no representation that they are doing anything except providing help toward successfully using their products. And even in providing that information there is often a discussion of how the circuit works to deliver the required results.
Thank you, Bill. I really do respect your knowledge and experience and your response is gratifying and, frankly, a relief. I was very concerned that my post would be taken not in the spirit it was intended.

I really appreciate your reaction and it raises you in my estimation, the sort of thing we should all be willing to do when we discover something we’ve overlooked.
 

MaxHeadRoom

Joined Jul 18, 2013
28,856
Here I see the "Nuts and Volts" mindset at work. Not understanding the circuit or what the components are doing, using software as the only tool to make changes. Certainly any timer function can be created with enough code, but will an individual gain any insight or ability to understand what any portion of the circuit does?? Probably not!
To learn about how circuits function, it is important to utilize circuits. Using code to operate a processor will not provide that learning. Those are two vastly separate skill sets, both useful but totally different.
You seem to have a problem here of someone achieving there goal by going to a modern way of solving the problem, The OP has mentioned, he just wants to achieve a certain goal in the most expedient way, not as a journey into electronics at this point.
I agree it is wise to learn what went before, but as someone who lived through all the evolving different electronic technologies, my first go-to now, is to explore an answer in software first using a single small picmicro etc .
e.g. When the first IC's came out, I did not dismiss them as some kind of 'easy' replacement to the discrete circuit multi-component version. I embraced them.
 
Top