Sensor Controlled Relay Power Strip

by Amy Lemaire in Teachers > University+

188 Views, 1 Favorites, 0 Comments

Sensor Controlled Relay Power Strip

IMG_8191.JPG
IMG_8194.JPG
IMG_8858.JPG

This is an Instructable to walk you through how to make a sensor controlled relay power strip using an IR sensor.

I am an instructor who teaches Plasma Design in the Scientific Glass Technologies program at Salem Community College. One of the challenges has been finding a reliable and affordable transformer to run small plasma displays. Unfortunately, there are not many products on the market, so I decided to make a device which can be used with any transformer to initiate and control the length of time a bulb is turned on. It works great for student displays, especially with tech22's L7020 transformer.

I use this device in my own plasma work, and find it handy to use in exhibitions. The device is designed to minimize the risk of injury or the glass being damaged, uses less power, and extends the life of the transformer. By waving their hand in front of the sensor, viewers can initiate the illumination of a plasma bulb without touching the device itself, retaining the interactive quality that is unique to plasma displays. The timer can be set to customize the output for many different situation, including animating the plasma display.

Although this device was designed for use with plasma displays, the output can be any device that plugs into a standard plug on the power strip. It could be used for many other purposes, including art installations.

I hope you will find it helpful!

___________________________________________________________________

The Sensor Controlled Relay Power Strip was designed to use with transformers for plasma displays in order to achieve the following goals:

-limit the amount of time transformer is on, keeping from overheating and extending the life of the transformer

-for use in exhibition or installation, so that plasma display is only activated by the presence of the viewer and remains off the rest of the time, making for minimal maintenance by the gallery staff, and adding an extra layer of safety, and conserving energy.

