## Introduction: Magic Colour Changing Mosaic Lamp Using Wireless Power and Proximity Sensor

This is a project that i worked out together with my wife Mieke, who loves working with glass mosaic.
I love working with LED lighting projects, so i thought: let's combine the 2 hobbies and try to make a kind of art-project combining electronics and glass mosaic.
Combining RGB-LEDs with transparent glass mosaic gives very nice lighting effects.
But working with glass is a challenge, because it is not easy to make holes in glass. So i needed to find a way to power the electronics inside of the glass work without making a hole for a power supply connector or to feed through a power cable. Inside of the glass work is a microcontroller that is used to slowly change the colour using an RGB-LED.
The colour changing is very slow, so you don't see it changing when only watching a few seconds. The microcontroller and LED don't need much power, so i didn't need a very powerful wireless power transmitter. Furthermore, the power did not have to be transferred over a great distance, but only over a few centimeters = thickness of the base cover + the thickness of the glass work.Besides that, i didn't want to make a hole in the base for a power switch, to switch the wireless power transmitter on or off. So i decided to use a capacitive touch/proximity sensor for this purpose, because this type of sensor works through glass and when the capacitive sensor area is made big enough, it can work over distances of multiple centimeters. The sensor has to be temperature stable, very sensitive and using a small amount of power, since it is powered continuously.The result is a nice looking colour changing lamp using wireless power transfer and that is be switched on/off using a capacitive proximity/touch-sensitive toggle switch.

## Step 1: System Diagram

In the picture you find the system diagram of the project.

## Step 2: Schematic1 - Capacitive Proximity/touch Sensor With Toggle Switch

The capacitive sensor circuit was published in Elektor Nr. 537/538 July/Aug. 2008.
It is a very stable and sensitive capacitive sensor, that can sense capacitance differences down to picofarads.The circuit has virtually no problem with temperature changes, because the capacitance is measured using a differential approach, meaning that 2 signals are compared with each other.
Both signals have the same temperature response, so this effect is cancelled out.
The relaxation oscillator build around U2B has a 50% duty cycle square wave output with a frequency of about 100 kHz. The output signal is fed to two RC networks, that both integrate the square wave signal. One RC network is fixed and formed by R2 and C1. The other RC network is formed by R4 and the capacitive sensor, that is made out of a copper clad PCB. The time constant of this last RC network will change with the capacitance between the copper clad PCB and earth.When capacitance is added, f.e. by moving your hand close to the copper clad PCB, the charge time of the RC network will increase, causing a delay, compared with charge time of the fixed RC network (R2/C1). The difference in charge times (thus delay) will be proportional to the extra amount of capacitance "felt" by the copper clad PCB. The compare operation, to measure this delay, can be done with an XOR. By feeding both signals to the 2 inputs of the XOR, the output of the XOR will show pulses with a width corresponding to the delay between the two RC networks. But the XOR will output pulses when the time constant of the capacitive sensor RC network is higher but also when it is lower than the time constant of the fixed RC network.
When we use a D-flipflop (U3A) to measure the delay, it will only output pulses when the clock input signal (CLK) is delayed, compared with the data input signal (D). When the D signal is delayed towards the CLK signal, the output will be 0.R3 and C2 form an integrator with a very high time constant compared with the pulsewidth of the output pulses of U3A. So the voltage over C2 will be proportional with the pulse width of the output pulses. This means that the voltage will be proportional to the capacitance difference or in other words, the added capacitance.U3B will toggle each time the voltage over C2 reaches the threshold voltage of the CLK input of U3B, which is about 1.5V. MOSFET Q1 is used as a switch that will toggle each time when the capacitive sensor sees enough extra capacitance. The MOSFET switches the +15V to the next stage, which is the buck converter for the wireless power transmitter.R2 has to be adjusted so the U2A does not output pulses when the capacitive sensor does not "feel" any extra capacitance.The capacitive sensor is very sensitive and will react to any change in capacitance. So when you connect the ground-clip of your scope-probe to the circuit, the total capacitance "felt" by the sensor is changed. The same thing when you connect the circuit to a lab power supply that is earthed. This will also change the total capacitance "felt" by the sensor.
So it is important to adjust R2 in the situation in which the capacitive sensor will be used without connection a scope. Best is to put a LED at the output of U3A, so you have a visible indication of the capacitance.Once R2 is adjusted adjusted and you move the sensor over to another table made out of other material or that is higher, lower, thicker or closer to a wall, the capacitance will change and you have to re-adjust R2. Also when you re-route the power cable coming from the adapter to power the lamp, this might influence the capacitance, especially when routing it close to a wall or metallic objects.

