Monday, 23 December 2024

Christmas Lights 2024

It’s become something of a tradition at this point that each year I continue to build upon the interactive Christmas lights which I started in 2020.

Previous iterations:


Now that my kid is walking, the baby bouncer control I added last year is redundant, but is given me the idea of continuing to build upon the lights following his progress stages.
So this year I purchased a Playstation dance mat.


The single board computer that I have been using is pretty much tapped out in terms of resources – trying to add a USB hub in order to connect the controller pulled too much power, so in order to do that would mean having another powered USB socket (currently there are 3, which all powered from a single wall socket, 3 port USB charger)

However the way that I have developed the control software is that it is ultimately a small web server on the local network.


Therefore I can connect the dance mat to a different machine then just have it control the lights over the network. It’s perhaps not the most optimal way of doing things, but is ultimately a temporary installation for a couple of weeks.


To connect the dance mat, I am using a Playstation to USB adapter (it’s a PS2 dance mat).


This shows up under lsusb, and using the details taken from there I can connect it using udev, following the same method that I used in order to connect the treadmill from a different project.

 

Thursday, 28 November 2024

Memory Box with lid-triggered audio

After having our son, my partner wanted me to make her a memory box where she could keep all the trinkets and keepsakes from his birth.

As it is something of an old stereotype that such things would be kept in an old shoe box, I wanted to mimic that aesthetic.

The box is made from iroko, sides of approx 1cm, joined with box joints.
The base is simple hardboard, rebated into the sides.

I didn’t really want to add hardware such as hinges as I felt it would detract from the shoebox aesthetic, so I opted for a simple lift off lid.

The lid itself is made from a thicker piece of iroko, with trim added around the edges.

In order to provide a good friction fit, a piece of plywood, wrapped in t-shirt fabric, matching the boxes internal width and depth was added to the lid. This holds the lid on without rattling around, and incidentally hides the “bonus feature” of the box.

The bonus feature

Of course I can’t do anything normal like just make a box.

During his first few weeks, whenever our son sneezed, he would follow it up with a little noise that sounded like he was saying “oh..”. Of course it was incredibly cute and a memory we want to cherish forever.

What my partner didn’t know at the time, is I had managed to catch this on video, and I wanted to surprise her with it. 

A few years ago (around 2015-2016 I think), Sainsburys brought out a Christmas biscuit selection box which included a gadget for recording a message that would play when the biscuit tin was opened.

Somewhere along the line somebody I know must have got one, I scavenged the gadget from the tin once it was empty, and it spent the past few years sat in my electronics junk drawer, waiting for a project to be used in.

 

 

The circuit board is clearly designed as a disposable product – it is powered by 3 button cell batteries, which are riveted to the PCB itself. Whatever microcontroller powers it is hidden under an epoxy blob, and the only other notable features are a small microphone, speaker, a light dependent resistor (which is how it detects if the box is opened), and a small switch used to start and stop recording.

First thing to do was to drill out the rivets and get rid of the dead batteries.
Rather than replace them with more button cells, I opted for wiring in a AAA battery holder, I just had to follow the PCB traces and connect it at the right point.

 The microphone is pretty much as crap as you would expect for something of that size in a ostensibly disposable product, so I needed a better way to record the audio.


To do that I replaced the microphone with a 3.5mm jack and coupling capacitor. Once I’d copied over the recording, I removed that as well to save space, and also removed the record button to avoid overwriting.

 

Then it was simply a matter of hiding the electronics in the box. This was done by carving out a hollow in the middle of the lid. The ‘inner lid’ of plywood that was also used to create a friction latch, added sufficient depth to the lid in order to hide the battery and PCB.

The underside of the lid with hollow for PCB/battery and speaker.


The t-shirt fabric that covered the inner lid also hid the circuitry, while also allowing enough light to pass through to activate the recording.


Sunday, 10 November 2024

Krups “Espresso Piano” XP521040 coffee machine repair

Since repairing the Dolce Gusto pod coffee machine a few years ago, I upgraded to a proper espresso machine, The Krups “Espresso Piano” XP521040.

It was another freebie hand-me-down from a relative who no longer wanted it, so I have no particular opinion on whether it’s a great machine compared to the competition or anything like that – it’s merely a step up from using a pod machine (with or without re-usable pods).

The problem
A while back it started acting a bit weird – especially if I was making more than one coffee – it would seemingly enter what I thought was a cleaning cycle.
It just keep pumping water out into the drip tray until I switched it off at the mains.

