Touch Switch Hack Part 1

A (long) while ago I did a post on some touch light switches I acquired. The single button one is still running in the office with no problems. I figured I’d have a go at trying to get the 4 button one to work without mains.

The switch has

  • a glass front plate
  • a top PCB with the PIC, LEDs and touch pads
  • a base PCB with the relays and mains terminals

Livolo Assembly

I took it apart to get the top PCB. It has a clear silkscreen with vias labeled with 3V and 12V. The 3V via went to the VDD pin of the PC, so seems like it runs off 3V provided by the base PCB. Knowing the PIC pin out gives us a GND point on what looks like a programming header.

I traced/buzzed out 4 of the other header pins that control the relays.

switchpower

(1) is the 3V point, (2) is tht 12V point, (3) is GND, The red dots are the control lines for the 4 relays.

First Test

First test is just to apply 3V and GND to the top PCB only – if it works I can just supply power and take the control lines for the relays to my input modules.

So it powered up, but immediately went into a sequence of alternately red/blue LED every 2 seconds. Oh well not much use, but worth a try,

Second Test

Maybe it needs the 12V for something? This time I applied 12V and GND, connected the top and bottom boards together and powered up.

Again it powers up, the 3V rail is generated and the PIC once again works. However the same 2 second sequence occurs, this time with the relays also changing state in time with the LEDs.

Other Tests

Maybe it needs the glass plate installed to calibrate the touch sensors? nope – powered up with it assembled and still the same sequence.

So what to do next. I will reassemble everything and plug it into the mains just to be sure it actually works as expected – maybe its a dud?

If it works with the mains then at least I know its still a function unit and more hacking/testing is needed to run it on my 12V bus.

Ubuntu and USB Serial Devices

So I had to reboot the Linux server today, and I ran into the problem of it randomly assigning /dev/ttyUSB? devices to my two USB serial cables. With randomly assigned devices my CAN and SMS interface serial port names happened to get reversed – grrr.

So the task is to get Linux to assign the same name when rebooting.

First find out the device serial numbers, use this command and serach for the devices. Luckily in my situation the two cables I have are both FTDI cables with different serial numbers. Here is one

Next is to create or edit /etc/udev/rules.d/50-serial-devices.rules, and add a line for each device using the serial number, and in this case create a symlink to ttynasco0/1.

Restart udev, (reload?,  and trigger?) and magically the new files /dev/ttynasco0 and /dev/ttynasco1 will get created and assigned to whatever /dev/ttyUSB? file the kernel assigns.

Lastly I changed my config.ini file to point to the new nasco tty files.

Done!

Update 26/12/2014 – I replaced a cable and needed to update the configuration – It didn’t seem to take effect until I rebooted the machine for some reason.