Friday, December 27, 2013

[TC] Water Level Indicator with Alarm using 8051 Micro controller (AT89C51)

This article illustrates the construction and working of a liquid/water level indicator. Such an indicator is used in tanks to indicate the level of liquids and alert us when the tank is full. So by this circuit we can monitor the various levels of the tank and can avoid spillage of water and also we can configure our supplies according to the various levels of tank. Such module or circuit can be installed in big buildings where manual monitor of tanks is difficult and its indicator can be placed at some centralized place.





This water level indicator circuit works on the principle that water conducts electricity. A wire connected to VCC and four other wires are dipped in tank at different levels namely quarter, half, three-fourth, full and their output are taken on pins P3.0, P3.1, P3.2, P3.3 via a transistor BC547. Port P2 is connected to data pins of LCD and P1.0, P1.1, P1.2 are respectively connected to RS, RW, and EN pins of LCD.

Initially when the tank is empty LCD will show the message VACANT. As the tank starts filling up wire at different levels get some positive voltage, due to conducting nature of water. This voltage is then fed to their corresponding pins on controller. When level reaches to quarter level, LCD displays the messageQUARTER. On further rise of level, HALF and 3/4 QUARTER are displayed on LCD. When tank gets full LCD shows the message FULL CLOSE TAP. A buzzer is also provided to produce a alert the user when the tank gets filled. This buzzer can be made off by pressing the switch connected between pin 15 of controller and VCC.
Circuit Diagram :



CODE
// Program to make a Liquid level indicator using LCD
#include<reg51.h>
sbit rs=P1^0; //register select pin
sbit rw=P1^1; //read/write pin
sbit e=P1^2; //enable pin
sbit quat=P3^0; //pin connected to quater level of tank
sbit half=P3^1; //pin connected to half level of tank
sbit quat_3=P3^2; //pin connected to three -fourth level of tank
sbit full=P3^3; //pin connected to full level of tank
sbit spkr_on=P3^4;  
sbit spkr_off=P3^5; // pin to off speaker

void delay(int k) //delay function
{
int i,j;
for(i=0;i<k;i++)
  for(j=0;j<1275;j++);
}

void write(int j) //write function
{
rs=1;  //selecting command register
rw=0;  //selecting to write
P2=j;  //putting value on the pins
e=1;  //strobe the enable pin
delay(1);
e=0;
return;
}

void cmd(int j)  //command function
{
P2=j;  //put the value on pins
rs=0;  //selecting command register
rw=0;  //selecting to write
e=1;  //strobe enable pin
delay(1);
e=0;
return;
}

void puts(char *a) //puts function to print a string
{
unsigned int p=0;
for(;a[p]!=0;p++)
write(a[p]);
}

void lcd_init(void) // function to initialise the LCD
{
cmd(0x38); //setting 8-bit interface, 2 lines, 5*7 Pixels
delay(1);
cmd(0x0e); //turning on underline visible cursor
delay(1);     
cmd(0x01); //clearing screen
cmd(0x80); //moving cursor to the begining of line 1 of LCD
}

void main()
{
quat=half=quat_3=full=spkr_off=1; //configuring as input pins
quat=half=quat_3=full=spkr_off=0; //lowering input pins
spkr_on=1;    // making speaker on pin high,as it works on negative logic
while(1)
{
  while(quat==0&&half==0&&quat_3==0&&full==0&&spkr_off==0)   //condition when tank is empty
  {
   lcd_init();        // initialising LCD
   puts("VACANT");       //printing VACANT on lcd
  }
  while(quat==1&&half==0&&quat_3==0&&full==0&&spkr_off==0)	//condition when tank is quater
  {
   lcd_init();
   puts("QUATER");      //printing QUATER on lcd
  }
  while(quat==1&&half==1&&quat_3==0&&full==0&&spkr_off==0)	//condition when tank is half
  {
   lcd_init();     
   puts("HALF");      //printing HALF on lcd
  }
  while(quat==1&&half==1&&quat_3==1&&full==0&&spkr_off==0)	//condition when tank is three-fourth
  {
   lcd_init();
   puts("3/4 FULL");     //printing 3/4 FULL on lcd
  }
  while(quat==1&&half==1&&quat_3==1&&full==1&&spkr_off==0)	//condition when tank is full
  {
   lcd_init();
   puts("FULL;CLOSE TAP");     //printing FULL;CLOSE TAP on lcd
   spkr_on=0;// Enabling speaker
  }
  while(quat==1&&half==1&&quat_3==1&&full==1&&spkr_on==0&&spkr_off==1)//enabling high speaker_off pin
  {
   spkr_on=1;//disabling speaker
  }
}
}