The oscilloscope picture shows the output voltage of the oscillator U2B at pin4

## Step 3: Schematic2 - Buck Regulator to Power the Wireless Power Transmitter

The buck converter is used to bring the power supply down to about 5V for the wireless power transmitter.
With 5V, the transmitter delivered enough power for my purpose.
The microcontroller that controls the RGB-LED and the RGB-LED itself do not need a lot of power. Furthermore, the distance between transmitter and receiver is maximum a few centimeters, so i did not need to burn a lot of power just to overcome the distance.
This also keeps the temperature of the transmitter components cool, because the whole thing is assembled in a completely closed enclosure without any air vents.The buck converter is nothing special. See application note for the MC34063. I added an extra buffer (Q1, Q2) and switching MOSFET, because i noticed that the chip got pretty warm when pulling 1A continuously.
So i over-dimensioned the switching stage to keep the temperature of the chip down. Probably it was not a problem at all, but i prefer to keep things safe,especially because the magic lamp is connected to the power supply day and night and sometimes one of our cats adds enough capacitance to switch on the magic lamp on.
Use a fast recovery schottky diode for D1 and use a low ESR capacitor for C1.
Also check that L1 can handle the current that you want to draw from the converter. The efficiency of the converter largely depends on the quality of D1, L1 and C1, because these components are responsible for storing and delivery of the power..

## Step 4: Schematic3 - Wireless Power Transmitter Based on Mazilli ZVS Oscillator

Q1, Q2 and Q3 form a time delay circuit that tackles the start-up problem of the Mazilli oscillator when using a slow starting power supply.
C1 and C3 (10nF) are only assembled for tuning of the LC circuit. They can be assembled to make small adjustments when tuning of the resonance frequency is necessary.
The coil is made of 14 turns of 1mm diameter enamelled copper wire, with the windings wound on top of eachother. The height of the stacked windings is about 16mm. The total inductance of the coil is about 16 uH.The diameter of the coil is about 57mm. The coil is tapped right in the middle by removing the enamel and soldering a tap-wire. You can also wind two separate coils of 7 turns and join 1 side of both coils together, but then pay attention that both coils have the same phase. When the coils are connected in opposite phase, the total power will be close to zero.
Together with C4 and C5, with a total capacitance of 200nF, the LC network results in a resonance frequency of about 81 KHz. It does not matter if the resonance frequency is higher or lower when you build this circuit, as long as the transmitter and receiver use the same resonance frequency.

Oscilloscope picture1 shows the voltage at one of the MOSFET gates.

Oscilloscope picture2 show the voltage between the 2 drains of the MOSFETS.

## Step 5: Schematic4 - Wireless Power Receiver

C1 and C2 (10nF) are only assembled when tuning of LC resonance frequency is necessary and small adjustments are needed.
The coil is made of 14 turns of 1mm diameter enamelled copper wire, with the windings wound on top of eachother. The height of the stacked windings is about 16mm. The total inductance of the coil is about 16 uH.The diameter of the coil is about 57mm. This coil doesn't need a tap. D1 is a schottky diode that is used as a half wave rectifier. You can also use a full wave rectifier, but this will eat away more voltage from the incoming signal because then you loose 2 diode-drops. U1 is a 5V ultra low drop voltage regulator with a typical dropout voltage of 0.6V/1A, so it will work down to an input voltage of 5,6V at 1A.
I checked how much power can be drawn from the wireless power receiver when the receiver coil is a few centimeters above the transmitter coil.
I could draw maximum 250mA before the ultra low drop regulator dropped out.

## Step 6: Demonstration of the Wireless Power Transfer

See video for a demonstration of the wireless power transfer

## Step 7: Schematic5 - PIC12F683 RGB-LED Controller

The RGB-LED controller is build around a Microchip PIC12F683.
The PIC12F683 uses a semi-random generator to change the colour of the RGB-LED randomly and very slowly, so you don't really notice the change when you look for a few seconds.
The firmware controls the RGB-LED using a software PWM of 3 digital output pins (red, green and blue)..
The PWM value is compensated with an exponential correction, so the LED brightness perception appears to change in a linear way with smooth colour changes..

## Step 8: Firmware

I added the hex file for the PIC12F683 microcontroller that is used to control the RGB-LED.
I will not publish the source files that were used to build the hex files.

See pictures