-be able to use off-the-shelf transformers (such as Tech22's L7020) to light high pressure plasma designs for short durations of time without overheating.

-to animate multiple plasma displays by changing the code on the microcontroller.

-introduce students to electronics, using sensors and microcontrollers, and coding, by building this device.


___________________________________________________________________

Acknowledgements:

This Instructable was designed for use in the Plasma Design course at Salem Community College as part of the Scientific Glass Technology program and was supported in part by a Teaching Artist Cohort Grant from the Center For Craft in 2023. Many thanks to those who supported, tested, and facilitated the development of this project.


___________________________________________________________________

In the spirit of giving back to the community, This Instructable is protected by a Creative Commons license, through which it is my intent to keep this information accessible and free for educators.



Attribution-NonCommercial-ShareAlike 4.0 International 


This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. If others modify or adapt the material, they must license the modified material under identical terms. 

  • BY: Credit must be given to you, the creator. 
  • NC: Only noncommercial use of your work is permitted. 
  • Noncommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. 
  • SA: Adaptations must be shared under the same terms.


Sensor Controlled Relay Power Strip © 2024 by  Amy Lemaire is licensed under CC BY-NC-SA 4.0 

Supplies

Screen Shot 2024-03-10 at 5.40.37 PM.png
IMG_2400.JPG

Materials:


Wire stripper/cutter

Flathead screwdriver

Hairdryer or heat gun

Computer

Soldering supplies


26 AWG black, red, yellow wire 

https://www.amazon.com/Stranded-Electrical-Flexible-Silicone-Electric/dp/B09Y99PMRM/ref=sr_1_3_sspa?crid=2C0L67ECF87DC&keywords=26+awg+wire&qid=1697693516&s=industrial&sprefix=26+AWG+%2Cindustrial%2C97&sr=1-3-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&psc=1


Heat shrink tubing https://www.amazon.com/gp/product/B0B616ZH42/ref=ppx_yo_dt_b_asin_image_o04_s00?ie=UTF8&th=1


Heat shrink tubing assorted sizes


3’ USB A/micro B data cable ( NOT charging only)

https://www.adafruit.com/product/1197


6” USB A/micro B cable (charging only) https://www.amazon.com/gp/product/B003YKX6WM/ref=ppx_yo_dt_b_asin_title_o05_s01?ie=UTF8&psc=1


Cube plug

https://www.amazon.com/Charger-iPhone-Travel-Adapter-Samsung/dp/B0995MV494/ref=sr_1_8?keywords=cube+plug+USB&qid=1697693599&sr=8-8


IOT Relay Power strip 

https://www.amazon.com/Iot-Relay-Enclosed-High-Power-Raspberry/dp/B00WV7GMA2/ref=asc_df_B00WV7GMA2/?tag=hyprod-20&linkCode=df0&hvadid=216499414469&hvpos=&hvnetw=g&hvrand=3795473169099657155&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9058761&hvtargid=pla-350415022545&psc=1&gclid=Cj0KCQjwhL6pBhDjARIsAGx8D589OZ__UpxqcVhmiHoxtHxsWuF3v2_7XjH9UitWAU2Km-GGtDjW2OcaAiLwEALw_wcB


IR sensor https://www.amazon.com/gp/product/B075FPR2VX/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&th=1


CPX microcontroller

https://www.adafruit.com/product/3333


CPX cover

https://www.amazon.com/Adafruit-Circuit-Playground-Express-Enclosure/dp/B07R53GYW1

Connecting to the Power Strip

Screen Shot 2024-03-10 at 4.31.57 PM.png
Screen Shot 2024-03-10 at 4.32.02 PM.png
Screen Shot 2024-03-10 at 4.32.06 PM.png

Cut 3” pieces of both red and black wire. Using wire stripper, remove ¼” of the plastic from each end of both wires. 


Solder the red wire to Pin A2 on the CPX board. 

Solder the black wire to the Ground Pin located between Pins A1 and A2. 

Cut a 2” piece of heat shrink tubing ans slide it over roth red and black wires. 

Remove screw terminal from the Power Strip Relay. Use small flathead screwdriver to release the screw terminals.

Install red wire in the left terminal (+) and the black wire in the right terminal (-). Shrink the tubing with hairdryer. 


Connecting the Sensor

Screen Shot 2024-03-10 at 4.35.33 PM.png
Screen Shot 2024-03-10 at 4.35.38 PM.png
Screen Shot 2024-03-10 at 4.35.43 PM.png

Cut three pieces of wire 30” long of the following colors: red, black and yellow. (You can choose any length - I like 30" because I can position the sensor near the viewer and hide the rest of the electronics from view)

Solder the yellow wire to Pin A1, black wire to Ground and the red wire to the 3.3V Pin.


Twist the wires together and slide the heat shrink tubing over them. (Do not shrink the tubing yet!)

Trim the wires on the sensor and solder them to the matching color wire. 

Heat shrink each individually, then slide the larger piece of heat shrink tubing over the solder joint and shrink the entire tube with a heat gun or hairdryer. 

Helpful hint: for covering a long length of wire with heat shrink tubing, you can cut shorter segments of heat shrink tubing (I like 6" - 8" lengths) and string them onto the wire. When you shrink them, let each piece overlap slightly onto the previous piece so you have continuous coverage.

Flashing the Microcontroller

Screen Shot 2024-03-12 at 11.53.40 AM.png
Screen Shot 2024-03-12 at 11.53.54 AM.png

Attach the microcontroller to your computer with the USB data cable. 

Open Makecode.adafruit.com

Click on “New Project” module under “My Projects”.

Program defaults to “Block” view. Change to “Javascript” by clicking the “Javascript button in the top center of the screen.

Copy and paste the following code EXACTLY.


forever(function () {

if (pins.A1.analogRead() > 500) {

pins.A2.digitalWrite(true)

pause(180000)

pins.A2.digitalWrite(false)

pause(1000)

}

})



Click “Download” Pink button in the bottom left corner of the screen.


In your finder, locate the CPX device. Drag and drop the downloaded file (will have a .uf2 extension) onto your CPX device to flash the code. When complete, a pop up window will appear, confirming that you can safely disconnect the device. 


Unplug the CPX from the computer.

Pulling It All Together

Push the green screw terminal back into the Power Strip. Connect the 6” USB A/micro B cable to a power cube, and plug into the “Always ON’ plug on the power strip.


Attach the protective cover onto the microcontroller.


Plug a light (turned on) or other testing device into the power strip in one of the two “Normally OFF” plugs. 


Plug in the power strip and turn on the power. 


Wave your hand about a foot in front of the sensor. The light should go on, and then turn off after 3 min. 


Congratulations! You are finished. 

Altering the Code

You can change the duration of the “on” setting by adjusting the pause line in the code. The number in parantheses in measured in miliseconds, where 1000 = 1 sec. Calculate the duration you would like and insert that number into the parentheses. For example, if you want the light to stay on for three minutes when the sensor is activated, use 180000.


1000 milliseconds (ms) = 1 second

1 minute = 60 sec

3 min = 180 sec

180 sec = 180000 ms


The first pause(number) is the duration the device stays ON

The second pause(number) is the rest period (OFF) between sensor triggers, which can be helpful, for example, if you are powering a plasma bulb and want to give the transformer a break between each sensor trigger.


After you change the code, follow the previous instructions to flash the code onto the microcontroller and then reconnect to power supply. (Do not flash the microconttroller while it’s connected to power, and remember to use the USB data cable to connect to your computer. )


More on Altering the Code

Visual Instructions for altering the code on a completed device using a Mac.