More recently it failed more completely. As soon as the machine was switched on at the wall (even if the machine had not been switched on by it’s own power button), it would start pumping water into the drip tray – the only way that the pump could be switched off was at the wall socket.

Diagnosis
Starting by opening the machine up from the bottom, I quickly found the controller board. 

For a consumer product, the circuit board is surprisingly well labelled.
There are a number of braided wires, connected with spade type connectors.

After a bit of probing around, I noticed that the PCB had a slight scorch mark at the base of one component. It was very small, I actually didn’t notice anything during the initial investigation - it was only when I’d just about given up and was packing away everything to dispose of that I spotted it.

The scorch mark around the leg of the failed component



 

 

 

 

 

 

 

 

 

 

 

The component in question is a BT134. This is a triac, and it is connected to the pad with the spade connector labelled “pump” – So it seemed a likely culprit.

Tracing the connections about the machine appears that the pump has a direct AC connection, so my guess as to what happened is that the component failed and it’s failure state effectively held it open instead of in a “switched off” state.

This does explain why the pump was active only with mains power, regardless of the rest of the machines state.

The fix
The fix itself was plenty straight forward. I sourced a replacement BT134, I swapped it out, which requires no more than a little bit of soldering.

Putting it all back together, I tested it and it works fine.

There’s nothing more to it really than that, I just want to write up and publish this in case it helps anyone else who may be having similar issues with our machine. But as always, these posts should be treated as a diary of what I did, and are in no way a how-to or guide. I am by no expert, what you do with information I provide is at your own risk.



Monday, 8 January 2024

Hardwood slim line LED panel light fitting with accent lights

I recently purchased a pair of low profile LED ceiling lights from a charity auction on Ebay.

It seemed like the kind of thing that I’d find a use for eventually, and it was for a good cause.

After buying I had a message from the seller to tell me that they only had one driver for the two panels – I went ahead with the purchase because at the end of the day I wasn’t expecting them to be new and pristine from a charity auction.

My curiosity was piqued when they arrived. I noticed another label sticking out from underneath the address label. I peeled it back, and revealed an Amazon delivery label to a different address.

Initially I figured perhaps it was an Amazon returned item – one of the drivers was missing, therefore the original purchaser returned it, and it was sold on to the charity as one of those wholesale return pallets that you see advertised.

I did also think that the wires on the mains side of the LED driver seemed a little bit thin. However I tested it with those panels and they actually seemed to work okay, so I didn’t think much more of it.

Losing faith

So, I started to put together a project plan to make a light fitting with them.

I wanted to add in a few extra accent lights but everything I had was 12v, and the light fittings driver was 18v. While I was mulling over options – adding in a separate transformer, the space and heat issues to work round, etc. I noticed a couple of other things.

The case of the driver seems to have fake screw heads stamped on them. Not in itself a problem, but kind of sketchy.

And the panels themselves are stamped with 18w, not 18v.

The output of the driver says 9-18v at 300ma.

W=V*A.

There’s no way that if those panels are 18w, the driver can provide enough power to them.

This made me rethink my theory on the background of these lights.

Having a look on Amazon I can see very similar products, with identical looking drivers – the only difference being that the outputs are rated differently.

My guess is that this set of lights came with incorrect drivers, and the original purchaser damaged one whilst trying it.

It’s only a theory and not enough to make a claim against, it ultimately is enough to destroy my faith in these lights and make me not want to use them as they are.

Rebuilding the electronics

I had built the design around the size of these panels, so I decided to rip out all of the electronics.

On doing so I realized that the panels were just flexible LED strip edge mounted to a diffuser.

I swapped out the LED strip that was there with some white 12v strip LEDs. I had to trim about a millimeter off the sides of the diffuser in order to account for the slightly larger LEDs.

In an initial test the LED light was quite patchy, so I took the diffuser from the second light and doubled up. This makes a notable difference.

To drive the strip I’m using a regular RGB LED control box.

Initially my choice of this was simply because it was available and had a small profile so would fit well in the fitting.

However this also gave me the idea I could run the accent lighting and the main light on different color channels, allowing them to be controlled separately. It would also allow me to dim the light.

The design

Because I don’t want to carve out my ceiling to flush fit the panel I planned to build a small mitred frame, with another frame mounted at forty five degrees behind it. The back frame would contain some accent lights, with the front frame housing the main light fitting.



the fitting needed to fit in with the of our lights in the room, so I disassembled the original fitting and spray painted it black.

For the wood frame I opted to use zebrano.

The frames are simple squares with 45 degree mitres, and a 2mm deep by 10mm wide rebate to fit the light fitting frame flush with the surface.

The back frame was turned at a 45 degree angle, and screwed to the front frame.

