PDA

View Full Version : Arduino LED controller with knobs for adjustment?


lingwendil
08/04/2017, 08:54 AM
*****(I'm not looking to buy a commercial product, please don't derail this into that sort of thing)*****



Hey, I was looking at the various LED controllers around, and don't think I see exactly what I'm looking for. I do a ton of testing and playing around with various LEDs for things, and wanted something a little easier to adjust on the fly.

The makers drivers look OK, but I've heard they are a bit finicky, and they still require a controller anyway...

I've looked at the bluefish, very nice, but even the mini is very expensive for a non-permanent solution for hobby testing.

The typhon and its various forms are nice enough, but the controls are a little clunky for me. If all else fails I'll just build one of these and suffer :lmao:

What I'm basically looking for is a simple controller that will do sunrise/sunset, and allow the maximum level for each channel to be set via a potentiometer. Basically you just set start/stop times, duration of fade, and set the pot to where you want the max level for each channel to be. is there something like this already around?

I already have a reasonably extensive stash of electronics components (what you expect from the average hobbyist) but I am braindead when it comes to code. I've tried, and can't figure anything out other than simply uploading it to the arduino.

I already have on hand

-Meanwell LDD drivers
-DS1302 chips
-16x2 LCD screen (nothing special, basic LED backlit HD44780 type, no serial backpack or anything)
-Arduino Uno
-a sack of potentiometers, I have ten 10k linear pots on hand
-various momentary pushbuttons

Is there something already around I can build up using this, that will let me use pots to set the maximum PWM duty cycle for 2-4 (or 2-6) channels of LEDs with smooth ramp up/down?

should I just build a typhon and stop crying?


I've sent O2surplus PMs on various forums without response, I figured if anyone knew it would be him.

*****(I'm not looking to buy a commercial product, please don't derail this into that sort of thing)*****

djbon
08/04/2017, 09:12 AM
There are several different arduino sketch mainly for reef light control. I used typhoon sketch for my CBB before and it work just fine.

lingwendil
08/04/2017, 09:46 AM
There are several different arduino sketch mainly for reef light control. I used typhoon sketch for my CBB before and it work just fine.

Does it use individual knobs for adjusting brightness, or is it running the stock setup?

djbon
08/04/2017, 10:11 AM
Runs straight from stock setup. There is no reason to use knob for brightness unless you wanted to tweak the settings all the time. I assumed you know how the program works, so I won't touch that part. I did some major fine tuning on the sketch as I don't use some of the functions. I am no longer runs a dimmable fixture, so I wrote my own sketch to suite my current setup.

der_wille_zur_macht
08/04/2017, 10:15 AM
It would be easy to modify the Typhon hardware and software to set maximums by knob.

The biggest challenge with this is that a pot is inherently analog, and Arduino (and its sketches) are inherently digital. You would have to convert, either in hardware or software. There are sample sketches out there for both. Software is probably easier.

If you do this with Typhon, I would leave the stock sketch intact and just add code to the section of the sketch that sets the outputs so it cuts the output value by a reading off the pot. You don't want to be constantly reading the pot and storing that value in memory (the stock sketch stores the value in eeprom every time the menu is accessed so it is retained in a power outage) as the Arduino's built in memory isn't that durable. Also, you don't need to store the value, since a pot is inherently self-storing the value physically.

I haven't touched Arduino code in years but I'd be happy to help if you can't figure this out.

djbon
08/04/2017, 10:20 AM
I won't complicate the build if I were the OP. Momentary switches works just fine.

lingwendil
08/04/2017, 10:25 AM
It would be easy to modify the Typhon hardware and software to set maximums by knob.

The biggest challenge with this is that a pot is inherently analog, and Arduino (and its sketches) are inherently digital. You would have to convert, either in hardware or software. There are sample sketches out there for both. Software is probably easier.

If you do this with Typhon, I would leave the stock sketch intact and just add code to the section of the sketch that sets the outputs so it cuts the output value by a reading off the pot. You don't want to be constantly reading the pot and storing that value in memory (the stock sketch stores the value in eeprom every time the menu is accessed so it is retained in a power outage) as the Arduino's built in memory isn't that durable. Also, you don't need to store the value, since a pot is inherently self-storing the value physically.

I haven't touched Arduino code in years but I'd be happy to help if you can't figure this out.

