- An open source Rain Sensor and controllerPosted 1 week ago
- An OTP (On Time Password) LockPosted 2 weeks ago
- Print with Chocolate in two colours with 3Drag Choco Big Dual ExtruderPosted 4 weeks ago
- A Christmas Star with Neopixel LEDsPosted 1 month ago
- SmartPID: Smart Temperature and Process ControllerPosted 1 month ago
- An Electric Speed Control for DC motorsPosted 2 months ago
- The BF 15+15W open source power ampPosted 2 months ago
- The Strato Pi UPS boardPosted 3 months ago
- Analyzing Semiconductor with a set of simple toolsPosted 3 months ago
- A RTC SHIELD for Arduino and Raspberry Pi, second partPosted 3 months ago
DIY LED Plexiglass christmas decorations (PIC version)
Very few components, plexiglass and a CNC are the ingredients to make wonderful brilliant figures to decorate the Christmas tree or our house this Christmas and New Year. Let’s see how to do it.
With the LED is possible to do things that with the traditional sources of artificial light was not allowed, like signs and figures obtained by projecting in a sheet of plexiglass the LED light. If we put a diode in parallel to the surface of a sheet of glass or transparent plastic, its light passes through the material and in the front is not seen. Making an incision on the surface, the light stops in them, and show the figure. Here, this is the technique of the modern LED signs, and we propose to experiment with creating some interesting and striking bright objects to use as Christmas decorations at home or where you prefer.Each object consists of an electronic circuit that turns on an LED RGB to compose various shades of color and a “mechanical” part formed by a plexiglass object. Yeah, but how we can work on plexiglass? Simple, with a CNC machine or with an hand drill.
The electronic circuit
As you can see, the circuit is simple and consists of a Microchip PIC12F675 programmed in PICBASIC PRO which works perfectly with 3 volts, which allows us to power the circuit with a lithium coin type CR2032.
Once powered the circuit after power-on-reset, the PIC initializes its own lines of I/O by assigning GP1, GP2, GP4 as dedicated outputs to control RGB LED LD1; GP0 is instead initialized as input assigned to the A/D converter (AN0) and we connected it to a photoresistor. This solution allows us to turn on the circuit only if the ambient light is weak enough (or if it’s dark …) to allow to see the figure carved into the plastic, but if the environment is too bright, the circuit turns off, so I do not consume the battery.
In the circuit we can use either RGB LED common anode and RGB LED common cathode.
After power on the circuit starts fading, gradually obtained by modulating PWM channels of the individual color of the tri-color LEDs.
After each cycle of fading, the microcontroller checks the analog input AN0 which is connected to the photoresistor, so if in the meantime the environment is too enlightened, firmware sends it in sleep mode for a minute. After a minute the micro wakes up and checks again photoresistor, to see if the light is lowered into the light, when the cycle starts again, otherwise it puts back into sleep.
The whole circuit is fed by a battery or battery capable of providing at least 3 times, preferably 3.6 (well, it must be a cell lithium-ion) or 4.5 volts.
R1: 47 ohm
R2: 47 ohm
R3: 82 ohm
R4: 10 kohm
C1: 100 nF
LD1: LED 5 mm RGB
LDR1: photoresistor 2÷20 kohm
– socket 4+4
– battery holder CR2032
Construction of the circuit
The tri-color LEDs can be mounted in three ways: through the through-hole (as in photos of the prototype visible in these pages, the side facing the short side, the side facing the long side of the board.
Remember that the circuit accepts both common anode LEDs, both common cathode: just set the jumper properly, or short-circuit the common terminal to ground if you use the type common cathode (cathode jumpers) or positive (jumpers ANODE ) if you use the diode common anode, it is understood that the firmware designed by us is suitable for controlling LED common anode. However, there is no problem, because adapting the firmware is pretty simple: just exchange the logical zero with 1 and vice versa.
Build the bright object
The materials recommended for this application are clear polycarbonate (or methacrylate) or Plexiglas, which can give the shape you want.
Then we need to impress, deep enough (half or two thirds the thickness of the slab) the drawing or the writing that you want to appear bright.
For this work, you can use a CNC or a hand drill (like DREMEL).
CAM programs allow you to draw shapes as ArtCAM.
Remember that each template must include a tab with a slot size of the head of the RGB LED.
To support the outline, you must mount the PCB in a plastic container, the lid must also include a window as large as the horizontal section of the tongue.
The CAD simulation
Source code PIC
'**************************************************************** '* Name : RGB controller for common anode led * '* Author : Landoni Boris * '* www.open-electronics.org * '* blog.elettronicain.it * '* www.futurashop.it * '**************************************************************** DEFINE OSC 4 DEFINE ADC_BITS 8 ' Set number of bits in result DEFINE ADC_CLOCK 3 ' Set clock source DEFINE ADC_SAMPLEUS 500 ' Set sampling time in microseconds DEFINE OSCCAL_1K 1 @ DEVICE BOD_OFF @ DEVICE MCLR_OFF @ DEVICE INTRC_OSC OPTION_REG=%00000000 CMCON =%00000111 ADCON0=%00000000 WPU=%00000000 IOCB=%00000000 INTCON=%00000000 ANSEL=%00000001 SYMBOL G =GPIO.4 SYMBOL B =GPIO.1 SYMBOL R =GPIO.2 SYMBOL AN =GPIO.0 'INGRESSO AD TMP VAR WORD TMP1 VAR BYTE TMP2 VAR BYTE TMP3 VAR WORD PAUSA VAR WORD LUCE VAR WORD TMP1 = 1500 'cicle TMP2 = 80 'step TMP3 = TMP1*TMP2 'TMP1*TMP2 PAUSA=200 HIGH R HIGH G HIGH B PAUSE 1000 LOW R PAUSE 1000 HIGH R PAUSE 1000 MAIN: ADCIN 0,LUCE IF LUCE > 100 THEN LOW R HIGH G HIGH B PAUSE PAUSA FOR TMP=0 TO TMP1 LOW g HIGH r PAUSEUS TMP*TMP2 HIGH g LOW r PAUSEUS TMP3-(TMP*TMP2) NEXT TMP LOW G HIGH B HIGH R PAUSE PAUSA FOR TMP=0 TO TMP1 LOW b HIGH g PAUSEUS TMP*TMP2 HIGH b LOW g PAUSEUS TMP3-(TMP*TMP2) NEXT TMP LOW B HIGH R HIGH G PAUSE PAUSA FOR TMP=0 TO TMP1 LOW r HIGH b PAUSEUS TMP*TMP2 HIGH r LOW b PAUSEUS TMP3-(TMP*TMP2) NEXT TMP ELSE HIGH G HIGH R HIGH B SLEEP 60 ENDIF GOTO MAIN