Philips Hue garden floodlight

So, after the initial teardown, it’s time to start the Philips Hue hacking. To be honest this is fairly simple so doesn’t really qualify as a hack. I said I’d start small and work up from there, so consider this a warm-up exercise.

I’ve got a motion sensing 10W LED floodlight mounted on my workshop. It’s supposed to light my way as I head out there but it doesn’t really work as I’d like. As I’m walking straight towards it the PIR only triggers when I’ve already trudged through the dark garden and I’m about a metre away. Also, the local foxes are constantly triggering it at night. Having this under Hue control would be ideal. Let’s take a look.

img_20161231_130126My Wicked brand floodlight contains a single chip LED which actually had 9 separate LEDs on the die. It has a constant current LED driver which outputs 350mA at about 24V. Hmmm – this could be very easy. They pretty much matches the Hue bulb I tore down. Electrically this might be as easy as connecting the spotlight’s LED in place of the Hue’s board. And you know what – it was! I did a quick check that the hue bulb circuitry was happy to dive the LED in the floodlight directly and then it was just a case of putting it all together. Out came the PIR sensor. Out came the constant current LED driver (the white box) and in went the Hue circuit board.

img_20170102_130311The only tricky bit was deciding where to put the PCB. Once the LED driver had gone, there was plenty of room behind the light. However, this was a metal case and the light is a fair distance away from the house. I didn’t think the Zigbee signal would reach. It didn’t have to be in the lamp at all of course, but it seemed neater.

I decided that the best place to put it was where the PIR has been. All it needed was a new 3D printed front cover. I could have saved space and printed a new back piece. I could have missed out the hinged bit and printed a two part case. My new Year’s resolution is to get project finished so I went with the simplest option.

img_20170102_131430So, here it is side by side with an original. Fitting was pretty easy. The only gotcha I has was that as i connected it, the Hue hub decided it would be a good time to update the firmware in the bulb. Hue bulbs normally switch on when first powered but whilst updating it was off. Cue some unnecessary checking of wiring, removing and remounting it, checking fuses, etc. Oh well, it working

 

NFC login (version 1.0)

After my experiments with NFC readers I felt it was time to actually create something useful to work with my NFC implant. At work I need to make sure that my PC is locked whenever I leave my desk. It’s not that I work with anything really sensitive, it’s just that given half a chance my colleagues will certainly send an email on my behalf admitting to unusual sexual inclinations or offering to buy everyone biscuits.

I decided the easiest way to do this was with keyboard emulation. It doesn’t require me to have any privileged domain access, modify the PC or install anything that compromises security. Plus, it should all be possible using a MSP430F5529.

The launchpad, booster pack and antenna.

The launchpad, booster pack and antenna.

My proof of concept involved a MSP430F5529 LaunchPad and a . I made sure that I could emulate a USB keyboard, implement a USB CDC serial port and read my tag id.

The USB side of things was adapted from some of TI’s example code. The NFC stuff was a little trickier. The Booster Pack is sold bundled with either the G2 or F5529 Launchpads. However the sample code is surprisingly complicated and only supplied for the MSP430G2553. Porting it over to the MSP430F5529 should have been fairly simple – just changes to some in assignment and clocking. It somehow took me ages but I managed it in the end. I must publish my ported code to save other people the same trouble.

I combined them all together to implement the following:

  • A USB CDC serial port allows me to set the password (but not read it). It’s stored in the microcontroller’s flash so persists when powered down.
  • Pressing one button on the launchpad send Windows-L to lock my PC. (Not actually easily accessible in its current form.)
  • It scans continuously for NFC tags and if it sees mine it sends Ctrl-Alt-Del{password}Enter

The 2 part 3D printed case for my NFC login

The 2 part 3D printed case for my NFC login

Hardware wise for version 1.0 I went with the setup from my previous including a DLP coil antenna and a cheap bit of U-FL to SMA cable from eBay. I don’t intend that the final version will be using a dev board and booster pack. It’ll be a custom etched PCB, but I decided to take the same approach as with Agile software development – produce a minimum viable product first and improve later. If I don’t ever get round to a nice neat version 2.0 then at least I can actually log in with my implant.

A view showing the installed boards and antenna

A view showing the installed boards and antenna

I 3D printed a case that allows the launchpad, booster pack and antenna to slot in. It comprises two parts that clip together and a couple of magnet to hold it firmly against the PC case on my desk. The case is 3mm thick but only 1mm thick by the antenna coil so it reads fairly easily.

OK, it just looks like a plain yellow box

OK, it just looks like a plain yellow box

The final version looks a little dull. It’s a plain box that was almost done in black, but I happened to have yellow filament in the printer. All that happens when I successfully scan my tag is that a red LED shows through the case for 5s whilst scanning is temporarily disabled and my PC unlocks.

I’ve got a little bit of tidying of the code before I include it. As it’s evolved from two different lots of sample code in different styles it’s a little bit messy. I’ll also attach the STL files for the case – designed once again in my 3D modelling package of choice OpenSCAD.

Source code (still messy) and STL files (under files folder) are now available at https://bitbucket.org/fredmurphy/public/src/127c1b2f26305bd8b2b2184084927da72457f9e5/LoginNFC/?at=master

CNC controller enclosure

Laser cut acrylic enclosure

Laser cut acrylic enclosure

I converted my Proxxon MF70 mill to CNC quite a while ago. When I was testing things out I wired up the PSU and controller board and just threw them in a Tupperware container so that nobody got electrocuted. It even had the lid open to allow the cables (including 240V mains supply) in. A temporary hack if ever there was one. You know how temporary hacks are though – they tend to stick around longer than intended.