The back frame also had a pair of key hole plate mounted to the back, which will be used for connecting to the ceiling.

Accent Lighting

Rather than cut up the filters from the second light, I opted instead to use a stack of filters from an old PC monitor. It was simply a case of measuring out the triangles, cutting them and then gluing them in place with hot glue.

Each corner would have a single segment of white LED strip (3 LEDs per corner). These would be connected in series and then connected to the RGB LED control box, on a different color channel to the main light, allowing them to be used independently.

The rest of the electronics

The IR receiver from the control box sticks out behind the front frame, so it is not visible from ground level, but catches enough reflected light from the ceiling to function.

However, this didn't last long and soon found itself wrapped in black tape because what I didn't realise at the time was that the IR receiver worked on the same encoding as our TV remote and we soon bored of having the lights change as we scrolled through TV guide menus.

PSU

The power supply is provided by an AC-DC “wall-wart” – I had to be quite selective in which one I picked to fit within the frame. The one I opted for had a removable face plate which allowed me to remove the socket pins and wire directly into.

The end result

 



Saturday, 30 December 2023

Christmas Lights 2023 - Baby bouncer controlled lights

Back in 2020 I made some Christmas lights that could be controlled via Slack and WhatsApp so that Christmas spirit could cross the void created by Covid-19 and its lockdowns.

In subsequent years I added more features, such as morse code.

So now adding to my over-engineered Christmas lights has become something of its own tradition.

In early December this year, while setting up the decorations and mulling over what new silliness I was going to add to the lights, I was asked to fix my son's baby bouncer/cradle thing.

It's a Fisher Price Kick & Play Calming Vibrations bouncer, which has switches in the foot area which I believe are supposed to trigger lights and sounds.

This particular one was a hand-me-down which had been sat in storage, and the battery terminals are all corroded, making it non-functional.

Fixing it wouldn't really be a big deal, but I remembered that like most newborns, my son loves anything that's bright and shiny and blinky, like Christmas lights.

 

So obviously you can see where this is going...

The arch of the chair detaches, and you can see in one of the mounting points 4 pins.

A quick probe with the multimeter shows that these are two pins for each of the two 'pedal' switches.


To interface this with the existing light setup, I decided to again use the GPIO interface of the PCDuino.

Using the guide from before, I identified the GPIO identifier for two pins that I wanted to use, and enabled them as below. Pin 4 (232) is an input and pin 7 (233) is an output that is set to high simply provide a source, as I wanted to keep the main source pins (3v3 etc) free.

echo 232 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio232/direction
chown -R ant:ant /sys/class/gpio/gpio232
echo 233 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio233/direction
chown -R ant:ant /sys/class/gpio/gpio233/value
echo 1 > /sys/class/gpio/gpio233/value

The two pins were connected with a resistor to create a pull up effect. I had initially tried to have it as a pull down but it seemed to still have a lot of flicker in the output.

I picked the switch with the red foot as this tends to be more how Sam would sit. one side of the switch was connected to ground, and the other to pin 4.

The code

I added a thread to the main application which would read the value of the pin and change the lights accordingly.

Because of the way that /sys/class/gpio/gpio232/value is not actually a real file, it was not possible to hold the file open and continually read the input. Instead I had to create a loop which would constantly open the file and read the value. This does cause some overhead, but isn't too bad because the file is never more than one character long.

I had initially planned that when a change is detected, it would hook into the main code to change the lights, however I found this was causing a lot of deadlock issues. 

Instead, the new thread works very independently - it will pick one of the basic colors at random, and make a simple HTTP request to localhost to invoke the change.

The result

I'm not sure if he's aware of the causation between him moving and the lights changing, but like most babies there's twinkling, blinking and sparkly stuff, he's a fan, so he certainly seems to enjoy it.


Wednesday, 6 September 2023

Acrylic bending tool and laptop desk mount

Since lockdown in 2020, I’ve continued to work remotely, and sunk a fair bit of time and effort into optimising my home office setup.


One thing that has continued to be a pain is having my laptop on the desk.


I don’t use it has a laptop the majority of the time – is it is closed and I use external peripherals (monitor, keyboard, mouse, microphone and camera). But it continued to take desk space as I had nowhere else to put it.


I had this idea of creating a mount on the side of the desk for it, but couldn’t settle on a approach or material to use. Wood would be too bulky, metal would be overkill and block wifi signal, and so forth.


Plastic seemed like the best option, but it would be far too big to 3D print.


When researching methods for manipulating plastic sheets, I found this video by Youtuber Dietec for a home-built acrylic bending tool.

 

