Friday, December 19, 2014

LED Pin People



A quick and easy way to make light-up pin people! There are endless possibilities for variations on this basic concept. This method uses magnets to serve two purposes: to hold up the LED + wire pin person and to connect the negative LED leg to the battery.


Materials



-- LED
-- Coin cell battery + case
-- Wire
Any type that is solid core, preferably insulating or w/ insulation. If you do use conductive wire, you can modify the design to incorporate it into the battery switch mechanism.
-- Magnet
Be sure to get a strong magnet that will hold the weight of your pin person + LED. Rare earth/Neodynium are ideal.
-- Safety pin; clip off ~ 1/2 inch of the sharp end
After a variety of methods, this was the one that worked best for me. It is studier than wire, and works perfectly for a backing of the pin.
To make a simple cap for the sharp point, dab some hot glue onto the wire person or use pliers to re-use the cover on the original safety pin.

 
Tools 

-- Wire clippers
-- Hot glue gun
-- Soldering iron
This was only used for the safety pin + positive battery connection. If unavailable, can use hot glue to hold the safety pin in place but be sure to maintain electrical connectivity.
-- Optional: Multimeter

 Build it! Pt. 1: Make the Wire Person


1.Cut about 1 ft of wire
2. Make a loop in the middle of the wire and twist for ~ 1 inch.
3. Shape the arms and hands; make a loop ~ 1 inch beyond the torso and twist wires together. Wrap once around the body, then make the other arm and hand.


 


4. Shape the legs + feet in the same way as the arms but make them slightly longer.
5. Position the wire person into desired motion; running, rock climbing, walking a dog, etc.


Pt. 2: Battery Backing 
 
1. Solder the clipped safety pin end to the positive battery clip lead.
If soldering iron isn't available, use hot glue to secure the safety pin end in place.
2. Place the magnet so that it touches the negative battery clip lead. Hot glue it in place.
You may need to bend the battery lead into the magnet a bit.
3. Check connections by touching the LED to the magnet + safety pin.
The longer LED leg is the positive side.




















Pt. 3: Attach the LED.

1. Determine where you want to place the LED.
Maybe your pin person has accessories, like a flashlight, and it would make sense for the LED to go there. Cool! Go for it.
2. Mark the negative side of the LED with a sharpie.
3. Twist the LED legs onto the pin person, leaving ~ 1/4 in of each leg sticking out.
Be sure that the LED legs are insulated (aka not touching).





 4. Using the battery clip, orient the LED legs so that the negative leg connects with the magnet and the positive leg rests on the safety pin.
















Done!
That's it! Super simple and tons of possible extensions with all the random stuff you can find around the house. Happy building!




Wednesday, November 26, 2014

Simple LED earrings


Wearables are an awesome, relatively new extension of circuits. Conductive threads & fabrics make it easy to attach components like LEDs and sensors to clothing/accessories. Plus, they are a super fun introduction to electronics!
These LED earrings were designed b/c I wanted a wearable that was simple, unique, and could be built by-hand w/ available materials. Purchasing all materials adds up to less than $10, and these can be built in ~ 1 hour (although it does take some patience).
For this tutorial I'm assuming you are an electronics beginner. Regardless of your background, I hope this project inspires you to design your own wearable technology or take the basic concepts to the next level :)

-----------------------------------------------------------------------------------------------------

Step 1: Materials




-- 2 LEDs
Fun fact: LEDs on the higher end of the rainbow (red, orange, & yellow) use less power than colors on the lower end (purple, blue, & green).
-- 2 Lithium coin cell batteries, 3 V
Mine are non-rechargeable and will probably last for ~20 hours. If you want to make them to last longer, use rechargeable batteries (super expensive but worth it if you want to wear the earrings long-term).
-- Thread
Used to attach the LED to the battery. Alternatively, you can use wire or anything else that conducts.. like magnets!
Also, since conductive thread loops tend to come undone, I hot glued all the knots to hold them together.
-- 2 earring backs
-- 2 clasps
These act as a switch so the LED can be turned off when not in use. I had some necklace clasps on hand which worked perfectly, but there are tons of options for switches.. all you need is a way to interrupt the flow of electricity.
--Tape
I used conductive tape, but honestly regular tape works just as well.
-----------------------------------------------------------------------------------------------------

