The trouble with Christmas Lights 2023 - Page 1
Forum section: electronics / projects

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 02, 2023, 07:42:01 pm
content: OK so I went shopping for some new lights to put around a mirror in our hallway...And bought...A set of 880 LEDs with a multi-function controller. The lighting functions, eight of them, are all pretty psycho except for Continuous ON, which is my preferred setting.The mode... Combination, In Waves, Sequential, Slo-Glo, Chasing/Flash, Slow Fade, Twinkle/Flash and Steady On are selected using a push button...So far so good... but I need to select Steady On (seven pushes of the button).And you guessed it... the lights do not remember their mode so every time the lights are turned on (via a timer) they enter psycho mode.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 02, 2023, 07:50:39 pm
content: So... I've done the dangerous bit... chopped the end off...The power supply is like this...andSo... I guessed that the power supply is on one side and the effects on another... measured between the DS3 and DS4 points with lots of dangerous exposed voltages and measured 11.7VNow I can put the dangerous stuff behind me since if I apply 11.7V from a bench supply with GND at DS4 and +11.7V at on the far side of the diode at DS3 the lights function.This is now a safe project so please have no qualms in making suggestions due to concerns for my health and safety.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 02, 2023, 07:59:19 pm
content: The LEDs are connected by two wires. I think the scheme is that one set are wired in one direction with the other set in the opposite direction. The arrangement of the four transistors is an H-bridge to set 12V one way or the other to light up one half or the other. PWM is used to dim one or other or both of the two segments to create effects.I probed around the eight pin device and found near enough 5V in the corners. The two pins connected to the 101 resistors drive the H-BridgeAs anticipated...150Hz is used to drive the bridge. Here duty cycle is near 50%... full on in both strings. Where dimming occurs the duty changes.So...How should I approach this? Add a gadget to press the button seven times on start-up? Replace the controller with something else that just generates a square (and anti-square wave) at 150Hz?I seem to have 5V available and could just lift the 101 resistors?Suggestions welcome.Merry Christmas.PSI'm not exactly sure where the 5V comes from... must be regulated down from 12V somewhere... perhaps inside the microcontroller?

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 02, 2023, 08:08:50 pm
content: FYIThe switch is on a sub-assembly... along with two LEDs...

author: themadhippy
author_rank: Super Contributor
timestamp: November 02, 2023, 08:16:50 pm
content: hows about a 9v ac transformer and forget about the chinesium control board

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 02, 2023, 09:14:06 pm
content: Quote from: themadhippy on November 02, 2023, 08:16:50 pmI like your thinking... how did you arrive at 9V?

author: themadhippy
author_rank: Super Contributor
timestamp: November 02, 2023, 09:37:10 pm
content: Quotea guesstimation based on the most common tranny sizes,and 9v rms is 12 and a bit volts peak to peak

author: Whales
author_rank: Super Contributor
timestamp: November 03, 2023, 01:45:05 am
content: Some quick thoughts:There are 3 pins on the 8 pin micro that go to missing parts (CS7, CS8 and CS3 all at the top). Could they have designed this thing to suit different products? Perhaps some where you don't want all the flashy modes?I wonder what happens if you install a capacitor (?) or a small resistor (1K?) in those spots.Alternatively: find an 8 pin micro with similiar pinout and program it to do nothing but output fast square waves on the H-bridge pins. You will probably want to add some dead time and double-check you understand how the fets are being driven (possibly the micro's pins are open-collector, so the gates of the fets are driven to the full +VCC and not just the max voltage of the micro?).

author: ajb
author_rank: Super Contributor
timestamp: November 03, 2023, 01:59:42 am
content: Quote from: NivagSwerdna on November 02, 2023, 07:59:19 pmDS4 is a zener diode serving as a shunt regulator, RS19 (marked 152) is the resistor that feeds it from the 12V supply. You could certainly use this to drive other circuitry, just know that the maximum current you can consume from it depends entirely on RS19.Note that there is no (explicit) current limiting here, it's relying on the impedance of the secondary and the resistance of the wire to limit current.Quote from: themadhippy on November 02, 2023, 08:16:50 pmNot a bad idea, but a transformer with sinusoidal output is more likely to produce objectional flicker versus a square wave, because the LEDs will only be on when the transformer output is near its peak. Plus the fact that the frequency drops from 150Hz to 100Hz. Visibility of flicker depends on both frequency and duty cycle. May or may not be a problem, some people are more sensitive to/bothered by it than others.Quote from: NivagSwerdna on November 02, 2023, 07:50:39 pmKinda... One side is the primary side of the switch-mode supply, the other side is the secondary plus the output control. In this case there's not much "secondary" circuitry, just the rectifier (DS3) and bulk cap (CS4).Replacing the existing MCU with something else that generates a pair of complementary square waves wouldn't be too hard. You could do that with a little 6-pin AVR even, or for an easier path use atiny MCU board.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 03, 2023, 10:33:53 am
content: I'm a bit concerned about running at 50Hz especially as there will be a cut-off due to some part of the cycle being too low... so really tempted to add a 150Hz square wave (and anti-squarewave) generator.There is plenty of space on the top board and I could run bodge wires through the hole.I must have an old PIC lying around somewhere.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 03, 2023, 10:38:02 am
content: Quote from: Whales on November 03, 2023, 01:45:05 amInteresting. The CS8 and CS7 look worth a fiddle.

