micro:bit magic wand (Beginner)

 

While it is a bit tricky for us non-magical humans to levitate objects with our minds, words, or wands, we can use technology to do (basically) the same things!

This project uses two micro:bits, a few small electronic parts, and some everyday objects from around the house to create our very own magical wand.

I went for the Wingardium Leviosa spell, but you can most certainly adapt this project to cast other spells 🙂

Difficulty: Beginner+ (a lil’ bit of experience w/ coding and circuits is helpful)

Read Time: 10 min

Build Time: ~ 2 hrs

Cost: ~ $35

Materials

  • Wand!
    • You can purchase custom wands or make your own! Find a suitable stick and add some flair (or leave it bare!), or get creative and make one out of things you can find around the house!
  • Feather (for floating!)
  • Glove (for hiding the micro:bit wand controller)
  • Aluminum can
  • Small piece of cardboard (~ 2″ x 2″/5cm x 5cm)

What are we doing??

One of my favorite scenes from the first Harry Potter book was when, after all of the other students are struggling, Hermoine makes a feather float with the spell Wingardium Leviosa. This simple spell captures the essence of why we love magic: that literally at the flick of our wrist and a few choice words, we can instantly make surprising (and impressive) things happen.

Although we don’t have exactly that kind of magic, we do have technology that sometimes seems miraculous. So that sort of counts!

By now you’ve probably guessed: To mimic my fav scene, I wanted to levitate a feather. For that, we can use the power of wind! For this beginner-friendly tutorial, I chose to use a small 5V DC motor with fan blades made from an aluminum can. You can imitate my design or, better yet, create your own!

This tutorial will show you how to do the following:

1. Write a simple block-based code for a micro:bit wand controller

2. Build a circuit to control a small, 5V DC motor

3. Write a simple block-based code for a magical receiver that is triggered with a radio signal (aka bluetooth)

4. Build a setup to make our tech really look like magic!

 

Code it: Wand Controller!

Let’s start with our magic wand!

Since this is a beginner-friendly project, we are using block-based coding on the Make Code website. If you have more experience w/ coding you can also program the micro:bit using micropython or C++ in your fav coding environment (e.g. Idle, Visual Studio Code, etc.).

Alright, let’s get blockin’!

Step 1: In the On Start block, set the Radio Group number. 

Pick a number you love and will remember, since we’ll also need this for the receiver.

Step 2: Decide how you want your wand to trigger action.

The micro:bit has an accelerometer which measures changes in acceleration in our three spatial dimensions: up/down, left/right, and forwards/backwards.

Quick solution: Use the “on shake” block! (Code 1, above photo)

More complex, gesture-based solution: Explore how the accelerometer works and observe the output as you make gestures (open the Arduino IDE Serial Monitor to see the output, if you need help with this check out this tutorial). Use your observations to set triggers. (Code 2 in the above photo)

The example in Code 2 is my attempt at a Wingardium Leviosa gesture: swish-and-flick! (down and left) Use it as-is or as a starting point for your own fav magical gesture!

Helpful Tips:

(1) Since microcontrollers process information super quickly, the pause block gives us time to finish the first part of the gesture before the micro:bit checks for the second part.

(2) I added axes labels on the micro:bit so I could more easily figure out how to get the right motion for Wingardium Leviosa spell — definitely recommend this!

Step 3: Use the gesture to send a radio number.

The “radio send number” block is found in the “radio” block set. Any (rational, real, non-infinite) number will work!

Step 4: Download and save the code onto the micro:bit!

The micro:bit power lights will flash as this is happening, when they are done flashing the code is finished uploading.

Build it: Magical Receiver!

Grab your second micro:bit, your breadboard, and all the fun electronic parts and pieces!

Step 1: Insert your MOSFET transistor into the breadboard.

Recommended to have the black part of the transistor facing you so that pin references in these instructions are accurate 🙂

Step 2: Grab one of your pin-ended alligator clips and connect it from micro:bit pin P0 to an open row in the breadboard.

Step 3: Connect your resistor between the micro:bit P0 wire and the MOSFET Gate pin (leftmost pin).

Step 4: Connect a pin-ended alligator clip between micro:bit GND pin and the MOSFET source pin (rightmost pin).

Step 5: Using your two remaining pin-ended alligator clips, connect the motor leads to two open rows in the breadboard.

Step 6: Connect your jumper wire from one of the motor wires to the MOSFET drain pin (middle pin).

Step 7: Connect your diode across the motor terminals so that the negative side (w/ the stripe) connects to the remaining motor wire (yellow wire in photo).

Step 8: Connect the negative (black) battery lead to the MOSFET source pin (same row as micro:bit GND).

Step 9: Connect the positive (red) battery lead to the remaining motor wire (yellow wire).

Code it: Magical Receiver!

Step 1: Set Radio Group to be the same as for the Wand Controller.

Step 2: Pull out a “on radio received” block and set it to “receivedNumber”.

Step 3: Drag a repeat block into the “on radio received” block and switch it to repeat 2 – 3 times.

Step 4: (Optional but recommended) Show an icon on the micro:bit to let you know if it received the string.

This is super duper helpful for debugging.

Step 5: Turn on Digital Pin 0! (aka “digital write pin P0” to 1)

This block is found under the “Pins” block under the Advanced tab.

Step 6: Pause for a few seconds.

I chose 4 seconds, you can keep this or adjust as desired.

Step 7: Turn off Digital Pin 0 (“digital write pin P0” to 0) and the micro:bit display.

Step 8 (Optional but recommended): Add a back-up trigger using micro:bit button A for testing and debugging purposes 🙂

Voila! Download the code onto your Magical Receiver micro:bit and we’re ready for the magical prop!

Let’s make wind!

Let’s make a wind generator!! AKA a fan 🙂 Turn on a hot glue gun and grab your scissors, permanent marker, aluminum can, and some cardboard.

Step 1: Carefully cut out a rectangle of aluminum from an empty can and a small circle of cardboard about 1/2″ (1 cm) in diameter.

 

Step 2: Print out the paper fan template above at 50% to scale. Cut out one of the fan blades and trace it five (5) times onto the aluminum foil.

Step 3: Carefully cut out the aluminum fan blades and glue onto the cardboard circle at equal intervals.

Step 4: Glue the motor mount onto a piece of cardboard (I also added “legs’ made of wooden dowels to make it easier to connect the alligator clips).

Other options:

  • Use the motor drive shaft to spin objects or make some gears/levers to move things in different directions
  • If you connect micro:bit to speakers, it can also play sounds!
  • Start with something simple and play around to find something that makes you feel magical.

Test all the things!

And now, for our favorite part: testing!! Power up your micro:bits (and connect the battery) and move your wand controller (or use the quick button trigger) to test that our magical receiver moves the motor.

When you are done testing, coat the magical receiver connections in hot glue to hold them in place. If you want an ultra-permanent solution, use epoxy (waterproof is a nice bonus feature). Be careful to avoid getting glue (and especially epoxy) on your micro:bits so that you can still use them for future projects!

Note: When you first power everything up, the motor may start spinning without a signal. Trigger the wand controller and it should stop, then behave as expected.

Not working as expected?

Debugging is an almost inevitable part of building things, so congratulations! You are officially a maker! Here are some debugging tips:

1. Power is the most common issue for makers of all experience levels. Double check that the battery is properly connected and both the micro:bit power lights are on (those little yellow lights by the microUSB port).

2. Motor not moving? Be sure none of the wires or other objects are in the way.

3. Motor pulling the feather towards it rather than away? Swap the orientation of the motor leads. This will cause the motor to spin in the opposite direction and thus the air will be pushed in the opposite direction.

Make all the magic!

We’re basically wizards now! Use gloves to hide and hold the micro:bit wand controller and battery pack. Hide your magical receiver in a fantastical container to really impress all the people. I snagged a hollow book stack, cut a hole in the top, and glued my motor with the fan inside.

That’s it! Practice your spell and impress your friends with your new-found powers.

Questions, comments, creations? Leave a comment! Happy making, you magical beings!