Tuesday, November 26, 2013

[TC] Bicycle Theft Guard

This antitheft device for bicycles is inexpensive and can be constructed easily using a few components.

At the heart of the circuit is a wheel rotation detector, realised using a DC micro motor. For the purpose, you can use the micromotor (spindle motor) of a discarded local CD deck mechanism. With a little skill and patience, you can easily attach a small metallic pulley covered with a rubber washer to the motor spindle. Thereafter, fix the unit in the back wheel of the cycle, like the existing dynamo assembly.






Power supply switch S1 should be kept ‘on’ when you are using this bicycle guard. When it is flipped towards ‘on’ position, the circuit gets power from the miniature 12V battery. Now LED1 lights up and resistor R4 limits the LED current. Next, the monostable built around IC1, which is CMOS version of timer LM555, is powered through a low-current, fixed-voltage regulator IC2 (78L05).

Initially, when the bicycle is standing still, the monostable output at pin 3 of IC1 is low and the circuit is in idle state. In the event of a theft attempt, forward or reverse rotation of the DC motor induces a small voltage at its DC input terminals and the internal LED of 4-pin DIP AC input isolator optocoupler IC3 (PS2505-1 or PC814) glows. As a result, the internal transistor of IC3 conducts and pin 2 of IC1 is pulled low by the optocoupler and the monostable built around IC1 is triggered.

The output at pin 3 of IC1 now drives piezobuzzer-driver transistor T1 via resistor R3 and the buzzer starts sounding to alert you. In this circuit, the buzzer remains ‘on’ for around two minutes. You can change this time by changing the values of resistor R2 and capacitor C1.

Zener diodes ZD1 and ZD2 (each 5.1V) act as a protector for optocoupler IC3. The costly GP12V/27A battery is used here due to its compact size and reliability. 12V active buzzers with high-pitched tone output may be used with this circuit. These are readily available in the market.

Note. The specific optocoupler is used here deliberately, instead of a bridge rectifier, to increase the circuit’s detection sensitivity. Never replace the same with a DC optocoupler



Source : http://electronicsforu.com/

Friday, October 18, 2013

[TC] Building an analog meter clock with Atmel and Adafruit