author: Gyro
author_rank: Super Contributor
timestamp: November 03, 2023, 10:50:35 am
content: Agreed, CS7 and CS8 could well be configuration selects. Looking at the rest of the board, CS implies capacitor, so if resistors don't work, try 100nF capacitors.More of a concern is how you're going to fit 880 LEDs around your hall mirror!

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 03, 2023, 03:45:39 pm
content: Tried all combinations of 1k resistors in the two positions CS7 and CS8. Cannot see any noticeable effect.CS3 is parallel to DS4 so didn't think that was a good idea.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 03, 2023, 08:06:12 pm
content: OK so I looked in the box of things I have bought in the past on EBAY after watching some random video on YouTube... and found...ATTiny85 in Digispark flavour.I think this is probably a reasonable start... now just have to figure out how to get it to do two channels of PWM

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 03, 2023, 08:32:35 pm
content: I really need to read some documentation but I think this is what I am after...i.e. the 8-bit timer to be driven by clk/256 and to count... 0...208One pin to be on during period 0..100 and the other pin to be on during period 104...204I'll have to read the datasheet to see if that is doable in registers only, i.e. hardware.

author: tggzzz
author_rank: Super Contributor
timestamp: November 03, 2023, 08:51:00 pm
content: What are the waveforms in different modes?If "chasing" or "waves" and only a small proportion of LEDs are on at a time, it may imply communication with the individual LEDs.If using a nice simple (i.e. Z80 class not x86 with caches and pipelines) MCU to do nothing other than generate a fixed waveform, I'd be tempted to ignore timers and just use software loops with magic numbers that give the right timing.

author: Whales
author_rank: Super Contributor
timestamp: November 03, 2023, 09:19:26 pm
content: Be careful with your control signals. P-channel mosfets might have inverted control and/or require open-collecter output pins on the micro. Fully reverse engineer the circuit of the 4 mosfets, their resistors and how they are hooked up to the micro before assuming anything.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 04, 2023, 08:32:13 pm
content: Making slow progress...Using code...Code:#include<avr/io.h>#include <avr/interrupt.h>byte counter = 0;ISR(TIMER0_OVF_vect){counter++;if (counter >= 52) {counter = 0;}switch (counter) {case 0:PORTB |= (1 << PB0); // ONPORTB &= ~(1 << PB1); // OFFbreak;case 25:PORTB &= ~(1 << PB0); // OFFPORTB &= ~(1 << PB1); // OFFbreak;case 26:+PORTB &= ~(1 << PB0); // OFFPORTB |= (1 << PB1); // ONbreak;case 51:PORTB &= ~(1 << PB0); // OFFPORTB &= ~(1 << PB1); // OFFbreak;default:break;}}void timer_setup(){TCCR0A = 0x00; //Normal modeTCCR0B = 0x00;TCNT0 = 0;TCCR0B |= (1 << CS01); //prescaling with 1:8TIMSK |= (1 << TOIE0); //enabling timer0 interruptsei(); //enabling global interruptPORTB |= (1 << PB1);}// the setup routine runs once when you press reset:void setup() {// initialize the digital pin as an output.DDRB |= (1 << PB0); // set PB0 as outputDDRB |= (1 << PB1); // set PB1 as output(LED)PORTB &= ~(1 << PB0); // OFFPORTB &= ~(1 << PB1); // OFFtimer_setup();}// the loop routine runs over and over again forever:void loop() {// Hard Loop}Just got to figure out how I can program that into a bare ATTiny85 (without the Digispark bootloader)

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 13, 2023, 03:05:14 pm
content: OK... so it's done...Lifted the two pins that drive the H-bridge and added bodge wires... Bodged in the Digispark Attiny85 board...Reassembled... Job Done

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 13, 2023, 03:07:25 pm
content: Final notes: Upgraded the bootloader to make the delay at start to a small value.https://github.com/ArminJo/micronucleus-firmware/tree/master/firmware/upgradesmicronucleus.exe /run upgrade-t85_entry_on_powerOn_activePullup_fastExit.hexNow it starts almost immediately

author: Gyro
author_rank: Super Contributor
timestamp: November 13, 2023, 06:29:07 pm
content: Yay, with a month to spare (I hope!).

author: tggzzz
author_rank: Super Contributor
timestamp: November 13, 2023, 06:51:28 pm
content: No, a month too early.Put the damn things back in the box, then relax and enjoy November before the stress of Yule.Bah, humbug.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: November 13, 2023, 10:32:19 pm
content: I try and keep December free for adventofcode.https://en.wikipedia.org/wiki/Advent_of_Code