(Quick & Easy) Micro:Bit Magic 8 Ball Costume

90s kids unite! And build this super fun, easy, and interactive costume!

Ask a (yes/no) question, shake the Micro:Bit, and it displays a fortune (obviously accurate) to your deepest most pressing questions, like what is life, how do we solve climate change, and why are pineapples so difficult to cut open. Except you’ll do a better job with phrasing your questions as yes/no 🙂

Anyway….

Here we go!

Read Time: 7 min.

Build Time: < 30 min.

Project Cost: $15 – $20

Materials

  • Micro:Bit 
  • 2xAAA Battery Case
  • 2 AAA Batteries (plus some extras if you plan to wear the costume for more than 3 hours)

… Seriously, that’s it!

Oh, and to make it all aesthetically pleasing and on point:

  • Cardboard (like a 4″ x 4″ square)
  • Blue Paint

Step 1: Program the Micro:Bit!

Step 1: Go to www.MakeCode.org and open a new Micro:Bit project.

Step 2: Write a program to display randomly generated messages of your choosing!

Need more info? Here’s a more detailed overview 🙂

Go to Variables and create a unique variable for each message you want to send (e.g. msg1msg2, …msg42, etc).

Go to Inputs and drag out the On shake block. In On shake, add “set item to” from Variables, then go to the Math blocks and connect the “pick random 0 to..Change the random number range (i.e. the 2nd number) to reflect the total number of messages you are showing (e.g. if you have 5 messages, the random number range is 0 to 4 because there are 5 possible numbers: 0, 1, 2, 3, 4).