Truth be told, I followed the video pretty much to the letter, so there’s no point rehashing all the points that are made.


The only main difference is I added a couple of toggle clamps on the side, and am using a “Universal” laptop power supply instead of a bench top one.

Anyway, back to the laptop mount.


It’s very simple really, take a sheet of acrylic and bend it into a ‘J’ shape, attach it to the side of the desk, and add laptop.


The piece of acrylic was recovered from an old scrapped project, and was a bit on the short side, however this could be overcome by mounting it lower on the desk skirt.


The bending process seemed quite straightforward. I did notice some crackling in the corners of the bends, I believe this is because I got impatient and stepped through the voltage settings a bit quick, rather than give the material time to heat slowly – so that’s something to bear in mind for next time. I think that's also why there's a slight curve to the lip, as can be seen in the picture below.


Then a couple of screw holes were added (taking advantage of pre-existing holes from the previous project and just widening them), and then screwing it to the desk skirt.

The laptop in place on the mount, tucking nicely under the lip of the desk at the side. Sure it's not a perfect build, but it serves its purpose.






Saturday, 10 June 2023

Treadmill Videogame Controller part 2

Since building the treadmill project late last year, I did actually manage to complete a full run through of the original Sonic the Hedgehog.

Along the way I found a few snags and issues with the treadmill:

Direction switch/lever

I soon found that the reed switch control from the cross trainer levers was problematic because there was a lack of tactile feedback to know when the lever was in the correct position for changing direction.

Therefore, I replaced it with a regular switch where normally open connected the ‘right’ key and the normally closed connected to the left key. Using a metal angle bracket I was able to mount it to the frame so that the switch is closed when the lever is fully forward, and open in any other position.

This means that when moving right I just need to keep the lever fully forward, and to change direction I just have to move it from that position.

Although I kept them in place for the duration of the Sonic play-through, I’ve since removed the cross trainer levers, as they do not provide any real benefit over a regular button.

Jump button

The large plastic button that I was using as a jump key broke (it was from a cheap “noise-maker” type toy, and the PCB literally snapped), so that was also replaced with a basic switch. I plan to change this up for something better in the future, but at the time I just wanted to go for a run.

Quick save and quick load 

I found, particularly on the more platform/puzzle sections of the game, it became necessary to make use of the quick save and quick load features of the emulator, so I added an external quick load button to the treadmills handlebar.

A better button system

All of the above can be distilled to a single point - that the button inputs were not good enough.

Although I started the project with the intention of minimising the number of regular button presses, it seems inevitable that there will always be some required.

Configuring the controls

In order to play other games I would need to make some additional adjustments for different control schemes. This would mean altering the firmware and re-uploading every single time I changed the game, which seemed needlessly convoluted.

There were two main reasons for using the Makey Makey. The first was to take advantage of its noise filtering features, and the second was its ability to act as a keyboard.

The noise filtering is the real selling point of using it, but there are other ways to obtain its input and then turn into keyboard input. So I adapted the firmware so that instead of sending keyboard input it would appear to the connected computer as a serial port. On each cycle it would send one byte, with each bit representing the button state (i.e. pressed or released) of each of the buttons.

This would allow a data transfer rate fast enough to handle pretty much any input I can throw at it.

The source code for this can be found at Github.

The software

The software will be an ongoing development project so I’m not going to be sharing it at the moment.

On the computer side, an application will continuously read the serial import, and then translate it into appropriate keyboard events via udev, thereby sending whatever that keyboard input is to ever application is active and in focus on the computer – in the case of this project that will be a game.

For this iteration of the treadmill I’m going to be using the acclaimed indie game Super Meat Boy – as it has a small range of inputs (left, right, sprint and jump) but adds a couple of extra bits of complexity for me to expand on with the treadmill.

Once the serial connection is established, a thread runs constantly, reading the latest byte from the Makey Makey.

It compares the byte to the previously read byte. If a bit that wasn’t previously set is now set, then a corresponding function is called in a secondary thread, which is the input thread.

The input thread maintains a count of “presses” from the treadmill rotations, which increases with each press as well as decreasing with the passing of the specified time interval (the “decay”).

If the count is positive then the first key (the direction) is pressed.

If the count is positive and greater than the defined sprint threshold then the sprint (shift) key is also pressed.

For the jump key, the serial thread will always report the state of the relevant bit to the input thread.

This compares a pair of booleans (jumping and lastJump) – which determines whether the jump (space) key should be pressed or released. It is done this way because Super Meat Boy differentiates between small and large jumps based upon the duration of the key press.