Home        Store        Docs        Blog

Lumen control using the onboard ATTiny45-20

(Richard) #21

Frequency-related lines commented out, so just temperature control left to work out. One happy camper :slight_smile:

(Richard) #22

Guys, last queries relating to temperature control: I’m planning a simple approach - once the temperature reaches a potentially damaging level I’ll dim the LED to a low level, then let it step back up to the requested level when the temperature recovers above another nominal value - ie I’ll have low and high temperature set levels.

Am I right to interpret that when the analog_read value from TEMP_PIN gets down to 265 (out of a range of 1023), that equates to 85 C, and that’s when you currently start applying dimming control ?

(Rusty) #23

Hi Richard,

You are correct. Here’s a quick list of what values correspond to what temperatures:

% 60C: 443
% 70C: 355
% 80C: 293
% 90C: 235
% 100C: 184
% Slope: -7.5 steps per degree

We use a proportional temperature control approach so that the limit moves smoothly as the temperature becomes higher.


(Richard) #24

Rusty, you’re a star, that’s perfect. I’ll finalise the temperature control and then post the final version in here for anyone who’s interested, if that’s ok.
cheers, Rich

(Richard) #25

All working fine now, serial at 9600 baud direct into the yellow lead, 0-6 levels of dimming by sending characters “0”, “1”, “2” etc, frequency as you guys had it; I’ve added a temperature trip when it gets to 85 degrees, it flashes then drops down to level 1 until the temp comes down to 70 degrees when it resets to the prior level.
Code attached as text file for anyone who’s interested.
Thanks again for all the help, Rusty, very much appreciated.

LumenSerial.txt (3.6 KB)

(Rusty) #26

Richard, that’s awesome! Nice work! I’m sure others may be interested in this.

Thanks for sticking with it and figuring out the issues!

(Richard) #27

Works with RS485 as well - connect D+ to black GND wire, connect D- to yellow wire, don’t connect the RS485 GND wire (if there is one). Haven’t tried it over any great distance yet, and I’m not sure whether this is an acceptable way to use half the 485 signal. But it works, so might be handy where there are cables longer than the RS232 limit (50m ish?).