Almost done! Add an “If – Then” from Loops. In the first if, set the condition to: item = 0, then display the first message (“show string” block w/ the variable name for your first message (e.g. msg1)). Recommended to repeat the message at least once ’cause scrolling letters can be hard to read! Repeat the if statement condition for each random number and message, and viola, c’est fini! You can test the code in the simulation on the left side of the screen by clicking the Play button and then Shake (:

When you’re ready, download the code, plug in your Micro:Bit, and then drag the (.hex) file onto the Micro:Bit drive. The code is loaded when the power lights are done flashing!

Step 2: Optional Triangle Cover

Step 1: Make a cardboard triangle & paint it blue!

For most accurate imitation, go for an equilateral triangle (geometry for the win, woot woot!).

Step 2: Cut a 1 in. x 1 in. (2.5 cm x 2.5 cm) hole in the center for Micro:Bit LEDs.

Step 3: Attach Micro:Bit on back of triangle w/ glue or tape.

If using hot glue, avoid the battery and USB connector.

Step 4: Wear it & Share it, pretty bby!

Attach the Micro:Bit (& cardboard combo) to yourself or your clothes! You can use velcro, tape, or hot glue (although probably avoid using this one on your actual skin..) Or make straps w/ string, twine, fabric, etc!

Put on your favorite black outfit & you’re done! Quick & awesome & comfy Halloween costume for the winnnn 😀

Feel free to ask any questions in the comments section. If you build this or a variation, please share your creations, I’d love to see what you make!!

Make a Minecraft Gesture Controller!

Move your body to play Minecraft! What!! Yes. Check the video for a demo 🙂

This tutorial will show you how to make your very own gesture game controller for Minecraft (or your other fav. computer game). Move your hand(s) to walk/run/jump, look around, and attack* all the things!

Let’s get started! Grab yourself a Circuit Playground Expresssnag my program code, and get shakin’ to play Minecraft in (srsly) the most fun way ever! 😀

Read time: 20 min

Build Time: ~ 2 hours

Cost: ~$30

*It is a biiiiit tricky to attack moving things (like monsters), so be careful in survival mode! Or use this to challenge your skills 🙂

Materials

Tools

  • Sewing Needle
  • Scissors
  • and a lil’ patience.. 🙂

 

Build the Glove Controller!

You can make the gesture controller without the glove, but the glove controller makes it easier to play, keeps the CPX in the same orientation (very important), and means you can use your fingers as added controls!

1. Cut rectangles of conductive fabric for the finger pads (~ 0.5 in. x 1 in.).

2. Use regular thread to sew the conductive fabric pads onto each of the glove fingers.

Suggested to use a highlighter or other pen to avoid sewing the two sides of the glove together (learn from my mistakes bbies).

3. Attach CPX to the glove with velcro squares.

4. Use an alligator clip or insulated wire to connect the CPX ground (“GND”) to the thumb pad.

5. Stitch conductive thread from the CPX capacitive touch pads (A1, A2, A3 & A4) to each of the four fingers.

6. If you have a multimeter, check continuity between the CPX pins and the conductive thread pads.

Plan out your controller!

 

First! What do we need to do to control Minecraft (or another awesome game)?

This is a super helpful & fun lesson in Design Thinking, but you can skip this if you want to just use my controls. You can always come back here later if you want to make changes later 😀

1. Determine (crucial) game controls.

Note: Start simple! Figure out the most important controls for the game and start there. You can always add more later.

Here are the controls that I wanted to use while playing Minecraft.. in creative mode 🙂 (you can use the same ones or customize your own controller!):

Movement:

  • Walk forward: W key
  • Run: Ctrl + W
  • Jump: Space bar
  • Look Left & Right: Mouse rotate
  • Walk backward: S key

Actions:

  • Attack: Mouse Left Click
  • Place Block/Push/Open: Mouse Right Click
  • Inventory: E key
  • Escape: ESC key

2. Decide how you want to use gestures and/or the finger pads to trigger these controls. Recommended to sketch out your plan.

Here is my design thought process:

I’ve always wanted to feel like I was actually *in* a game, so I went the “cheap VR” route and used gestures to control basic movements. For walking, I went the “let’s move my arms like I’m walking” route, which easily transitioned into running and jumping by increasing the speed of motion.

To make it easy to place a block or exchange items, I decided to use an “awkward handshake” motion.

Turning was a bit of a challenge, but my goal was to be able to look around by moving my hands in the direction I wanted to look.

Attack became the pointer finger pad, inventory the middle finger pad (which I ended up removing), Escape the ring finger pad, and the pinky finger pad to let me to walk backwards.

Again, you can keep these same controls or design your own 😀

Let’s get programming: Set up the CPX!

1. If you’re using Windows, download the Adafruit Windows Drivers here.

2. Download & save the latest CPX Circuit Python UF2 file.

3. Plug in the CPX with a USB cable (make sure it has data transfer capabilities).

4. Double-click the reset button on the CPX.

The LEDs should turn green. If they are red, it means something is wrong with data transfer to the CPX — check the USB cable, try another USB port on your computer, or try the trusty “unplug and plug back in” method.

5. On your computer, you will see a new disk drive called “CPLAYBOOT”.

6. Drag the CPX Circuit Python UF2 file onto the disk drive.

7. The “CPLAYBOOT” drive will disappear and be replaced with “CIRCUITPY”.

 

Add all the libraries!

Libraries let us access all sorts of special functions for the CPX without having to do a ton of programming.. hooray for open-source! This install will download most of the standard Circuit Python libraries* so peruse them at your leisure to learn about more cool things you can do!

1. Download and save the Adafruit Circuit Python Library Bundle Release from here.

2. Unzip the folder, open the first folder, and copy the “lib” folder onto the “CIRCUITPY” drive.

*It is unlikely that you’ll run out of space since the CPX comes with at least 2MB of Flash storage. But, if you do end up needing more space, you can revisit the libraries and remove the ones you don’t need. If you mess ’em up, just copy and paste the lib folder again.

 

Writing the Controller Code

The CPX has an on-board compiler, which means you can program it in (pretty much) any language you want! I opted for MicroPython, a version of Python for microcontrollers, ’cause Python is awesome.

Read this step if you want to understand how the program works (definitely suggested) or if you want to modify the code.

Here’s the GitHub repository that has the full code.Download it, drag it to your CPX, and rename the file “Code.py” (here’s the raw code if you want to just copy & paste).

1. To do the things I mentioned in the last step in MicroPython, we need the following libraries:

  • LIS3DH accelerometer

    • This allows us to use motion to trigger various things.
  • Human Interface Device (“HID”) keyboard

    • This library allows us to control the keyboard!
  • HID mouse

    • This library means we can control the mouse!
  • CPX capacitive touch
    • This library lets us use the capacitive touch feature on the CPX, hooray!
  • A couple of other libraries to make our lives easier: timebusio, and board.

2. Configure and initialize the libraries.

Assign variables for the keyboard, mouse, and accelerometer objects. Select a range for the accelerometer.

3. Write short functions for each of the controls.

The motion controls can be tricky. Do some initial testing with the accelerometer by printing the values in a serial monitor (in the source code, go to the __main__ function and uncomment the two debugging lines). This will help you to determine thresholds for walking, running and jumping, looking left and right, and placing objects.

The touch pad triggers are much easier as you are only looking for a capacitive trigger (True/False).

Remember to release all of the keyboard and mouse keys at the end of each function!

Debugging: Seeing what’s up the CPX program

If you’re familiar with Arduino, you’re probably familiar with the Serial Monitor. The CPX has the same feature with a slightly different access point depending on what program you are using.

If you are using Mu it’s super easy: the serial console is built in and will automatically detect your board, yay!.

If you are using Idle or another program, follow these steps:

1. Download PuTTY* here.

2. Go to Windows Device Manager and check the serial port number for the CPX (e.g. COM18) — see Photo below.

If there are multiple serial ports listed, unplug the CPX and plug it back in to see which one disappears then reappears.

3. Open PuTTY and select “Serial”.

4. Enter the serial port number (e.g. COM18) under “Serial line” and the baud rate of 115200 under “Speed”.

5. Click Connect! 

*PuTTY is a free and open-source SSH and telnet connection program.

 

Test & Improve

Load the program onto the CPX by dragging and dropping the python file onto the CIRCUITPY drive, then rename the file as “Code.py”

Like pretty much every project, this one will likely be a little wonky when you first get it running. If the touch pads are acting strange, reset the CPX (this recalibrates the capacitive input pins).

Test 1:

– Open up the serial monitor with PuTTY and run the program (CTRL + D)

– Test each of the movement controls (you’ll see the mouse moving on the screen and make sure the program doesn’t crash as well as the touch pads (which should display relevant text on the serial monitor).

Test 2:

Deploy in Minecraft creative mode! Test the movement and action controls to see if anything breaks or doesn’t work as expected (plz keep in mind that this is a prototype)

Update the program based on your testing. Remember, it’s OK if it’s not perfect, there’s always time to make it better!

 

Have all the fun!!

You’re ready to run through Minecraft!! Just be wary of monsters, it might be a bit tricky to protect yourself..

Supplementing your gesture controller with a keyboard is a good idea if you want play for reals 🙂

Please like and/or leave a comment if you enjoyed the tutorial! And of course, let me know if you have any comments or questions!
Happy Building!

<3, jenfoxbot

Build an (easy) Floor Piano!

The household floor piano is a dream no more! The Makey Makey microcontroller makes it super easy (and affordable) to build your very own “foot-strument” out of common household materials.

Grab a Makey Makey kit, some cardboard, and your musician shoes and let’s get building!

  • Difficulty Level: Easy
  • Estimated Build Time: 60 minutes
  • Cost: $50 (for Makey Makey kit)

 

 

Materials & Tools

Materials

  • Makey Makey Kit
    • 16 Breadboard Jumper Wires
    • 4 Alligator Clips
  • Cardboard
  • Aluminum Foil
  • Plastic Trash Bag (stretchy is best)
  • Duct Tape

Tools

  • Scissors
  • Hot Glue Gun
  • Measuring Tape or Ruler

 

Build the Piano!

1. Build the piano base.

Cut a cardboard base for your keyboard, then divide it into 8 equally sized rectangles — these are the dimensions for your piano keys!

2. Make the piano keys!

Cut out 8 cardboard rectangles using the base dimensions and paint them white.

3. Build the key triggers for the piano.

Cut 16 cardboard rectangles of equal size or smaller than the cardboard piano keys.

Repeat the following for each pair of key triggers:

  • Cover both cardboard rectangles in aluminum foil.

  • Use copper tape to connect one wire to the aluminum foil on each of the key triggers, then cover the connection in duct tape to secure.

  • Cover one of the rectangles with a piece of the plastic trash bag so that the aluminum foil is completely covered. Secure with duct tape.
  • Sandwich the two key triggers together so that the trash bag is a barrier between the aluminum foil.

 

Connect to the Makey Makey!

1. Connect the wires to the Makey Makey – one of the wires goes to ground and the other goes to a keypad (doesn’t matter which wire).

2. Test that the Makey Makey is triggered when you put pressure on the cardboard.

3. Tape the key triggers to the bottom of the white cardboard piano keys. Secure them to the piano base with velcro or glue.

4. Connect one of the wires from each of the key trigger to the six header pins on the back of the Makey Makey board and to two of the arrow keys on the front.

5. Connect the other key trigger wires to the Makey Makey ground.

Recommended to connect the ground wires in two groups of 4, then use one alligator clip per each group of 4.

Write the Scratch Program!

We have 8 inputs, which means we can play an entire octave on our floor piano! (Yes, that was intentional).

Your job: Write a Scratch program that plays 8 successive keys starting at middle C (or wherever you prefer your piano octave to start) using the “play note” function. Or you can copy mine in the photo above 🙂

Aside from the program, just be mindful of what piano key is connected to what Makey Makey pin. It’s easy to get 8 wires a bit mixed up — consider labeling them to save yourself some time (& hair..).

Install & Play!

Consider coating the electrical connections in hot glue. Plug the Makey Makey into your computer, place your floor piano on, well, the floor, and have at it!

Enjoy making beautiful music by stomping on your custom creation.

Micro:Bit Puppet “Text Message” System

Intro

Nearly all of our wireless communication is done using radio waves*, including phone calls, text messages, and WiFi. With its built-in radio transmitters and receivers, the Micro:Bit microcontroller makes it super easy to build all sorts of projects with radio communication.

This particular project is a simple & quick way to send text messages between two Micro:Bit** microcontrollers – the sender writes a (short) message that is transmitted via radio to the receiving Micro:Bit, which shakes a lil’ puppet using a servo motor, and then displays the message on the Micro:Bit LED screen. Each Micro:Bit can be both a sender and receiver.

It’s sort of like a two-person Twitter.. if the tweet notified you via dancing cardboard robot puppet!

*Radio waves are long-wavelength light waves. Check out the electromagnetic spectrum here!

**A huge THANK YOU to Adafruit for donating the Micro:Bit microcontrollers used in this project for educational purposes! yayy thank you for supporting this educational endeavor!! 😀

Materials & Tools

Electronics

Puppet (or other Message Alert System) Materials

Tools

  • Hot Glue Gun
  • Scissors and/or utility knife (e.g. exacto knife)
  • Pencil
  • Ruler or other straightedge

Build the Incoming Message Alert Puppet!

Step 1: Build a cardboard puppet like the one shown in the photo or create your own! Use the paper fasteners to make joints.

Step 2: Build a mounting system to attach the puppet to the servo with skewers and cardboard.

I used a magnet to attach the puppet to the servo mounting system because magnets are awesome, but you can also use glue, tape, velcro, or a variety of other adhesives!

Step 3: Build a stand for the puppet.

  • On an approx. 6 in. x 12 in. cardboard sheet, measure, mark, and cut a hole for the servo body so that the arms of the servo rest against the front of the cardboard sheet.
  • Cut two triangles out of cardboard and glue them on the back of the stand so that the stand, well, stands upright!
  • Cut a hole for the Micro:Bit wires to thread through and add two pushpins on the front to hold the Micro:Bit.

 

 

 

 

 

 

 

Code the Two Micro:Bits!

To start, choose one Micro:Bit to be the sender and the other Micro:Bit to be the receiver. Once both are working as expected, add in the code for both roles.

Use the Make Code Micro:Bit website to program each Micro:Bit. As this is intended as a beginner project, the whole system can be built using the block-based programming language, although adaptations are encouraged and appreciated!

If there is more than one pair of Micro:Bits in the room (i.e. in a classroom setting), remember to set different radio group numbers for each pair.

The sender sends a (short) text based on user inputs over radio, like the example above. Pretty simple!

The receiver moves the servo when an incoming text is received, then scrolls the message text on the LED screen, like in the example below.

Press the reset button to stop sending/receiving the incoming message.

 

Connect the Servo!

Connect the servo red wire to the Micro:Bit 3V power pin, the servo black wire to Micro:Bit ground pin, and the servo white (or yellow) wire to the Micro:Bit input pin P0.

Send all the Messages!

Program both Micro:Bits to be both a sender and a receiver so you can communicate back and forth. Then switch power from the laptop to the battery pack and test out your wireless communication system! When the sender sends a message, the puppet will notify you to check the LED screen so that you can see the incoming message.

How far of a range can you get? Test it out!

There are tons of other extensions to this introductory project, here are some possibilities:

  • Add more message options by adding more inputs or changing how those inputs are read;
  • Instead of a table-top alert system, build a wearable alert system;
  • Send voice messages and/or other sounds.

Happy building!

IoT Industrial Scale!

finalscale2-v2

 

What does a baby elephant weigh?* How much impact force does a jump have?? How can you tell if a rain barrel is full without looking inside??? Answer all these questions and more by building your very own Internet of Things (“IoT”) industrial scale using the SparkFun OpenScale board!

This project is intended for folks with a lil’ bit of background using Arduino or other microcontrollers. But, whether this is your first or 137th project, check out the links in the Suggested Reading section below (and throughout the tutorial) or leave a comment if you have any questions!

Read time: ~ 15 min.

Build time: Approx. 2 – 3 hours

*To weigh a baby elephant, you might need to be a zookeeper or otherwise have an elephant friend.. but you could always weigh Fido and/or kitty!

For all you visual learners, check out a video of the project below:

 

Materials!


To follow along and build your own scale, all the parts used are listed below.

Electronics

To make the system wireless:

All these parts can be found in the wish list here.

Scale and Casing

  • Terminal blocks (5)
  • Three (3) M3 screws per load cell (total of 12)
  • One (1) project case (to protect the electronics)
  • One (1) base board, and one (1) top board (for the scale platform)
    • My base board was ~ 16″ x 16″ and my top board was ~ 12″ x 14″.
    • Both boards should be sturdy and not flex or dent.
  • Wood slats to frame the sides of the top board to hold it in place.
  • Four (4) feet for base

 

But wait! There’s some background reading..


First of all, how do we measure weight??
Strain gauges!

Also called load sensors, strain gauges measure electrical resistance changes in response (and proportional) to, well, strain! Strain is how much an object deforms under an applied force, or pressure (force per area). Check out this super awesome tutorial for more info on how strain gauges work.

Usually what you’ll find in a bathroom scale is a load cell, which combines four strain gauges in a wheatstone bridge. This project uses four disc compression load cells rated at 200 kg.

Here’s some additional background material to learn more about the components and tools used in this project:

  1. Serial Terminal Basics
  2. OpenScale Applications and Hookup Guide
  3. Getting Started with Load Cells
  4. Photon Development Guide

As usual, don’t forget to read the Datasheet for the Load Cells and any other components you with to use in your project.

Build the Electronics! Pt. 1


industrialscale-schematicv2

Connect the Load Cells!

Load cells have four signal wires:

  • Red: Excitation+ (E+) or VCC
  • Black: Excitation- (E-) or ground
  • White: Output+ (O+), Signal+ (S+)+ or Amplifier+ (A+)
  • Green (or blue): Output- (O-), Signal- (S-), or Amplifier (A-)

They also have bare (or yellow) grounding wires to block outside (electromagnetic) noise.

Connect all five load cell wires in parallel to the OpenScale terminal blocks with the corresponding labels. You might need to switch the green and white load cell wires – check this by adding weight to the load cells. If the weight is decreasing, switch the wire orientation.

The OpenScale terminal blocks are a bit cramped with four load cells, so I used the terminal blocks pictured above. If you have a case for the electronics, remember to put the connectors INSIDE the case before connecting them to the load cells (not speaking from experience or anything..).

 

Build the Electronics! Pt. 2


Connect the OpenScale to a data logger!

In addition to printing, reading, and gathering data from the Arduino serial monitor (see “Reading Load Cells!”), we can add a Photon microcontroller to connect to WiFi and upload the measurements to the Internet!

Connect the OpenScale “Serial Out” ground (“GND”) port to the Photon GND, and the OpenScale “TX” port to the Photon “RX” port. If your data logger needs power, connect the OpenScale 5V port to the data logger Vin port. That’s it!

 

Build the Base & Case!


1. Plan out, measure, and mark location of load cells.

Load cells should be at least 1″ in from the top platform board sides and installed equidistant and on the same plane (aka same height) with each other.

Each load cell needs three M3 type screws, which requires fairly precise measurements. I opted for a quick & easy solution: make a plastic stencil that marks the load cell outline and the location of the screw holes. The plastic I used was cut from a discarded strawberry container (yay, free and upcycled!).

2. Drill holes for load cell screws and attach load cells to base board.

3. Attach feet to base.

4. Secure the scale platform.

Place platform on top of the load cells. Attach wood slats to sides of base with wood glue and/or screws to secure the platform in place laterally, but not vertically. AKA, be sure that there is no resistance to the board pushing downward.

Add brackets on opposite sides for a more secure hold.

5. Place electronics into project box container (or tupperware) and drill holes for cables.

6. Admire your handiwork!

 

Connect the OpenScale!


One of the awesome features of the OpenScale program is that it outputs data to the Arduino IDE serial monitor (9600bps). All we need to do is plug in our OpenScale via USB, select the appropriate board (Arduino Uno) and port, and you can read the load cell data directly from the Arduino Serial Monitor. More info on how to do this here.

Enter ‘x’ to bring up the OpenScale settings menu. Entering ‘x’ again leaves the menu and the OpenScale will start printing data!

arduinoserialmonitor-fullmenu2_labeled

We also need to remove the serial trigger from the OpenScale. Do this by going to the menu, inputting ’t’, and turning the serial trigger to OFF.

You can change various other settings on the OpenScale using the serial monitor, including units (lbs/kg), print rate, decimal places, etc. You can adjust, or peruse, the entire OpenScale program by downloading it from GitHub!

Note: If you are connected to another microcontroller, the OpenScale does not send data when in the menu mode.

 

Tare & Calibrate the OpenScale


Tare!

We’ll need to tare the OpenScale each time it is powered up. To tare the scale, remove all weights from the scale and open the OpenScale settings menu. Input ‘1’ in the OpenScale menu, wait for it to finish taring, then exit the menu and check that the output is close to zero (+/- 5 lbs). If the reading is still off, taring again should fix the problem – if not, check that the load cell grounding wires are properly connected to ground.

Calibrate!

We also need to calibrate the OpenScale to get accurate measurements. It’s also recommended to re-calibrate the system every few weeks (or days) to avoid creep (slow change in reading over time).

To calibrate the scale:

  1. Remove all weights (except the platform).
  2. Open the OpenScale menu and select ‘2’ to open the calibration setting.
  3. Place a (known) weight on the scale and adjust the calibration factor using ‘+’ and ‘-’ until the scale reads out the calibration weight within a reasonable margin in error.*

Also, the load cell output varies with temperature (‘cause heat causes expansion), so we need to keep the system at a constant temperature (or use different calibration factors at different temperatures.

*My experimental uncertainty was about +/- 5 lbs.

 

Program the Photon!


Write a program for the Photon that will read in the serial output data from the OpenScale and push it to the IoT platform of your choice. Or you can use/modify my code 🙂

Here’s the GitHub repository for the IoT scale.

This program reads data from the OpenScale and pushes it to ThingSpeak (also prints it to the Photon serial monitor). ThingSpeak is super easy (and free!) to set up, the only downside is that it only allows data to be posted every 15s.

What you need to do to make the program work for your setup:

programcode-whattochange_labeled

  1. Include your WiFi SSID (network name) and your WiFi password in lines 53 & 54, and lines 69 & 70.
  2. Set up a ThingSpeak channel!  thingspeak-channelsetup
    1. Name the channel and write a brief description.
    2. Include at least one field name. If you want to push more data, like temperature or a timestamp, include those corresponding fields.
    3. Save the channel!
  3. Copy the “Channel ID” number and the “Write API Key” and input them into lines 84 & 85.thingspeak-apikeys_labeled

Read through the comments in the program code for more information on how the program works.

 

Test & Refine!


Prototype complete! Have your favorite human or animal stand (or awkwardly lay..) on the scale to check that it works as expected.

Check thoroughly to see if there is anything that needs to be fixed, secured, and/or improved. During my build process I noticed that a lot of the wood I was using to test would get dented by the load cells, resulting in inaccurate readings.

 

Lessons Learned & Next Steps!


My initial goal for this IoT scale was to gather data on the forces due to jumping (specifically in parkour). Alas, the OpenScale is intended for constant loads and the fastest print rate is 505 ms, which is too slow to get accurate readings on impact force.

Fortunately, we can still use the scale to gather general data and use this design as a foundation for future versions. Some quick and well-timed preliminary testing by a professional jumper (~165 lbs) resulted in the readings plotted below:

data-jumptest3

It shows a single jump, where the landing corresponds to the highest reading (~ 230 lbs), and the point just before that (~ 135 lbs) is when his feet were in the air. (The weight decrease + little blip after the the peak is when he was stepping off the scale.)

In addition to an updated program to print data faster, I’ll need waaay more data and a consistent, controlled procedure to determine any kind of reasonable relationship between impact force, jump height, and weight. Also, the top platform was a bit dented after these tests, so I’ll need a sturdier wood, or metal, scale platform.

Overall, this was a cool proof-of-concept and an informative preliminary test! Plus, there are tons of other practical uses for this simple Internet-connected scale!

 

Education Extension & Beyond!


Beyond being a great hands-on project for computer science, engineering, and electronics courses, this is a handy experimentation tool for physics classrooms! Use it to illustrate the difference between weight and mass, demonstrate how acceleration relates to force, or use the on-board temperature sensor to estimate the mathematical relationship between thermal expansion and load cell output.

Other Applications:

  • Use the system to measure the weight of a rain barrel and notify you when it is full.
  • Make a bathroom scale that keeps track of your weight (or your animal’s weight).
  • Monitor the weight of your Halloween candy to be sure that no one is sneaking some from under your nose.

Happy Building!

Interactive Survey Game!

A survey questionnaire come to life! Use (nearly) any object to gather helpful data through an interactive, engaging, and fun multiple-choice survey.

This project uses the Makey Makey microcontroller in combination with a Raspberry Pi computer to read in participants’ survey choices and save the results in a text file.

Planning & Design!

This general design is easily customized to fit a different theme. The only crucial design requirement is to use materials that conduct electricity for the survey pieces, or wrap non-conductive materials in aluminum foil.

Suggestions:
Prototype, prototype, prototype! Build different versions and test them on family, friends, co-workers, or (ideally) your target audience. Observe how folks interact with your survey, then use that to make it better! And always remember to keep it simple 🙂

Materials

Makey Makey Kit
– Computer: Raspberry Pi

– One (1) ground piece, five (5) survey response pieces, one (1) submit piece, and two (2) yes/no pieces*

22 Gauge (stranded) Wire — five (5) 10 – 16″ strips and three (3) 6″ pieces (ends stripped)

– Container:

— Wood Box (12.5″ x 12.5″)
— Plexliglass.(“12 x 12”)
— Three (3) 2″ x 2″ wood panels

* Specific materials used in this design are detailed with the corresponding procedure, although customization is encouraged!

Tools

Safety goggles, woo!
Multimeter
— Optional: Soldering iron, solder& desoldering wick
— Ruler (or calipers)
Drill w/ both drill and driver bits
Flat wood file (to prevent splinters!)
Hot glue gun
— Epoxy (permanent)
– Pliers

Reprogram the Makey Makey

To reprogram the Makey Makey, you’ll need to have the Arduino IDE with Makey Makey drivers installed. Here’s a thorough tutorial on how to do this.


1. Plug Makey Makey into computer and open the Arduino IDE.

2. Open (or copy) Makey Makey source code:
Here’s the GitHub page for the Makey Makey.
Here’s a direct link to download the full program. This is a .zip file, so be sure to extract all the files.

3. Reprogram the “click” key into an “enter” key.
For a thorough overview of how to do this, check out this tutorial.

4. Change the following keys:
These two keys are mapped in the survey program, but can be left as-is or you can choose to switch other keys (e.g. the arrow keys). Just be sure to change the mapping in the program.

A. Change the “g” into an “n”.
B. Change “space” key into “y”.

Build the Survey Response Pieces!

Specific materials used in this design:

– Two (2) wood blocks, two (2) golf balls, and one (1) jar lid.
– Aluminum foil
Unistrut 1/2″ Channel Nut with Spring
– Ten (10) 1/2″ washers
– Plexiglass [or wood] (12″ x 12″)

Procedure:

1. Wrap each of the survey response pieces at least 2 – 3 times with foil, hot gluing each layer.

2. For unistrut spring pieces, hot glue (or epoxy) the top of the spring to the bottom of each survey response piece — be sure that the metal of the spring is touching the foil of the survey piece.

3. Attach the survey pieces to plexiglass.

Determine location of survey response pieces and mark with tape. Drill a hole at each point.

Place a washer on either side of the hold and screw bolt into unistrut spring about 3 turns.

4. Connect a wire to each of the unistrut spring pieces.

Wrap wire around base of bolt (between washer and plexiglass). Hand tighten the bolt to secure wire without squishing it

Build the Ground Piece!

Specific materials used in this design:
– Styrofoam ball
– Metal pipe
– Flange stand for pipe
– Aluminum foil
– Twelve (12) washers
– 4 wood screws
– Wood panel (2″ x 2″)

Procedure

1. Build a stand for the styrofoam ball — use conductive materials or wrap pieces in foil.

2. Wrap styrofoam ball in aluminum foil, leaving a “tail” of foil. Place ball on stand and push the foil tail against the inside of  Hot glue pieces together.

3. Cover the exposed end of the ground wire (24″) to the inside, or bottom, of base and adhere with tape or epoxy.

5. Add a layer of two (2) washers under base to avoid squishing the wire, then connect base to wood pane via screws or epoxy.

Build the Enter Key!

Specific materials used in this design:

– Clothespin
– Wood panel (2″ x 2″)
– One (1) wood screw + one (1) washer

The screw should be about 1/4″ longer than the wood thickness.

– Aluminum foil

Procedure:

1. Wrap one of the handles of the clothespin in foil.

2. Remove clothespin spring clamp, align other side of the clothespin on wood panel, and drill in a screw and washer.

Foil on the other side of the clothespin should make contact with the washer + screw when closed.

3. Reconnect spring clamp and other side (may need pliers). Epoxy bottom of clothespin to wood panel.

4. Use alligator clip or wrap wire around screw and secure with hot glue.

Make the Yes and No Keys! 

Specific materials used in this design:
– Two (2) plastic container lids
– Two (2) wood panels (2″ x 2″)
– Two (2) wood screws and washers

Each screw should be about 1/4″ longer than the wood thickness.

– Aluminum foil


Procedure

1. Cut circle out of container lids. Wrap in foil.

2. Align lids on wood panels and drill in a wood screw with washer on top — be sure the screw slightly pokes through the back of the wood panel.

3. Use alligator clip or wrap wire around screw and secure with hot glue. 

Connect Pieces to Makey Makey

1. Connect ground piece lead to Makey Makey ground pads.

2. Connect survey game pieces to the first five (5) Makey Makey back header pins on the left: “w”, “a”, “s”, “f”, and “d”.

3. Connect the no button to the last (6th) back header pin, “g”

4. Connect the yes button to the “space” pads.

5. Connect the submit piece to the “click” pads.



Load the Survey Program!

Using a Raspberry Pi computer means that all of the electronics can fit into the game box! Write up a program in Python to cycle through a series of survey questions and five possible choices that map to the survey response pieces.

Here’s my code:
GitHub page!
Python program only.

Final Touches & Case!

This case is designed to withstand high traffic, experimentation, and children — and to be easily (and cheaply) fixable and adjustable. Use this design or customize your own!

Materials:
12.5″ x 12.5″ wood box
1″ x 10 ” wood panel

Procedure:
1. Epoxy wood panel onto front of box.

2. Drill the submit, yes, and no keys into the wood panel.


Recommended to put the “submit” button on the far right (switched this after further testing and feedback).

 

3. Drill hole large enough to fit an HDMI port in the back panel of the box.

I used two 3/8″ bits and filed down the hole until the HDMI port fit.

4. Label the survey game pieces and the submit, yes, and no keys.

Test, & Install!

Connect the Raspberry Pi to a monitor, keyboard, and the Makey Makey. Test the program and double check all the keys. Once everything is up and running, remove the keyboard (and mouse if connected).

Load the python program, stand back, and let passersby have a blast participating in a survey!

Hazardous Gas Monitor

Build a portable gas monitor to check for dangerous levels of hazardous gases in your home, community, or on the go and prevent your friends from lighting a cigarette during  a gasoline fight.*

This tutorial shows you how to build a web-connected “canary” monitor for three hazardous gases: Liquid Propane Gas (“LPG”), Methane (aka natural gas), and Carbon Monoxide (“CO”) . Using the Particle Photon microcontroller, the sensor readings are converted into parts-per-million (“PPM”) and uploaded to the data.sparkfun.com web service.

*Please note that this is solely a movie reference — gasoline fights should probably be avoided in real life.


Helpful Background Info!


1. How to set up the Particle Photon.

2. Pushing data to the data.sparkfun.com web server.

3. New to relays? Check out this a handy reference.

4. Here’s a helpful overview on the N-Channel MOSFET.

5. For powering the Photon, here’s a thorough guide on the Photon Battery Shield.

6. Highly recommended to peruse the datasheets for the three gas sensors.


Choosing a Battery!


The gas sensors used in this project require a fair amount of current, about 0.17 A each at 5V. To make the system portable, we’ll need a high capacity battery. One easy, and affordable, option is to use four (rechargeable) AA batteries in series. These batteries will last about 4 hours.

Another option is to use a lithium ion battery (“LIB”). LIBs have a higher capacity than AAs, but typically run at a lower voltage. If you go with this option, you may need to include a correction factor when you calculate the sensor value or boost the battery voltage with a transistor or other component.

The photo above shows a table with the approximate lifetime of a few different battery options.

If all of this sounds confusing, here’s a more thorough tutorial.


Materials!


Here’s a Wish List that includes all the necessary components for this project!

Microcontroller and Accessory Components

Particle Photon microcontroller

SparkFun Photon Battery Shield

– One 2000 mAh Polymer Lithium Ion Battery

Surface Mount DC Barrel Jack

Barrel jack to USB power supply cable

One (1) Lamp Switch

– Optional: Male-to-Female JST connector cable

Gas Sensor Circuit

One (1) Project Case

– One (1) 4 AA battery case

– Four (4) AA Rechargeable Batteries

One (1) Toggle Switch (SPST switch)

Piezo Buzzer

Three (3) Red LEDs

– Three (3) 10 kΩ resistors

One (1) PCB

22 Gauge stranded wire

– Optional: Electrical connectors (3-5)

LPG (MQ6) Gas Sensor

MQ6 LPG Gas Sensor

Gas Sensor Breakout Board

– One (1) 4.7 kΩ resistor

– One (1) 5V Voltage Regulator

Methane (MQ4) Gas Sensor

MQ4 Methane Gas Sensor

Gas Sensor Breakout Board

– One (1) 4.7 kΩ resistor

– One (1) 5V Voltage Regulator

Carbon Monoxide (MQ7) Gas Sensor

MQ7 CO Gas Sensor

Gas Sensor Breakout Board

– One (1) 4.7 kΩ resistor

– One (1) 5V Voltage Regulator

– One (1) 5V SPDT Relay

– One (1) N-Channel MOSFET

– One (1) 10 kΩ potentiometer

– One (1) 10 kΩ resistor


Tools!


– Soldering Iron

– Wire cutters/strippers

– Drill

– Screwdriver

– Epoxy (or hot glue)


Build it! Electronics


1. Solder gas sensor breakout boards to gas sensors. Orientation doesn’t matter, just be sure that the silkscreen (aka labels) are facing down so that you can read them (had to learn that one the hard way..). Solder wires to the gas sensor breakout board.

2. Solder three voltage regulators to the PCB board. For each regulator, connect positive battery output to the regulator input, and connect middle voltage regulator pin to ground.

3. Connect the LPG (MQ6) and Methane (MQ4) sensors.

For each sensor:

  1. Connect H1 and A1 to the output of one of the voltage regulators (recommended to use an electrical connector).
  2. Connect GND to ground.
  3. Connect B1 to Photon analog pin (LPG goes to A0, Methane to A1)
  4. Connect a 4.7 kΩ resistor from B1 to ground.

4. Connect the CO (MQ7) gas sensor.

*Aside: The MQ7 sensor requires cycling the heater voltage (H1) between 1.5V (for 90s) and 5V (for 60s). One way to do this is to use a relay triggered by the Photon (with the aid of a MOSFET and potentiometer) — when the relay is not powered, the voltage across H1 is 5V, and when the relay is powered the voltage across H1 is ~ 1.5V.

  1. Connect GND to ground.
  2. Connect B1 to Photon analog pin (A2). Connect 4.7 kΩ resistor from B1 to ground.
  3. Connect A1 to third voltage regulator output (5V source).
  4. Connect Photon 3.3V pin to positive relay input.
  5. Connect Photon Digital Pin D7 to left MOSFET pin, and a 10 kΩ resistor to ground.
  6. Connect middle MOSFET pin to relay ground pin. Connect right MOSFET pin to ground.
  7. Connect relay Normally Open (“NO”) pin to H1, and the Normally Closed (“NC”) pin to middle potentiometer pin.
  8. Connect right potentiometer pin to ground, and left pin to H1.
  9. Adjust potentiometer resistance until it changes the relay output to ~ 1.5V when the relay receives power.

5. Connect an LED and 10 kΩ resistor to each of the Photon digital pins D0, D1, and D2. Connect buzzer to Photon digital pin D4.


6. Connect toggle switch between battery pack and PCB board power. Recommended to include an electrical connector for the battery pack to make it easier to switch out batteries.


7. Connect lamp switch between LIB and Photon battery shield — recommended to use an extra JST cable for this to keep the LIB battery cable in tact (and make it easier to install the lamp switch).

8. Label wires!


Build a Case!


1. Drill hole for toggle switch on case lid.

2. Drill 3 holes in the case lid for the LED lights to shine through, and 3 holes for the gas sensors to have air contact. Adhere components on the inside of the lid.

3. Drill hole in the side of the case for barrel jack USB cord to connect to the Photon Battery Shield.

4. Drill two small holes on the side of the case for the lamp switch cable. Adhere lamp switch to side of case.

5. Label the LEDs with its corresponding gas sensor on the outside of the case.

6. Check electrical connections and, if everything is good to go, coat electrical connections in epoxy or hot glue.


Calculate Gas Sensor PPM!


Each of the gas sensors outputs an analog value from 0 to 4095. To convert this value into voltage, use the following equation:

Sensor Voltage = AnalogReading * 3.3V / 4095

Once you have the sensor voltage, you can convert that into a parts per million (“PPM”) reading using the sensitivity calibration curve on page 5 of the gas sensor datasheets. To do this, recreate the sensitivity curve by picking data points from the graph or using a graphical analysis software like Engauge Digitizer .

Plot PPM on the y-axis and V_RL on the x-axis, where V_RL is the sensor voltage. There is a lot of room for error with this method, but it will give us enough accuracy to identify dangerous levels of hazardous gases. Estimated error bars are around 20 PPM for the LPG and Methane sensors, and about 5 PPM for the CO sensor.

Next, find an approximate equation for the PPM vs. V_RL curve. I used an exponential fit (e.g. y = e^x) and got the following equations:

LPG sensor: PPM = 26.572*e^(1.2894*V_RL)

Methane sensor: PPM = 10.938*e(1.7742*V_RL)

CO sensor: PPM = 3.027*e^(1.0698*V_RL)


Program it!


First, set up a data stream on the [data.sparkfun.com service](http://data.sparkfun.com). Next, write a program to read in the analog value of each gas sensor, convert it to PPM, and check it against known safe thresholds. Based on OSHA safety standards, the thresholds for the three gases are as follows:

  • LPG: 1,000 PPM
  • Methane: 1,000 PPM
  • CO: 50 PPM

If you want to get up and running quickly, or are new to programming, feel free to use my code! Use it as-is or modify to suit your particular needs.

Here’s the GitHub page!

Here’s the raw program code.

Change the following in the code:

1. Copy and paste your data stream public key to the array called `publicKey[]`.

`const char publicKey[] = “INSERT_PUBLIC_KEY_HERE”;`

2.Copy and paste your data stream private key to the array called `privateKey[]`.

const char privateKey[] = “INSERT_PRIVATE_KEY_HERE”;

To monitor the Photon output, use the Particle driver downloaded as described in the [“Connecting Your Device” Photon tutorial](https://docs.particle.io/guide/getting-started/connect/photon/). Once this is installed, in the command prompt, type `particle serial monitor`. This is super helpful for debugging and checking that the Photon is posting data to the web.


Be a Citizen Scientist!


Now we get to test and employ our gas monitor! Turn the batteries for the gas sensors on using the toggle switch, wait about 3 – 5 minutes, then turn the Photon on with the lamp switch (the gas sensor heater coils take some time to heat up). Check that the Photon is connected to WiFi (on-board LED will slowly pulse light blue) and is uploading data to the server. Also check that the gas sensor readings increase when in proximity to hazardous gases — one easy, and safe, way is to hold a lighter and/or a match close to the sensors.

Once up and running, use the sensor to monitor for dangerous gas leaks around your home, school, workplace, neighborhood, etc. You can install the sensor in one location permanently, or use it to check gas levels in different locations (e.g. SoCal..).

Educator Extension!

This project is a perfect excuse for a hands-on chemistry lesson! Use the monitor to learn the fundamentals of various gases — what kinds of gases are in our environment, how are different gases produced, and what makes some of them hazardous or dangerous.

Study the local environment and use a lil’ math to record and plot LPG, Methane, and CO in specific locations over time to see how the levels change. Use the data to help determine what causes changes in the gas levels and where/when gas concentrations are the highest.

 


More to Explore!


Monitor hazardous gas concentrations around your neighborhood or city and use the results to identify problem areas and improve public safety.

Use Bluetooth, or your smartphone WiFi, to connect to the Photon and upload data to the web wherever you are!

Include other sensors, gaseous or otherwise , to create a more comprehensive environmental monitoring system.

Sound Reactive EL Wire Costume

Bring science fiction to life with a personalized light-up outfit! EL wire is a delightfully futuristic-looking luminescent wire that has the added benefit of staying cool, making it ideal for wearable projects. Combining sensors and a microcontroller with EL wire allow for a wide range of feedback and control options.

This project uses the SparkFun sound detector and the EL Sequencer to flash the EL wire to the rhythm of ambient sound, including music, clapping, and talking.

Materials

Electronics

 

El Wire comes in a variety of colors, so pick your favorite(s)!

Costume

  • Article(s) of clothing

For a Tron-esque look, go for stretchy black material. Yoga pants and other athletic gear work great!

  • Belt
  • Old jacket with large pocket, preferably zippered or otherwise sealable.

The pocket will house the electronics. If you intend to wear the costume outdoors in potentially wet weather, choose a pocket that is waterproof (i.e. cut a pocket from a waterproof jacket).

  • Piece of packing foam or styrofoam (to insulate the sound detector).

Tools

Build it! Pt. 1

CAUTION: Although it is low current, EL wire runs on high voltage AC (100 VAC). There are exposed connections on the EL Sequencer board so BE CAREFUL when handling the board. Always double (and triple) check that the power switch is OFF before touching any part of the board. For final projects, it is recommended to coat all exposed connections in epoxy, hot glue, electrical tape, or other insulating material.

1. Test EL Sequencer with EL Wire.
Connect the inverter, battery, and at least one strand of EL wire to the EL Sequencer. (Note that the two black wires of the inverter correspond to the AC side.)
Be sure that the EL Wire lights up and blinks when you power the EL Sequencer on battery mode.

2. Solder header pins onto 5V FTDI pinholes on the EL Sequencer and onto the VCC, ground, and A2 input pins.

3. Solder header pins to the sound detector.

4. Connect sound detector to EL Sequencer via female-to-female breadboard wires (or solder wire onto header pins).
Connect the sound detector VCC and ground pins to the VCC and ground pins on the EL Sequencer. Connect the sound detector gate output to the A2 input pin on the EL Sequencer. If you are using the envelope and/or audio output signals, connect these to pins A3 and A4 on the EL Sequencer (more on this in the Program It! section).

Build it! Pt. 2

1. Make a protective casing for the sound detector using packing foam or styrofoam to prevent jostling or other physical vibrations (aka collisions) from triggering it.

Place sound detector on top of foam, outline the board with a pen, and cut out a hole in the foam for the detector to fit snugly inside. Also recommended to epoxy the wires onto the foam (but not the sound detector board).

2. Cut out a pocket from the jacket and sew onto the belt.

3. Put belt on, connect EL Wire to EL Sequencer, and place EL Sequencer in pocket pouch. Determine approximate placement of each EL wire strand based on location of electronics.

Build it! Pt. 3

1. Mark and/or adhere the base of the EL wire JST connector onto clothing, allowing the full length of the connector to flex. Be sure that the JST connector can easily reach the EL Sequencer.

2. Starting at the basse of the JST connector, attach EL wire strands to your chosen article of clothing.

Sew EL wire onto clothing using strong thread or dental floss, or use an appropriate fabric adhesive.
Prior to adhering the EL wire, it is recommended to use safety pins to determine placement of the EL wire on each article of clothing while you are wearing it. EL wire is flexible but not so stretchy, so give yourself some wiggle room.

It is also recommended to use separate EL wire strands on different articles of clothing to facilitate the process of taking it on/off.

Program it!  

1. Connect EL Sequencer to computer via 5V FTDI BOB or cable. 

2. Program the EL Sequencer using the Arduino platform; the EL Sequencer runs an ATmega 328p at 8 MHz and 3.3V.

3. Determine how you want to use the sound detector output(s) to control the EL wire. The sample program below utilizes the gate channel output to turn on the EL wire if there is a sound detected.

Sample Program:

// Sound Activated EL Wire Costume<br>// Blink EL Wire to music and other ambient sound.
//JenFoxBot
void setup() {
  Serial.begin(9600);  
  // The EL channels are on pins 2 through 9
  // Initialize the pins as outputs
  pinMode(2, OUTPUT);  // channel A  
  pinMode(3, OUTPUT);  // channel B   
  pinMode(4, OUTPUT);  // channel C
  pinMode(5, OUTPUT);  // channel D    
  pinMode(6, OUTPUT);  // channel E
  pinMode(7, OUTPUT);  // channel F
  pinMode(8, OUTPUT);  // channel G
  pinMode(9, OUTPUT);  // channel H
//Initialize input pins on EL Sequencer
  pinMode(A2, INPUT);
}
void loop() 
{
  int amp = digitalRead(A2);
    
  //If Gate output detects sound, turn EL Wire on
  if(amp == HIGH){
    
    digitalWrite(2, HIGH); //turn EL channel on
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
    delay(100);
  }
  
    digitalWrite(2, LOW); //turn EL channel off
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  
}

This program is just one example of what is possible with the SparkFun sound detector. Depending on your needs, different responses can be achieved by using the “envelope” and “audio” outputs of the sound detector. The EL Sequencer can individually control up to 8 different EL wire strands using the three sound detector output signals, so there are tons of possiblities to customize your sound-activated outfit!

More information about the sound detector output signals:
The gate channel output is a digital signal that is high when a sound is detected and low when it is quiet. The envelope channel output traces the amplitude of the sound, and the audio output is the voltage directly from the microphone.

In the photo provided, the red trace corresponds to the gate signal output, the light green trace corresponds to the envelope signal output, and the dark green trace corresponds to the audio signal output.

Test, Secure, & Show Off!

Connect all components to the EL Sequencer (inverter, battery, sound detector) and place in belt pouch. Turn the system on, make some noise (e.g. clapping, snapping, or music) and check that the EL wire flashes when there is a sound.

If the outfit works as expected, secure all connections by coating them in a (thin) layer of epoxy. Let dry for at least 24 hours. Epoxy is a very permanent adhesive, so if you want to reuse any of the components, try other adhesives like hot glue or electrical tape (less secure, but adjustable and removable).

You can reduce the overall strain on individual connections by ensuring that wires are securely fastened to the belt and/or pouch approximately one inch (1″) from all connections. The goal is to allow the EL wire to flex while keeping electrical connections rigid, as the connections are the most likely point of breakage.

Wear your one-of-a-kind, high-tech outfit and go show it off to the world!

EL Wire Light Up Dog Harness

Whether it’s to keep Fido (or in my case, Marley) visible on an adventure or as an awesome all-year-round costume, a light up dog harness is an excellent accessory for your favorite pup.

EL wire is a great option for wearable lights. It stays cool, is flexible, and comes in lots of different colors. This design uses the SparkFun EL Sequencer to automatically turn on EL wire when it is sufficiently dark outside so you don’t have to worry
about locating Mr. Dog to turn the system on.

Here’s a video tutorial for this project.

Recommended Reading

If you are new to electronics, EL wire, or the EL Sequencer, or would like more information on the main components in this project, check out this tutorial.As this design also uses a lithium ion battery, I also recommend reading this tutorial to give you an overview on proper care and handling of lithium batteries.

Materials

Electronics

  • EL Wire
    • EL wire comes in variety of colors, pick your favorite!

Harness Materials

  • Dog harness
    • A vest or backpack will also work.
  • Waterproof jacket with pocket(s)
  • Optional: Tupperware or other sealable plastic container

Tools

  • Safety goggles
  • Soldering Iron
  • Wire Cutter/Stripper
  • Epoxy (waterproof)
  • Scissors
  • Needle + thread OR fabric adhesive
  • Optional: Velcro

Build it! Pt. 1

**CAUTION:** Although it is low current, EL wire runs on high voltage AC (100 VAC). There are exposed connections on the EL Sequencer board so BE CAREFUL when handling the board. Always double (and triple) check that the power switch is OFF before touching any part of the board. For final projects, it is recommended to coat all exposed connections in epoxy, hot glue, electrical tape, or other insulating material.

1. Test the EL Sequencer with EL wire.
Connect EL Wire, inverter, and battery to EL sequencer.
Turn on power switch and check that the EL wire turns on (should be blinking). You can connect, and control, up to 8 different strands of EL wire.

2. Solder header pins onto 5V FTDI pinholes on the EL Sequencer.

 
3. Solder header pins to the “GND,” “VCC,” and “A2” pinholes EL Sequencer (right side).

4. Solder male end of breadboard wires to ambient light sensor. Coat exposed metal on the sensor in epoxy (do not coat actual sensor).

Note: Recommended to solder the pins on the bottom of the sensor so that the sensor can more easily be attached to the harness (found this out the hard way..).

 

 

 

 

Build it! Pt. 2 

1. Attach EL Wire to harness.
Sew EL wire onto harness with dental floss for a strong, durable bond. Can also use an appropriate fabric adhesive.For straps/buckles: leave about 1″ of unattached EL wire on either side of the strap/buckle.You can either wrap the ELwire for its entire length, or cut it and insulate the ends.2. Make a durable pouch for the electronics.
For a waterproof pouch, cut out a pocket in a waterproof jacket. I also included a small tupperware container to house the electronics in the pouch to further insulate and protect them from weather and dog conditions.

Build it! Pt. 3

1. Attach electronics pouch to harness.
Sew pouch onto top side of harness, or wherever is comfortable and practical for your pup. Recommended to put harness on dog to find a suitable location for the pouch.

2. Cut small holes on underside of pouch for the EL wire JST connector and the light sensor wires.

3. Attach and secure light sensor to harness. Recommended to put harness on your dog and mark location for light sensor so that it faces upward.
There was an ideal flap in the rainjacket pocket for me to cut a hole, push the sensor through, and epoxy the other side. You can also use velcro or sew the light sensor onto the pocket or harness, just be sure that it stays stationary and won’t get covered when the dog is moving.

4. If using tupperware, cut or drill holes in tupperware for EL wire JST connector and light sensor wires.
If you are not using tuperware, it is recommended to cushion the electronics and/or epoxy all connections (except the JST connectors) to protect them from your dog’s antics.

5. Connect EL wire and light sensor to EL Sequencer (through holes in the tuperware), then epoxy the holes to keep wires in place and maintain a waterproof seal.

Program It!

1. Connect EL Sequencer to computer via 5V FTDI BOB or cable. 

2. Program the EL Sequencer using the Arduino platform; the EL Sequencer runs an ATmega 328p at 8 MHz and 3.3V. 


3. Write a program to read in the analog value of the ambient light sensor, turn on the appropriate EL wire channels at a value that corresponds to low light, and turn off once the light sensor value is above the low light threshold.Here’s a sample program with a preset light threshold:

// EL Wire Dog Harness Program
// Turn EL wire on when ambient light is low.
// JenFoxBot
// Based on test sketch by Mike Grusin, SparkFun Electronics
void setup() {
  Serial.begin(9600);  
  // The EL channels are on pins 2 through 9
  // Initialize the pins as outputs
  pinMode(2, OUTPUT);  // channel A  
  pinMode(3, OUTPUT);  // channel B   
  pinMode(4, OUTPUT);  // channel C
  pinMode(5, OUTPUT);  // channel D    
  pinMode(6, OUTPUT);  // channel E
  pinMode(7, OUTPUT);  // channel F
  pinMode(8, OUTPUT);  // channel G
  pinMode(9, OUTPUT);  // channel H
  // We also have two status LEDs, pin 10 on the EL Sequencer, 
  // and pin 13 on the Arduino itself
  pinMode(10, OUTPUT);     
  pinMode(13, OUTPUT); 
  pinMode(A2, INPUT);  
}
void loop() 
{
  int x,status;
  
  //If ambient lighting is too low, turn on EL wire
  if(analogRead(A2) < 50){
    digitalWrite(2, HIGH); //turn EL channel on
    delay(1000); //wait 1 second
    
    //Keep EL wire on until light sensor reading is greater than 50
    if(analogRead(A2) > 50){
      digitalWrite(2, LOW); //turn EL channel off
      delay(10);
    }
    
    Serial.println(analogRead(A2)); // Use this to check value of ambient light 
    
    digitalWrite(10, status);   // blink both status LEDs
    digitalWrite(13, status);
  }
}

4. Check that the EL wire turns on when the ambient light is low, and turns off in bright light. 

Test it and Put it to Work!

Place EL Sequencer, inverter, and battery inside the pouch (and tupperware). Connect all components to the EL Sequencer and turn it on using battery power. Test it in low and bright light to ensure that it functions properly.

If system works as expected, put on dog and go exploring!As an added bonus, you can use the electronics pouch to store other small, non-magnetic items. Enjoy!