Step 2: Tools



-- Hot glue gun
-- Scissors
-- Needle
Recommended to get a needle w/ a wide eye b/c the conductive thread has a tendency to fray.
-- Optional: wire cutters
Helps w/ cutting the ends of the LEDs.
-----------------------------------------------------------------------------------------------------

Step 3: Build it! Pt 1: Wrap the battery.




Wrap the battery w/ 1.5 - 2 feet of (normal) thread. To make it easier, tape the beginning end of the thread to the back of the battery. Leave at least 6 inches of thread at the end.
When finished wrapping, loop the end of the thread under the band and pull tight. Repeat this a few times, then make a knot. Tape the end/thread band down.
-----------------------------------------------------------------------------------------------------

Step 4: Build it! Pt. 2: Attach earring back.





Loop the 6 in. tail of the the thread band through the hole in the earring back. Use the needle to loop the thread under the band & pull tight, kind of like sewing a button. Repeat at least ten times, or until the thread runs out, then tie a knot.

-----------------------------------------------------------------------------------------------------

Step 5: Build it! Pt. 3: Attach the Positive LED Leg.



Tie 6 inches of conductive thread to the positive (longer) leg of the LED. Loop the conductive thread through the bottom of the battery thread band and pull through, leaving the LED ~ 1/2 inche (in.) below the battery. Pull the conductive thread down, so it is only touching the front cover (positive side) of the battery.
Loop the conductive thread around the battery thread band at least five times, then tie a knot. Hot glue the conductive thread knots w/ the littlest amount of glue to help hold it in place.
-----------------------------------------------------------------------------------------------------

Step 6: Build it! Pt. 4: Attach Clasp.



Attach the clasp (aka switch) to the back of the battery w/ ~ 6 in. conductive thread in the same way the earring back was attached: thread the end of the earring back through the thread band on the battery, above the tape, and pull it tight. Repeat at least five times. Tie a knot and hot glue the thread to hold it in place.

-----------------------------------------------------------------------------------------------------

Step 7: Build it! Pt. 5: Attach Negative LED Leg.



Tie the other end of the clasp/switch to 6 in. conductive thread. Tie the end of the conductive thread to the negative, shorter leg of the LED, leaving ~ 1/2 in. from the bottom of the battery. Hot glue the knots.
Connecting the two ends of the clasps helps w/ finding the right length.. or you could use a ruler :)
Be sure that the LED legs and the respective thread/wires do not touch; otherwise the battery is shorted and the LED won't turn on.
-----------------------------------------------------------------------------------------------------

Step 8: Done! Woo!




That's it! Clean up the mess that is hot glue, snip the ends of the conductive thread and, if you're not going to put them on right away or take photos, unscrew the clasps.
And have fun dazzling your friends and all that good stuff :)
Note: The reason the green one isn't as bright is probably because the battery was quite bit older.

Monday, October 6, 2014

Raspberry Pi Irrigation Controller

Gardening improves health and quality of life, connecting us to our local environment. Plus, you can eat organic fruits and veggies at very little cost. Alas, remembering to water can sometimes take a backseat to our busy lives. Fortunately, home automation is easier than ever with inexpensive and accessible microcontrollers like the Raspberry Pi 2 Model B and Arduino.

This tutorial details the construction process for a remotely controlled solenoid irrigation valve. In other words, a home computer controls the water flow of an outdoor hose spigot, or bib. The materials cost is about $30-40, excluding the Raspberry Pi (RPi). Cheaper parts can be found with patience and creativity.