I literally have no idea how to add the code, I've tried in the past but could never wrap my head around the way it is integrated. Any help would be appreciated! I just don't know how to do it my self, so I feel bad asking anyone to write it up for me!

I agree that leaving the stock sketch code in place would be a good idea though.

der_wille_zur_macht
08/04/2017, 10:25 AM
I won't complicate the build if I were the OP. Momentary switches works just fine.

I agree, which is why I designed it that way in the first place. But sometimes we DIY because we want a very specific thing, not just something good enough!

djbon
08/04/2017, 10:34 AM
It is not that difficult anyway, arduino can read analog input (in this case the pot gives out variable voltage) as well (pin assignment declaration). You can get the idea from here https://www.arduino.cc/en/Tutorial/AnalogInput

der_wille_zur_macht
08/04/2017, 10:59 AM
Put your arduino on a bench and play with the analog input sample sketches. Do some googling about analog smoothing. Experiment and see if you can get comfortable. Even if we spell it all out for you it will be hard (and less fun) unless you understand the basic concepts. Don't sit down with the goal of doing the whole project, first learn each building block one at a time.

djbon
08/04/2017, 11:45 AM
+1. I always use the serial monitor to display the resulting data. Good luck!

mcgyvr
08/04/2017, 12:01 PM
Start with the basics and work your way up..
Thats how you learn..
Attempting to learn by modifying a fairly complex existing code is not the best way for you..

https://www.arduino.cc/en/tutorial/potentiometer
https://www.arduino.cc/en/Tutorial/AnalogReadSerial
https://www.arduino.cc/en/Reference/AnalogWrite (<--This is really all you need)
or here..
https://www.arduino.cc/en/Tutorial/AnalogInOutSerial

Attempting a DIY project is only good when you know how to "do it yourself"..
walk first.. then run..

lingwendil
08/04/2017, 12:14 PM
The hardware aspect is easy, it's just getting the code implemented is the difficult part for me. I used to think I had a basic understanding, but when trying to work with and modify sketches I would get so frustrated that I literally put everything away in a box two years ago and left it all there :mad:

I can understand load lines for vacuum tubes, build entire amplifiers from the ground up, and I've even designed a hafler matrix surround sound/ambiophonics decoder/preamplifier using all tubes, but code makes me feel like a two year old :headwallblue:

Maybe I'm just an analog man in a digital world? :strange:

mcgyvr
08/04/2017, 12:57 PM
Those links above have each line commented for "easy" understanding..
Its really pretty easy when you start simple... (walk before run)

Start at "blink" example.. Work up.. Go slow.. plenty of beer.. :thumbsup:

Fredfish
08/04/2017, 01:37 PM
Those links above have each line commented for "easy" understanding..
Its really pretty easy when you start simple... (walk before run)

Start at "blink" example.. Work up.. Go slow.. plenty of beer.. :thumbsup:
Mmmm, beer battered code...

der_wille_zur_macht
08/04/2017, 01:41 PM
Play with the analog input sketch example. Play with blink and the other common examples. Then do your own sketch combining a few of them. Even if there's no interaction, just get used to copy and pasting code until you're no longer frustrated. Go to the arduino forums if you get stuck.

Once you are comfy, open the typhon sketch and add a new variable for an analog input (copy what you learned from the examples). Do some math to convert that to a number between zero and one. Now, find the function that actually sets the output. Multiply the output by your variable and you're done.

lingwendil
08/04/2017, 02:04 PM
Play with the analog input sketch example. Play with blink and the other common examples. Then do your own sketch combining a few of them. Even if there's no interaction, just get used to copy and pasting code until you're no longer frustrated. Go to the arduino forums if you get stuck.

Once you are comfy, open the typhon sketch and add a new variable for an analog input (copy what you learned from the examples). Do some math to convert that to a number between zero and one. Now, find the function that actually sets the output. Multiply the output by your variable and you're done.

I've done "hello world" before, and an rtc set sketch previously, but most of what you just suggested is daunting sounding!

Either way, I think it will be based on the typhon controller, so I suppose I'll need to lash up a protosheild and at least get a working controller together first. Then, I can go back and forth between testing out individual examples and then trying out the modifications.

Ugh, I think this may be a rabbit hole won't it?

perkint
08/06/2017, 01:39 PM
Ugh, I think this may be a rabbit hole won't it?
Absolutely :)

But mainly because, once you've got your head round it you'll keep thinking of new things to do with arduinos (or similar)!

Tim