“We wanted to design a microcontroller board that was small enough to fit into any project – and low cost enough to use without hesitation,” Adafruit’s Limor Fried (aka LadyAda) explained. “[It is] perfect for when you don’t want to give up your expensive dev-board and you aren’t willing to take apart the project you worked so hard to design.”
Although the Trinket launched in September, the ATtiny85-powered Trinket has already tipped up in a number of projects including a sound-reactive color LED organ, IR control device, Tap Tempo and a temperature/humidity sensor. Today, we’ll be talking about building a Trinket-powered analog meter clock. As Adafruit’s Mike Barela notes, the Trinket is a perfect fit for clock projects, as the platform is small and easy to hide behind a larger display.
“Clocks don’t need a lot of logic, this example only has maybe 20 lines of code, [while] adding a digital display via I2C is possible using seven segment or character-based displays (with the library code posted for other projects),” Barela wrote in a detailed tutorial on the subject. ”This [specific] project interfaces Trinket to the the Adafruit DS1307 real-time clock (RTC) breakout board to form a clock. But in a twist, the display is done using two analog meters. One for hours, one for minutes.”
According to Barela, the Trinket is capable of outputting to a meter without digital to analog converters.
“Trinket has pulse width modulation (PWM) on three of its pins. The meter uses a moving coil inductance movement, acting to average the indication of current flowing through it,” he continued.
“If you have narrow pulses, the average voltage it sees is lower, thus the current is lower for the fixed resistance attached to it. For wide pulses, the meter sees nearly the supply voltage and will stay around the full scale. This circuit varies the pulse width sent to the meters proportional to the hour of the day and the minutes after the hour.”
For two meters, says Barela, two of the three PWM pins on Trinket will be used (the third is also an I2C pin connected to the clock module). Although there are many ways to display the finished product, Adafruit decided to go with the meters “free-floating” in a colorful box, rather than a cabinet or plexiglass display.
To kick off the project, Barela recommends Makers first unpack their Trinket. Those using a breadboard or Perma-Proto board will want to solder on the (provided) header pins. After unpacking the DS1307 kit and building the circuit, Makers are instructed to modify the Arduino IDE to work with Trinket by adding the hardware definition file, the avrdude.conf file – while changing the ld.exe program from the 2008 dated version to the 2009 dated version and installing the driver for USBtinyISP appropriate to your operating system.
“To prepare the Trinket for other programs, you will want to first load the Trinket Blink sketch into the Arduino software then load it onto the Trinket to verify everything works well. You must press the hardware reset button on the Trinket then quickly press upload in the Arduino software to upload a sketch,” Barela added. “If you get an error, try the reset-upload process again. If you continually cannot load the blink sketch, check to make sure the Trinket is connected (without any wires connected to pins #3 and #4) and the Arduino IDE software has all the required changes.”'


Source: http://atmelcorporation.wordpress.com/2013/10/18/building-an-analog-meter-clock-with-atmel-and-adafruit/

[TC] "Biocrats BharatOvation 2013" Organised By University Of Pune on 10th and 11th Dec, 2013.



Objectives of Event:

  • Creation of a platform in India for visionary Innovators, Industrial Houses, Venture Capitalists, Angle investors, Govt. policy makers, Scientists and Technocrats to discuss innovations, especially aimed at the bottom of the pyramid, with regards to funding and further technology development possibilities.
  • Provide a unique platform to grass-root innovators to showcase their innovations to masses and directly tap into market and potential customers.
  • Ensure that the deserving innovations are taken up by leading industrial houses for further development and commercialization.
  • Showcase capability of Indians to 'innovate under constrains'.
  • Promote, gather and felicitate 'out-of-box' ideas from masses
  • Generate new scientific ideas and concepts relevant for the common people
  • Sensitize, encourage & initiate the process of innovative thinking amongst common people



Submit Your Idea athttp://ii.unipune.ac.in/site/join?0%5BshowRegForm%5D=0


Thursday, October 3, 2013

[TC] Circuit for Over-Voltage Protection

Over-voltage protection circuits are used to protect voltage-sensitive loads. Voltage transients may occur due to a number of reasons such as transformer switching, load switching, and short/open circuit in rectifier and regulator circuit. Such transients can affect proper functioning of an electronic circuit or even damage it. Hence it is necessary to use an over-voltage protection circuit to protect expensive loads against all the sources of voltage transients.



In electronics engineering, where over-voltage protection experiment is included in the syllabus, the present circuit can be used to very effectively demonstrate the effect to students.

Circuit and working


Fig. 1 shows the demo circuit for over-voltage protection. It is built around a rectifier comprising four 1N4007 diodes (D1 through D4), 10V voltage regulator IC 7810 (IC1), SCR 2P4M (SCR1), transistor BC548 (T1) and a few other components. SCR1 is used as a protective component. 

Fig. 1: Demo circuit for over-voltage protection

If voltage exceeds beyond the withstanding voltage capacity of the device that needs to be protected (6V bulb here), the circuit disconnects the device from supply. To demonstrate this, potmeter VR1 connected across regulator IC1 is used to increase the voltage at the output of regulator IC1. When the output voltage of IC1 increases, voltage at the base of transistor T1 also increases, which triggers SCR1 through resistor R6. Once SCR1 triggers, fuse blows and disconnects the power supply from the device.



For demo, set VR1 at the maximum limit (say, 1k) and switch on the circuit. Using a digital multimeter, measure the output at CON3. It should be around 10.3 V. Now reduce VR1 resistance in steps. At around 800 Ω, the multimeter reads 10.9 V. Reduce the resistance further until SCR1 fires. Experimentally, it was found that at around 680 Ω, the SCR turns on after receiving a triggering pulse and a heavy current passes through the fuse wire. Due to this, the fuse wire blows and the load disconnects from the supply.


Construction and testing


An actual-size, single-side PCB of the demo circuit for over-voltage protection is shown in Fig. 2 and its component layout in Fig. 3. After assembling the circuit on PCB, enclose it in a suitable box.




Fig. 2: An actual-size, single-side PCB of the demo circuit for over-voltage
protection



Fig. 3: Component layout for the PCB
Download: http://www.electronicsforu.com/electronicsforu/circuitarchives/my_documents/my_files/C24_overvoltage.zip


To test the circuit for proper functioning, switch on S1 and measure the input voltage (230V AC) between TP2 and TP3. Also verify the output of IC1 as 10 V at TP1 with respect to TP0. Check voltage variation at the base of transistor T1 corresponding to change in the resistance value of VR1.  


Source : http://electronicsforu.com/
Authors : Milind M. Sutar, Dr J.L. Bhosale and Prof. P.B. Joshi  

Thursday, September 26, 2013

[TC] Ascent Engineering Mastermind Contest







Ascent is India's most widely circulated and read recruitment supplement. It is focused on Career Development, Human Resource Development, Employment and Job Opportunities. The supplement has 23 national editions, nearly 75 lakh+ readers, over 400+ companies advertising nearly 5000+ jobs every week. All the jobs published in the supplement are also posted online on www.itsmyascent.com.

Ascent Engineering Mastermind is India's biggest Inter Corporate Quiz for engineers which intends to bring together the brightest engineering minds in the country competing in a battle of wits. Teams of 2 participants each would be competing in the zonal rounds in Delhi, Mumbai, Bangalore and Pune and winning teams would be challenged in the finals in Mumbai.

[TC] DIY Auto-Balancing Surface using Servo Motors

Using a touch screen, these DIYers built an self balancing surface which automatically tilts itself based upon the position of any object placed upon it.  In the video demo, the surface automatically adjusts to the ball, keeping it directly the the center of the screen, reacting quickly when the object is manipulated.
As you can see in the video, the screen outputs data which is sent back to the servos which adjust their axis accordingly.
We carry many servos in varying speeds and sizes in Hack-n-mod store.


This demo shows a Ball and Plate demo done by Francesco Prosperi at the Retis Lab of the Scuola Superiore S. Anna in Pisa.

The demo uses the Flex boards hosting a Microchip dsPIC DSC that pilots two servomotors. The ball position is taken by using a touchscreen!

Updated Apr 2010 - we released a new version of the Ball & Plate available for purchase! Just check
http://www.evidence.eu.com/products/a...
The new system is completely supported by the Scicoslab Code Generator


Source" http://www.youtube.com/

[TC] Receipt Printer With Raspberry-Pie

In the future, everything will be connected to the internet. 
And all restaurants will be Taco Bell!
nimbus.png
The idea of pervasive connections between physical objects and the online world.
These connected devices don’t just idly sit around waiting for commands or files.
They’re active agents that anticipate your needs and can push 
or pull data from the internet.
Our Internet of Things Printer is a small, internet-connected thermal printer
that can have a daily weather forecast ready before you head out in the morning,
a puzzle to work on while riding the subway, provide a list of “tweets” 
relating to your interests or any other task you can program!
This second version of the printer is built around the Raspberry Pi,
 a tiny computer that packs a wallop:
more processing power, more RAM and the potent Linux operating system.
 The new kit has an easier time handling graphics and looks super tidy 
with its wireless networking:
























Complete Tutorial @ http://learn.adafruit.com/pi-thermal-printer?view=all
Download PDF @ http://learn.adafruit.com/downloads/pdf/pi-thermal-printer.pdf

Piccolo – The ‘Sketching’ Robot

Piccolo

Piccolo can be said as the perfect companion for a graphic designer or an engineer as it helps him to sketch his creativity. Piccolo is a small pocket sized robot which uses servo mechanism for developing and deploying the accurate 2D or 3D output. Like all other robots, this one also works according to CNC technology. CNC is the acronym of Computer Numerical Control. Here the computer converts the design produced by the computer aided design software (CAD) into numbers. These numbers denote different coordinates – that is X, Y and Z in a graph. This technology is employed in a number of places such as the automatic machine cutting, or the drawing tool.  We can sketch a simple drawing or cut a sheet using a laser tip by attaching the corresponding tip to this bot. Piccolo will work according to the type of tip attached to it. Another important advantage of Piccolo is its portability. We can carry this cool machine anywhere with us. When compared to other CNC based robots, this one does not cost thousands of dollars but just $70.This device was introduced by the Diatom studio from London with the collaboration of Cheng  Xu and Huaishu Peng  From CoDe Lab.
Piccolo Demonstration Video
 Piccolo is open source – anyone can modify its design. The prototype is simple; it can be assembled quickly and is easy to use. The Piccolo includes Arduino and processing libraries so that we can use Piccolo as we wish like moving automatically or by responding to a sensor. We can engage multiple piccolos to work together so that it could create a larger canvas. In the Piccolo kit we are provided with the facility to create 3D or 2D sketches according to our desire.

Source: http://www.circuitstoday.com/piccolo-the-%E2%80%98sketching%E2%80%99-robot

Monday, September 23, 2013

Tutorial: Making Solar Cell Using 2N3055 Transistor







This video unveils the fact that a silicon diode is quite similar to a solar cell. To prove this, it takes apart a 2N3055 power transistor to produce 1.6 milliwatts. Watch the video for a great tutorial on creating a transistor solar cell.

It's easy to cut open a power transistor like the 2N3055 to expose the NPN silicon material inside to make a solar cell. When exposed to sunlight, or household lights, it conducts electricity. The N-type and P-type materials work like a solar cell. The best way is from the Base to the Collector though from both the Base and Emitter combined and then to the Collector also works well. The voltage and current aren't much but with just a few of them in series you can power a small 1.5 volt calculator.



Source: http://electronicsforu.com/newelectronics/video/detailvideo.asp?id=2077

Tuesday, September 17, 2013

[TC] Finally time for Smart Watches and Wearable Computing

Long ago, in a far off land some of us will remember where the days of a smart watch and wearable computing was a digital giant of a watch that incorporated functions such as a calculator and alarm in a device that obliterated much of your wrist but was a cool gadget to show off to your friends.
Today’s smart watches may not at first glance be that different, yet despite being around for the past decade modern smart watches have so far failed to become mass market.
The most recent launches this month however are likely to increase the adoption of smart watches and be another step towards bringing the world of wearable computing to the masses.
ABI Research has predicted that more than 1.2 million smart watches will be shipped in 2013.
The unveiling by both Sony and Samsung of their own smart watches at the IFA trade show in Berlin this week, both of which will be available before the end of the year, should help speed up adoption of wearable computing on your wrist and allow users to realise the benefits of M2M connected wearable technology.
Samsung’s Galaxy Gear Smart Watch is essentially a smart phone on your wrist since it can not only be used to make calls but can also deliver email and texts and take photos too. It launches next month.
Sony also unveiled its own version of the smart watch and Pebble launched earlier this year but the market is still waiting for Apple’s long-rumoured iwatch. Qualcomm meanwhile also showed off its prototype smart watch Toq this month and Microsoft is reported to be launching its own smart watch for Microsoft Surface in 2014.

Read More at http://www.telecomstechworld.com/blog/?p=147

Wednesday, September 11, 2013

[TC] Test Mains Voltage Wireless

Description.

This circuit can be used to test whether mains voltage is present or not without having electric contact with mains line. The CMOS IC CD4033 is the heart of this circuit. The CD4033 consists of a 5 stage decade Johnson counter and an output decoder for converting the Johnson code to a 7 segment decoded output for driving 7 segment LED display. A 10cm long insulated copper wire connected to the clock pin (pin1) of the IC serves as the sensor. The sensor wire has to be placed in the vicinity of the mains wire to be tested. When there is no voltage in the mains line, no voltage will be induced in the sensor wire and the display will show a random digit. When there is voltage in the mains line, a small voltage will be induced in the sensor wire due to electromagnetic induction and this voltage is sufficient enough to clock the CMOS IC CD4033. Now the display will count from zero to nine and repeat.
Circuit diagram.
Wireless mains voltage tester
Notes.
  • The circuit can be assembled on a Vero board.
  • Use 9V PP3 battery for powering the circuit.
  • Use a 10cm insulated wire as the sensor.
  • The IC must be mounted on a holder.
  • Switch S1 can be a miniature ON/OFF switch.

Friday, August 9, 2013

Infrared Illuminator Made With LEDs

Figure:1

Figure 1 

As infrared LED array came up with technology and state of the art electronic and optical components that will bring us the ultimate in day and night vision efficiency and high power infrared output.
This can be started by calculating how much infrared radiation you will need in order to light your scene that would be the focal range of your camera since details are lost on most security cameras. With the use of Dremel tool or small bench top grinder, grind down one side of the LEDs slightly and then pack them down to a smaller area. The builder used 19 by 13 LEDs for a total of 247 LEDs, to fit into the inside of a halogen work light.
When the LED array is wired, simply run copper wire along the columns to create the parallel wiring connection for each series chain. The power adapter can be plugged into an AC socket just as it was before modification and cut the AC wiring inside the light enclosure and affixed it directly to the AC power adapter. Materials such as dark tinted glass will also work to conceal an LED array.

To see the rest of the project, go to <http://www.lucidscience.com/pro-led array illuminator-1.aspx>

Jet engine sound generator

Description.

This jet engine sound generator circuit is based on the sound generator IC HT2844P from Holtek Semiconductors. This particular IC can make four sounds namely low speed sound of jet engine, high speed sound of jet engine, missile sound and machine gun sound. Each of these sounds can be activated by connecting the pins 12, 13, 14and 15 to ground by using the respective push button switches. Resistor R3 can be used for manually increasing or decreasing the speed.LED D1 gives a visible indication of the sound.
Circuit diagram.

jet-engine-sound-generator
Notes.
  • The circuit can be powered from a 3V battery.
  • Do not give more than 3.3V to the IC.
  • K1 can be a 200mW/8 Ohm speaker.
  • IC1 must be mounted on a holder.

Wednesday, July 31, 2013

[TC] Electronics Engineers Wedding Invitation Card

Next up in the progress towards our ultimate geek wedding are the wedding invitations! Not content with plain old paper invitations my fiancée Mara and I smashed our geeky heads together to come up with a design that keeps with our circuits and swirls theme. We decided to be more literal, by putting actual circuits into our invitations! However, time spent on design, production and cost were a concern. We had to make about 50 invitations to be sent out to our guests.

First I’ll jump right to the end product. What follows is a video of our invitation and a few photos taken during development and production. If you notice something odd about the light show in the video, jump to the end of the post for an explanation.
Front cover
Inside finished card

THE DESIGN

With time and money acting as constraints I kept the design quite simple. The theme of our wedding is ‘Circuits and Swirls’ and Mara was already ahead of me on the invite design. Two sides of the cards had stylish circuit traces running up and down while the opposing sides had swirls. I figured it would be neat if the stylish traces actually terminated to real working parts, in this case twinkling LEDs; something simple to implement while cool. I pulled up Digikey and priced out the cheapest white LEDs, AVR MCU, battery and light sensor (if you are thinking I could have used one of the LEDs as a light sensor, see Lessons Learned). The light sensor consists of a phototransistor biased by the internal pullup resistor in the AVR. Running at a system voltage of 3V also meant resistors in line with the LEDs were not needed, the IO pins would keep more than 20-30 mA flowing out even if the LEDs tried to draw that much.
I crafted the circuit and Eagle and then started the board layout when I ran into my first obstacle. The card design was larger than the allowable work area in the free version of Eagle. Well, since I was going to be panelizing and ‘printing’ these boards, I had an idea. I laid the design out in the confined space in Eagle, then exported the design as an image. I took that image into Photoshop and extended two of the ends into the final positions. I also used Photoshop to panelize the design onto 8.5″x11″ sheets. I was able to fit 9 designs on one sheet.
Simple design
Board layout before Photoshop stretching
Early revision
Panelized design
How many do I have to make again?
I had to come up with a way to program the AVRs once they were attached. I added a programming ’port’ to the design consisting of pads off to the side of the controller.  I built a crude jig that used pogo pins to contact the pads and connected to an AVR programmer. After the program was flashed and verified the port could be cut off.
Programming a card
Building the programming jig

THEORY OF OPERATION

The idea was to use the light sensor to detect when the card was opened. We toyed with the ideas of buttons and other ways to activate the card, but ended up settling with the light sensor. It’s assumed the recipients will be opening up the card in a moderately well-lit area so they can read it. The sensor is calibrated to trigger with those lighting conditions.
The cheapest AVR that still supports the C compiler I could find is the ATtiny13A. 1K of Flash and 64 bytes of memory was plenty just to flash some LEDs. To keep the design simple, there’s no hard off switch. Once the battery is attached to the card the AVR will always have power; so it had to be able to sleep to conserve energy.
When the controller is first powered it samples the light sensor. That sample is used as the threshold for activation from that point on; so final battery assembly had to be in the lighting conditions we wanted the cards to activate. Too dark and they would be triggered by the sun through the envelope, too bright and they wouldn’t come on when people opened them. It took a few tries of experimentation to find a good level of lighting. From then on all we had to do was solder the batteries to all the cards under those lighting conditions.
After the first calibration the programming enters a simple loop; check light, if above threshold play the light show; if not go to sleep. The light show is a set of fade values created by the ‘sparkle’ function in Vixen and saved to programming space. I used the same python script I created for the wishing wellto convert the values. A simple software PWM routine handles fading the LEDs.
Sleeping the AVR ended up being a trick and a half. I ran into a few issues you will see in Lessons Learned. However I was able to get it to work.  The AVR will deep sleep for 2-3 seconds before the Watchdog timer generates an interrupt to wake-up the core, test the sensor and then go back to sleep. While the card is ‘On’ it will drain the battery in less than an hour, the card ‘sleeping’ will last about a month.

BUILDING PCB

While I am a passionate at home engineer, I must admit I’ve never etched my own boards before; I’m too spoiled by inexpensive PCB services. So for this project I had to learn quickly. I read about a few people using Xerox solid ink printers to print mask directly onto copper-clad kapton tape and picked up one of the printers for $70 on eBay. I also purchased five 24″ x 18″ sheets of the copper clad kapton for $65 there as well. I cut each sheet into four 8.5″ x 11″ sheets to feed through the Xerox printer.
Copper clad in the paper tray
Next I had to build an etch tank. With speed and cheapness in mind, I went to the local pet store and bought a small specimen tank, air pump and air stone for $15 total. To heat the ferric chloride I soldered wires to a power resistor and epoxied the terminals to make them liquid tight. I then epoxied the air stone and resistor to the inside of the specimen tank.
Etch tank mark 1
To hold the boards during etching I cut out a frame from HDPE plastic. The design allows fluid propelled by the air stone to flow around the center from front to back and top to bottom. I attached the copper clad kapton strips to the holder by double stick tape.
Attached strip to holder
Heading into the tank
Etching
Putting about 20 watts into the power resistor brought the ferric chloride up to 100°F, and with the air pump circulating the fluid I could etch 4 boards in 25 minutes. A quick dip in a water tub stopped the etching and a cleaning with a Brillo pad removed the solder mask.
Cleaning off the etch resist
Before and after
After allowing the boards to dry I cleaned all the pads with a flux pen (a very important step) and tinned each pad with my soldering iron. With 5 boards taped down to keep them secure I carefully soldered down each part, testing progressively as I went; except for the battery. I could finish and test about 5 boards every 30 minutes.
Assembly line
Fluxing
Soldering the parts on
AVRs go on next
Done

FINISHING THE CARDS

I handed over the circuits to Mara after they were populated so she could finish the cards. I bought her a new toy for Christmas, a Silhouette Cameo paper cutter. She put the new tool to good use on this project. The plan was to sandwich the kapton strip circuit between the forward facing card and the outer card stock cover. Mara had planned to cut the holes in the front card for the various components to pass through by hand. Instead she used the Silhouette’s precision homing features to cut the holes for us, two cards at a time; much faster than if we did it by hand.
Automated cut out holes, major timesaver
PCB attached to top card
She also designed the card cover artwork and cut it out with the Silhouette.
Cover artwork
Finishing touches
Finishing touches
Finally the battery was soldered on last just before getting mailing.
Installing batteries
Almost finished
Finished

LESSONS LEARNED

  • Print using Transparency mode
I learned after a couple of bad prints on the Xerox that you have to use “Transparency” as the paper type in order for the ink to adhere to the copper clad kapton. Anything else produces random results. I also haven’t figured how to clean off the ink from failed prints and reuse the copper clad kapton; the ink never adheres again.
I also learned these printers will EAT ink every time they are power cycled. I had an issues where it started to refuse to print due to low ink but it was just a blockage problem. While finding and fixing the problem I wasted a lot of ink due to power cycling.
Impressive, but not easy to fix
  • Seal the power resistor
After etching 60% of the boards my heating power resistor failed open circuit. When I drained the tank and removed the resistor I couldn’t find any damage. I did notice ferric chloride slowly leaking from around the two ceramic halves of the outer body. I can only conclude ferric chloride got into the resistor and ate away at the wire. I replaced the resistor with another one but this time epoxied around where the two halves meet to completely seal the resistor.
  • Etching lessons
Etching my own copper was new to me and I had a few growing pains as a result. First lesson is that you need to watch your temperature like a hawk. I etched on my patio and the tank was exposed to the elements. Changing Florida weather threw a curve ball that I didn’t see coming. While it took 30 watts to maintain 100°F one day it raised the temperature to 130°F the next. The not so obvious to me at the time factor of course was the outdoor temperature. The spike in temperature caused the solder mask to melt away and turned the ferric chloride jet black.
Next lesson was when it was time to switch out for new ferric chloride. I assumed that it would just stop working, that it would not etch any more. Instead I just got progressively worse results; the mask was dissolving  away in random spots while the copper failed to dissolve in others. Changing out the fluid corrected the problems.
Difference between old and new ferric chloride
  • White LEDs are not good light sensors
My initial prototype used the light sensing properties of LEDs to sense light. However I got poor results. Different types of light produced different results and sunlight would activate the card no matter how many layers of card stock covered the card in the envelope.  Research told the story. Different LEDs are sensitive to different wavelengths of light. While red and green LEDs are OK for sensing ambient light, white LEDs respond to UV light. This explained what I observed in my prototype circuit. I changed the design to include a phototransistor to sense the light level. I used the internal pull-up resistor in the AVR to bias the phototransistor which kept the parts count low.
  • Trouble sleeping
I ran into a few issues trying to get the AVR to sleep properly. I wanted to use the watchdog timer to wake the processor out of deep sleep without resetting the core and wiping out the RAM holding the threshold value. I realize I could have used EEPROM to store the threshold and let the timer reset the core but I didn’t want to add more steps to final production (like shorting out an IO pin while resetting the core) to set the threshold value.
I found that the watchdog timer routines in AVRClib assumed you are using the timer to reset the core instead of just generating an interrupt. Just changing the bit that toggles the two modes after the timer is initialized produced strange results. I found deep in the AVR forums someone having similar problems who got it resolved by altering the routines from AVRClib to configure the timer in interrupt mode from the start. That produced reliable results in my case.

DEALING WITH "THE FADE"

Yes, I’m aware I’m a Federal employee myself, so I can’t poke too much fun. But it means I also have learned to deal with rules, no matter how ridiculous they are. Shipping Lithium batteries via USPS became a lot more involved this past year and it took some time researching what those new guidelines mean. Then I had to consider what design changes could be made to follow those guidelines. Let’s start with the legalese:  (and this is just the parts that relate to my case!)
For domestic mailings only, small consumer-type primary lithium cells or batteries (lithium metal or lithium alloy) like those used to power cameras and flashlights are mailable domestically under the following conditions. See 622 or IMM 136 when mailing batteries internationally or to APO, FPO, or DPO destinations.
  1. General. The following restrictions apply to the mailability of all primary lithium (nonrechargeable) cells and batteries:
    1. Each cell must contain no more than 1.0 gram (g) of lithium content per cell.
    2. Each battery must contain no more than 2.0 g aggregate lithium content per battery.
    3. Each cell or battery must meet the requirements of each test in the UN Manual of Tests and Criteria, part III, and subsection 38.3 as referenced in DOT’s hazardous materials regulation at 49 CFR 171.7.
    4. All outer packages must have a complete delivery and return address.
  2. Installed in Equipment. The following additional restrictions apply to the mailing of primary cells or batteries properly installed in the equipment they operate:
    1. The batteries installed in the equipment must be protected from damage and short circuit.
    2. The equipment must be equipped with an effective means of preventing it from being turned on or activated.
    3. The equipment must be cushioned to prevent movement or damage and be contained in a strong enough sealed package to prevent crushing of the package or exposure of the contents during normal handling in the mail.
    4. The mailpiece must not exceed 11 pounds.
Did you catch all of that? Let’s break these down a bit.
  • Each cell must contain no more than 1.0 gram (g) of lithium content per cell.
  • Each battery must contain no more than 2.0 g aggregate lithium content per battery.
Seeing as the battery weighs a little over a gram as a complete package, I’m sure there’s much less actual Lithium than that in the battery.
  • Each cell or battery must meet the requirements of each test in the UN Manual of Tests and Criteria, part III, and subsection 38.3 as referenced in DOT’s hazardous materials regulation at 49 CFR 171.7.
Oh boy. I don’t even want to dive into that document. Since I received the batteries from a well know US distributor via USPS and the same rules under ‘General’ apply to uninstalled batteries I assume they would have confirmed compliance.
  • All outer packages must have a complete delivery and return address.
Easy enough, we were planning to do that anyway.
Next is the section that applies to batteries ‘Installed in Equipment’.
  • The batteries installed in the equipment must be protected from damage and short circuit.
  • The equipment must be cushioned to prevent movement or damage and be contained in a strong enough sealed package to prevent crushing of the package or exposure of the contents during normal handling in the mail.
Alright, things are getting a bit complicated here because the rules are a bit vague. How do you quantify the acceptable level of ‘protection’? Are we talking a steal reinforced box? Or is a thin layer of paper good? Trying to settle somewhere in the middle was the goal. The battery is protected by two layers of thick card stock on both sides when the card is folded up in the envelope. I fell comfortable calling the battery safe from “normal handling” now.
  • The equipment must be equipped with an effective means of preventing it from being turned on or activated.
More grey area. More-so than normal because of the way the card is designed to activate. Is a sleeping microprocessor considered ‘on or activated?’ Or since the card doesn’t ‘activate’ till it senses light can it be called ‘off’ in the mean time? How effective does the ‘effective means’ have to be? The black card stock and an envelope liner effectively keeps the sun from activating the card; so I’ll consider this one satisfied.
  • The mailpiece must not exceed 11 pounds.
Not even close. Well, I think we meet all the regulations.

HIDDEN MESSAGE 

Now, of course I couldn’t leave a few hundred free bytes of flash leftover well enough alone. I decided it would be fun to throw in a hidden Easter Egg of sorts. Once the sparkle effect show is over, the light sensor is sampled again. If the level is below the threshold (if something like a thumb is covering the sensor for instance) than the code starts a different routine; a message is flashed out in Morse code.
I coded a simple routine that adheres to Morse timings and reads out a message saved in program space. What does the message say? Well, I’ll leave that up to you to decode.

SOURCE CODE

Source for the program running on the AVR as well as the board design can be found on Github for download.