The design is intended as a simple introduction to building a complete, personalized home irrigation system. It is also intended to encourage simple DIY solutions to everyday problems. Make modifications and upgrades to suit your needs, resources, and skill level. To conserve water, include drip irrigation and a soil moisture sensor.

Note: This project involves high voltage which requires extreme caution. Always check power connections before touching exposed wires.

Materials


-- Raspberry Pi, GPIO Cable, GPIO cable adapter + breadboard

This tutorial assumes the RPi has all GPIO libraries. To install outdoors, the RPi also needs a WiFi adapter and to be accessible by SSH or other remote login.

-- Solenoid Irrigation Valve
This tutorial uses a 24 VAC solenoid for a 3/4" hose spigot.
Some background: there are two main types of solenoids: AC or DC.
  • An AC solenoid valve turns water on when voltage is applied, and turns it off when the power is off. The drawback is that it uses AC voltage, requiring an adapter to convert the wall voltage, 120 VAC, into the 24 VAC voltage needed to trigger the valve. Outdoor Installation likely requires an extension cord.
  • A DC solenoid valve allows for a battery powered system. It can easily be modified to be wireless and powered by renewable energy using a medium solar panel (~10 W). However, most DC irrigation valves are latching solenoids and require switching the valve lead polarity to turn water on and off.
I chose an AC valve for the first prototype because I already had a few parts.. and adequate rechargeable batteries can be expensive.

-- Solid State Relay
The Solid State Relay, or relay, is the intermediary switch between the RPi and the solenoid valve. This tutorial uses a Crouzet Model OAC5-315; its input is 3 - 8 VDC and its output is between 24 - 120 VAC at 1A.

-- N3904 Transistor

-- 4.7 kOhm Resistor

-- PCB Board
Sized to fit the relay, GPIO pins, transistor and resistor.

-- AC Power Adapter (120 VAC to 24 VAC)
Use an extension cord and/or longer leads to install outdoors.

-- 22-gauge stranded wire (insulated), min. 10 feet

-- Waterproof container
I used a leftover project box wrapped with waterproof tape. Cheap/free containers are easy to find; Talenti ice cream containers are an example, and also happen to contain delicious ice cream. With small containers, be sure exposed AC connections are completely covered in epoxy to protect the RPi.

-- Optional: Waterproof connectors, waterproofing tape/lots of duct tape

 

Tools 
-- Soldering Iron, solder, solder sucker

-- Wire Strippers

-- Epoxy
Check that it is safe for outdoor use. Marine-grade epoxy may be best for long-term outdoor installation.

-- Screwdriver

-- Optional (but highly recommended): Multimeter

-- Depending on your system container, a drill might also be useful.



Build It!

Hardware Intro: Solenoid Setup 

1. Add wire leads to the AC power adapter (if there are none); use at least 3-4 ft of wire.
This AC power adapter has screw-type connectors. Recommended to coat these in epoxy.

2. Verify that the solenoid works by connecting the leads to the power adapter.
The valve makes a "clicking" sound when it is turned on.
For thorough testing, repeat with the valve connected to the hose spigot.

3. Optional: Extend solenoid valve leads using the waterproof connectors.
Twist wires together inside the connectors, check the connection (aka continuity), then epoxy the openings.


Remember, never touch exposed wires when power is on. Always double-check power connections.




Hardware Pt. 1




If the schematic makes sense, skip the next three hardware steps (Hardware Pts 1 - 3).

Pay attention to the layout of the PCB pads and use them to make connections simpler and more direct. Plan where components are connected prior to soldering. It may be easier to solder components in a different order.
1. Solder the relay to the PCB board.
The labels on the relay tell you the function of each pin. Here's the datasheet for further reference.
1.a. Solder a wire lead to each relay pin, leaving 6 in. or more for the AC leads. 



2. Solder the RPi GPIO pin 18, 3.3 VDC pin, and ground pin to PCB board pads.