Close up of the connectors for the axes, e-stop and LED

Close up of the connectors for the axes, e-stop and LED

Well, I finally got round to making a proper acrylic enclosure. I attempted to mill one ages ago, but struggled with the small working area on the MF70 and abandoned it. This one is laser cut. It’s held together with machine screw’s and has two shelves – one for the PSU and one for the TB6560 based stepper controller. I particularly like the rounded piece for the power LED and the hexagonal grid for venting.

I’d be happy to share the design files if anyone is interested, but I doubt anyone has exactly the same setup as me. I also altered things as I went, so I don’t have any “final” versions.

Laser improvements – coolant monitoring

One of the quickest ways to destroy a CO2 laser tube is to let it overheat. My laser has a very simple system – just a plastic breakfast cereal container of water with a small aquarium pump. It works well enough, but is easy to forget.

My first modification was to power the pump from the laser so that it’s running when the laser is switched on at the mains. That gets around the “oops, I forgot” problem, but doesn’t cover a pipe coming loose or the temperature creeping up. I really wanted to actually check cold(ish) water was flowing through the glass laser tube.

The water and temp sensor

The water and temp sensor

To check the flow, I started with a LM35DZ temperature sensor and a cheap water flow sensor from eBay. For neatness I carefully milled the flow sensor to embed the temperature sensor in it. This was then attached to the output of the laser. I intend to check that enough water is coming out and that it’s below a temperature threshold.

I etched a board with a MSP430G2533 microcontroller that counted the pulses from the flow sensor over a fixed timer period and used the onboard ADC to read the temperature. I set the threshold at 40C and 75% of the normal flow.

PCB with logic error

First PCB with logic error

My initial attempt used a MOSFET to pull the last signal down to GND if things were awry. Unfortunately this fired rather than disabled the laser! This was replaced with a 74LSxxx AND gate so I could force it to 5V and disable the active low signal. Some connectors to match the controller board meant I could drop it in with no rewiring.

The finshed PCB - with a fix for a lifted trace

The finshed PCB – with a fix for a lifted trace

So far it has been working well. (I actually finished this months ago but didn’t document it.) It’s not actually been needed to save my tube yet, but it’s nice to know it’s there. I might later and another sensor on the input and also flag if the difference between the two is too high. I could also add a cheap LCD display but that seems a little over the top.

Coolant monitor in the laser

Coolant monitor in the laser

As it’s a single sided board with some through hole pin headers, when it’s in place you only see the “boring” side of it with not tracks or components. Oh well – there’s no need for it to look pretty. Here it is in place. It’s a drop-in addition on the 6 pin cable to the controller board. It’s powered from the existing 5V line and simply forces the signal to fire the laser high (as it’s active low) when it senses trouble. From teh top you can see:

  • The connector to the sensor
  • A debugging / programming header
  • A currently unused connector for a screen
  • The connectors to patch into existing power and signals

If anyone wants a copy of the PCB layout or code, just ask.

CNC mill alignment camera (version 1.0)

Since switching from milling PCBs to etching them, one of the most awkward steps is getting accurate alignment for drilling and cutting out the boards. Mounting a camera on the spindle isn’t an original idea, but after sporting some tiny endoscope cameras on eBay (10mm dia, 40mm long) I thought I’d give it a go. A good excuse to use the new lathe too.

image

The design is pretty simple. I drilled out some  aluminium bar stock to 12mm, with one end slightly narrower and tapped to M12. Then I turned down a M12 bolt to for in the 3mm collet I use with my end mills. A slot at the top is for the USB cable and two sets of three nylon screws allow for accurate alignment.

image

As you can see, a Mach3 video plug in makes it very easy to set the origin on a PCB or other work. Unfortunately it’s a bit long so there’s only just enough room to use with flat stock. I considered mounting it to the side of the spindle (with a known offset) but that didn’t seem right. A more compact version 2.0 is already planned using just the guts of the camera.

Adjustable MSP430F5529 Launchpad enclosure

F5529 caseI’ve been working on a project using the MSP430F5529 – a really nice microcontroller with built-in USB functionality. The final product should get an etched board. However it has a whole Launchpad for now, so I thought I’d dust off the 3D printer and make a case. My favourite tool is still OpenSCAD so I came up with an adjustable enclosure. It should be easy to add any openings or custom bit if you want to.

 

Here’s what it’s being used for. More info on that later…WP_20131014_001

More laser improvements – safety

I’ve been making yet more improvements to my laser. Mainly because there are so many things that can be improved upon. This time it’s been mostly about safety. Probably wise after I managed to burn a hole in the back of my hand last week.

Operating the laser without the water pump running is a quick way to overheat the tube and kill it. As this is just plugged in separately it is hey easy to forget. And it uses up another valuable socket. I added two outlets to the back of the machine that are connected to the main power switch. If the laser is on then the water is on. Ditto the power for the exhaust fan – not as essential but might as well do that to. I was going to use a standard UK kettle style power outlet but as the supplied fan and pump have Chinese plugs and they’re the same as Us ones I just used US sockets from Maplin.

Whilst doing this I checked out the wiring and traced where the main be power was going. The colour scheme used was black for neutral (or sometimes live) and red for live (or sometimes neutral). Thin yellow wire for earth of course. The fan had these three wrong way round. And a connector strip mixed them up anyway. Astounding!

The final thing was a simple microswitch in series with the laser on switch the cuts the beam if the lid is open.

Next will be a water flow sensor in case the pump is unplugged or the tubing is blocked. Then a water temperature sensor. I could add an emergency stop and maybe even circuitry that kills the laser if the head isn’t moving. That should prevent it burning a hole if I forget to turn it off at the end of the gcode.