3. Solder the transistor to the PCB board, keeping each of the legs electrically insulated.

4. Solder one end of the resistor to the middle transistor leg (base pin) and the other end to GPIO pin 18.
Any other available GPIO pin works as long as you change the code to correspond to your chosen pin.
For best results, use one 4.7 kOhm resistor and connect as shown in the photo to the left.










Hardware Pt. 2 

1. Connect the RPi ground pin to transistor pin 1, or emitter pin.
Connect from the flat side of the transistor with a wire, the PCB pads, or a combination. For stranded wire, it helps to twist the ends before pushing them through the PCB holes.

2. Connect transistor pin 3, or collector pin, to the negative DC relay pin.

3. Connect the RPi 3.3 VDC pin to the positive DC relay pin. 

















Hardware Pt. 3

1. Connect one valve lead to one AC power source lead.
Twist wires together and coat in solder. AC current alternates directions, so either lead will work for both the valve and AC power source.












2. Connect the remaining valve lead to one of the relay AC output pins.

3. Connect the remaining AC power source lead to the other relay AC output pin.

4. Check all electrical connections with a multimeter.
If available, check continuity. Otherwise, plug in the AC power source and check that there is ~ 24 VAC across the relay AC pins.
A friendly reminder: Never touch exposed AC connections when the power source is plugged in.

5. Coat all exposed AC connections in epoxy, including the relay AC pins.
For safety purposes and to adhere connections.



Software

The software program turns the valve on and off by applying a voltage across the DC terminals of the relay.

1. With that basic principle in mind, here's a simple code to get you started:
#Import the necessary libraries
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM) 


#Setup pin 18 as an output
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT) 


#This function turns the valve on and off in 10 sec. intervals. 
def valve_OnOff(Pin):
    while True:
        GPIO.output(18, GPIO.HIGH)
        print("GPIO HIGH (on), valve should be off") 
        time.sleep(10) #waiting time in seconds
        GPIO.output(18, GPIO.LOW)
        print("GPIO LOW (off), valve should be on")
        time.sleep(10)


valve_OnOff(18)


GPIO.cleanup()

2. Run the code in the terminal window of the RPi using the following:
sudo python FileName.py

3. Run the program before connecting the AC power source.
Use a multimeter to check that the voltage across the DC relay pins fluctuates from ~ 0VDC to ~ 3.3 VDC in ten second intervals.


4. Plug in the AC power source and run the program again. Listen for the solenoid to click on and off.





Waterproofing

1. Double and triple-check all your connections with a multimeter.

2. Coat remaining exposed connections in epoxy
Give yourself a way to remove the RPi + GPIO cable from the rest of the circuit so the RPi can be used for future projects (if so desired). 

3. Place the RPi and PCB board components in a waterproof container.
Find a way to seal the external power cables. The first prototype uses waterproof tape to cushion wires and seal the box. Drilling holes in the box and sealing with epoxy is another quick and easy option.. get creative!

4. Optional: To organize loose wires, twist insulated wires around each other, use zip ties or innovate another method.












Test & Improve!
That's it! Rewrite the program to water your garden as needed. The easiest way is to keep the program as a timer. Change the program to increase the watering time to suit your plant needs and the wait time to >12 hours (>43,200 s).





This system was originally designed to be controlled by a RPi-powered soil moisture sensor. To combine the two projects, copy the valve function into the soil moisture sensor program. Update the valve function to turn on if the soil moisture reading is below a certain threshold. Follow the hardware setup as outlined in the soil moisture sensor tutorial. Connect components to the existing PCB board if there is enough space, otherwise get another PCB board for the soil moisture sensing circuit.

Now that you understand the fundamentals, customize and upgrade the system to suit your own needs! Possible extensions include monitoring and/or controlling the system with your phone, or using renewable energy technology for power (e.g. photovoltaics + battery).
Creative Commons License
This work by Jennifer Fox is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License