Category Archives: electronics

Arduino Robot Class preview

I’m teaching an Arduino Robot class June 29 from 6-8pm at YouDoitElectronics in Needham, Ma. The cost is $99 and you get to take home the robot you build. I’ll show you how to use an Arduino to control DC motors, and read sensors to react to the environment. The robot we’re building will have a sonar sensor for distance, and two line detectors for following a line.
To register email your name phone number and number of participants to events@youdoitelectronics.com. Please include Arduino Robot Workshop in the subject line. You will receive a call back within 1-2 business days. Fee is required at time of registration prior to the start of the workshop. Once registration and payment are complete a reservation confirmation number will secure your spot.

DIY Rayguns!

IMG_20160117_244535475

I’ve been going to Arisia (one of Boston’s Science Fiction Conventions) for several years. I always have a great time, and it always amazes me the amount of volunteer effort that goes in to providing amazing programming for everyone. This year I wanted to give something back so I came up with the idea of people building rayguns.

(NOTE: My extra kits are available in my etsy shop: https://www.etsy.com/listing/265475569/diy-raygun-kit)

Regular LED strip is super cheap when you order it from China. It normally runs off 12V, but a 9V battery lights it up just fine. I created a simple laser cut frame to put some LED strips, and then some cool laser cut acrylic disks to give it that groovy 50’s raygun look.

I bought most of the parts myself, but special thanks goes to my friend Jeremy Green at Charles River Maker for donating Laser time for cutting the kits. He’s your goto guy for design, prototyping and digital to physical services with laser cutting and lots of 3D printers!

IMG_20160124_200031275

A switch makes the trigger, and there’s a fin with holes to add decorations.

IMG_20160124_202035981

First cut a strip of LEDs. Mine consisted of groupe of 3 led sections.. Cut a strip of 5 sections, two sections on each side and one straddling the middle:

IMG_20160124_200123002

next glue on the handle “dimensional” bits. These are mainly to make a recess for the battery, and maybe wrap the handle. Super glue works pretty quick, but you could probably use wood glue or whatever is appropriate for your frame:

IMG_20160124_200915995_HDR

Glue the trigger button on, (kindof low, as the disks are pretty close. Actually I moved it down abit after I put the disks on (later step)

IMG_20160124_201644540_HDR

Line up the battery clip and shorten the leads to connect one end (I chose the red, positive wire) to the positive contact on the LED strip. A small wire went from the negative contact to the switch and the other lead of the switch to the negative lead of the battery clip.

IMG_20160124_201656322

Test, viola!

Next line up the disks where they fit. back them off and put a drop of superglue where each disks goes in order.

IMG_20160124_202344870

IMG_20160124_202812456

The source files for laser cutting are at: https://github.com/osbock/Baldwisdom/tree/master/DIYRayguns

And now a few pics from the workshop at Arisia!

IMG_20160117_244513394_HDR

IMG_20160117_244050950_HDR

IMG_20160117_244531403

 

 

 

Paper Circuits Workshop

I led a paper circuits workshop at the Auburndale Community Library, and I thought I’d share a few thoughts in case you’d like to try it on your own. By the way, all the photos in this post are by our host Dana Hanson, a good friend and one of the key volunteers that keeps the Auburndale community library going (with no municipal support!)

I let the library know that it would be ok for all ages, but if kids were under 7, a parent should stay to help. We got lucky in that we had a couple of parents who either got it right away or picked it up very quickly and they were able to help tremendously.

The first I saw this idea was on the MIT High Low Tech site and they have some good pointers. They use surface mount LED’s but they are quite difficult to tape, so we modified with regular LED’s.

Setting the basic rules: Lithium batteries need to be recycled (and don’t eat them…), What is a circuit (relating to circles…) watch out for short circuits, polarity of LEDs. This circuit is very forgiving, the internal resistance of the coin cell (we used CR2032) means you don’t need a series resistor to limit current for the LEDs, and also means that short term short circuits don’t destroy the battery immediately or cause a fire!

Some Clown

We set up a station to hand out materials at the circulation desk. Next time, I think I might divide it into several stations. The most time consuming part was letting them pick which LEDs to use. You could either limit it to one kind, or spread it out a little. You could have people just pick them from bins on the table, but sometimes people take too many. (It wasn’t a problem here….) My son’s Mason and Grant assisted me both in preparing and in debugging people’s circuits, and were indispensable.  25 Kids with about 80% of them needing help would be too much for one person.

Critical help

One of the mothers came up with a good way of making the connections more reliable add copper tape under the leads of the LEDs as well as on top.

Hard at work

Beautiful artwork

One of the book racks made a nice display for the finished work.Gallery of creations

 

 

 

Electrify Your Halloween! Making it Move!

In late September, I  led a workshop at the Duxbury Free library on making interactive Halloween displays, and more recently I set my project up on our porch for Halloween.  One of the most effective ways to make your front porch scary and immersive is to pay attention to sound, and to make things move.

The first part (making it scream) was documented in this post. This is about the movement part, creating a pop-up inflatable ghost, completely from scratch. It was very successful and popular!with the kids. Unfortunately I didn’t get any video, but I can cover the construction.

I like inflatables, and wanted to try making my own. One thing that made this really easy was a really cool product called Powerswitch Tail. This allows you to control an AC outlet from a digital signal. Its available from Adafruit and Makershed. It’s essentially a short extension cord with an opto-isolated relay in line. This eliminates any dangerous AC wiring with relays, and protects your Arduino and other circuits as well.

Next I needed to make the Ghost. I use white kitchen trashbags at home, and I took three of them, two laid end to end (with the end of one cut off.) I cut the third bag in in thirds and used the outside sections for arms. I used simple transparent packing tape to bond the edges.

 

A total of 3 bags (top and bottom, both arms)

I used one of those small vortex fans, and taped it around the output side.

 

Boo! Attached to the fan, and inflated.

Hook the powerswitch tail to a digital IO on an Arduino and you are good to go. As I mentioned in the last post, you can get the code on github here.

 

Electrify your Halloween! Making things scream!

In late September, I  led a workshop at the Duxbury Free library on making interactive Halloween displays, and more recently I set my project up on our porch for Halloween.  One of the most effective ways to make your front porch scary and immersive is to pay attention to sound, and to make things move.

In this post, I’ll cover making sound, the next post will cover my moving ghost.  There are lots of ways to make sound by control, and in reaction to people coming on to your porch. My original idea was to use a motion sensor, and then trigger an AC relay to turn on a cassette boombox. Because the boombox could have the mechanical play button pressed with the power off, when you turned the power on, it would play.

Then, I ran across the sparkfun voice recorder module at YouDoIt Electronics (my local hacker supply place!)

There are other ways to make sound (and probably easier) but this was fun, and I’d already spent the money. If I had to do it over, I might use either the Adafruit wav shield, or a new entry, the very cheap Garan MP3 Module from Seeedstudio (I’m probably going to order one of these for next year!)

This breakout is for a chip that was originally meant for a voice recorder with some buttons to trigger the different segments. It’s not very well documented on the sparkfun site, but one of the comments pointed me to http://ianlangelectronic.webeden.co.uk/#/voice-recorder/4562321245. That with the datasheet, let me build a simple Arduino library to control it. You can download it from github here.

First you need to wire it up. Here’s a fritzing diagram showing the connections:

sound sampler hookup

 

In order to make it more reliable, I mounted it on a protoshield. I also like using a proto-screw-shield to hook up the external components.

In this case, the motion sensor (https://www.sparkfun.com/products/8630) on the right, and the wire going off to the left connects to a powerswitch tail to control a fan for the ghost.

I used PC speakers connected directly to the jack on the sparkfun voice module.

A little about the PIR motion sensor. The data sheet says it operates at 12V, but sparkfun says it operates from 5-12V. I have a Parallax module that is a bit easier to use, but I couldn’t find it and once again YouDoIt rescued me with the sparkfun part. A few other things to note. Since it is open collector, you need a pullup on the input. I used internal pullups in my Arduino code. When I tried to run the system off of one of those USB battery packs, it was unreliable and had very short range. Using an AC adapter worked fine, but if I had to do it over, I might use a motion sensor designed for 5V. The other thing was that the wire colors were confusing. Ground was White, Signal was Black, and VCC was the only one that had a “normal” color of red. (GND is usually black.)

 The code

You can find the code on github here. You can control it via the serial port by entering a message number (0-8) and then ‘r’ or ‘p’ for record or play. It uses the onboard microphone for recording.

I chose to use the button on the protoscrew shield as an arming button, but you can also control that through the serial port. ‘m’ toggles whether or not motion activates the sound and PowerSwitch tail output.

Here’s the complete code (at the time of this post) remember to install the ISD library first:

#include <ISD.h>
// delay between motion activations
#define ACTDELAY 10000L
// motion sensor
#define MOTION A4
#define ARMButton A5
// powerswitch tail
#define powerSwitch 7
// LED
#define LEDPin 13
ISD isd = ISD();

void setup() {
Serial.begin(115200);
// motion sensor
pinMode(MOTION, INPUT);
// open collector requires pullup
digitalWrite(MOTION,HIGH);
// powerswitch
pinMode(powerSwitch,OUTPUT);
digitalWrite(powerSwitch,LOW);
pinMode(ARMButton, INPUT_PULLUP);
pinMode(LEDPin,OUTPUT);
Serial.println(“enter a message number to play or record or r/p”);
}
// globals
int msg =0;
boolean motion = false;
boolean soundonmotion = true;
boolean powerswitchonmotion = true;
int lastReading = HIGH;
boolean ARMState = false;
long lastActivation = 0L;
void loop() {
// check arming button
if (digitalRead(ARMButton) == LOW){
ARMState = ARMState?false:true;
// cheap debounce
delay(500);

if (ARMState){
digitalWrite(13,HIGH);
soundonmotion = true;
motion = true;
powerswitchonmotion = true;
Serial.println(“Armed!”);
}
else{
digitalWrite(13,LOW);
motion = soundonmotion = powerswitchonmotion = false;
Serial.println(“Unarmed”);
}
}
//check motion sensor
long currentTime = millis();
if (motion){
int currentReading = digitalRead(MOTION);
if ((currentReading != lastReading) && (currentReading == LOW) && ((currentTime – lastActivation) > ACTDELAY)){
lastActivation = currentTime;
Serial.println(“activating motion”);
// if enabled turn fan on first
if (powerswitchonmotion){
digitalWrite(powerSwitch,HIGH);
delay(1000);
}
if (soundonmotion)
isd.play(4);
if (powerswitchonmotion){
delay(5000);
digitalWrite(powerSwitch,LOW);
}

delay(1000);
}
lastReading = currentReading;
}

if (Serial.available() != 0)
{
char c = Serial.read();
if (c >= ‘0’ && c <=’8′)
{
msg = (int)(c- ‘0’);

Serial.print(“msg selected: “);
Serial.println(msg);
}
else if (c == ‘r’)
{
isd.record(msg);
}
else if (c == ‘p’)
isd.play(msg);
else if (c == ‘m’){
//toggle motion activation
motion = motion?false:true;
Serial.print(“motion is “);
Serial.println(motion);
}
else if (c == ‘f’){
powerswitchonmotion = powerswitchonmotion?false:true;
Serial.print(“powerswitch is “);
Serial.println(powerswitchonmotion);
}
else if( c == ‘s’){
soundonmotion = soundonmotion?false:true;
Serial.print(“sound is “);
Serial.println(soundonmotion);
}

}
}

 

Open Hardware Summit Photobooth

As you know, my Wyolum buddies and I partnered up with SeeedStudios to make a really cool e-paper badge for the Open Hardware Summit which took place last week. We wanted some cool ways for people to customize their badges. Justin created a great simple program for converting images (wifit.py) and I leveraged that software to create a photobooth.

photobooth (by Addie Wagenknecht)

Photo by Addie Wagenknect

My friend Michael Castor at Makershed built a cool tablet from the Raspberry Pi, and he told me about the nice 10.1″ LCD display and HDMI adapter he found from Chalk-elec.

I ordered one, and started figuring out how to put the whole thing together. I also got a big red button from Adafruit. I have been playing with the Raspberry Pi camera and it’s perfect for embedding in a project like this, even though the software is a bit primative at this point (no video for linux drivers, etc.) I used our own AlaMode to read the button and use one of our WS2811 arrays to do a visual countdown before taking the picture.

I’d never really designed anything for laser cutting, and this was my opportunity! I used Inkscape, with the T-slot extension written by Justin. I got the box cut at Einstein’s Workshop (a family oriented makerspace in Burlington, MA.)

Lasercut box

Next, I laid out the components. The trickiest parts were the LVDS cable (though it’s pretty generous) and the Raspberry Pi Camera flex cable.

One really sweet thing about the Chalk-elec hdmi adapter is that you power it, and there’s a USB power port to power the Pi.

Raspberry Pi and HDMI adapter

 

Attaching the LCD to the case is a little nerve wracking, as like most tablet screens, it’s intended to be glued in. I used 3M permanent mounting tape (really not tape but adhesive on a backing roll.) It’s really difficult to cut with scissors (it sticks to everything) I made the mistake of putting it on the bezel and trying to cut it with an X-acto knife. I scratched the paint on the bezel, but I managed to fix it with a sharpie.

The better approach turned out to attach it to the opening, and cut along the opening.

IMAG1720-001

After trimming I added the LCD, and the USB panel mount jack.

I had to drill a few holes because I hadn’t completely planned ahead, for a jack for the switch box (used a 1/4 phone jack and plug) power, and the 16 pixel LED array.

IMAG1726

 

I had planned for it to swivel on the sides from two carriage bolts with wing nuts. This meant making a stand, and I didn’t want it to be just a couple of 2×4’s. Also I was running out of time so I took Justin’s suggestion and made a tripod mount for it. More holes…. And a mending plate from the hardware store. Fortunately I have a set of cheap taps from Harbor Freight, so it was pretty simple to drill the plate and tap it (1/4-20) to accept a tripod mount.

IMAG1730

Getting it hooked up with the short cables is a little tricky, but there’s room to get your hands in there:

IMAG1732I

I used a proto-screw shield to make it easier to hook up the button and LED leads. As you can also see, there’s a small usb hub inside too.

I booted it up:

IMAG1727

 

and then hacked Justin’s Wifit program to take a picture:

IMAG1728

Justin then created a more kiosk-y gui, and I ironed out a few things with the Arduino code for AlaMode. The gui checks to see if an sd card is mounted, and when it is, it sends an enable command to the button and prints on the screen “Press Button when ready”  The AlaMode then monitors for the button, and when pressed, sends the signal to take the picture and begins counting down on the LED strip. You can find the code in our github repository: https://github.com/wyolum/EPD

I tried also using the LED strip as a flash, and it worked but made sort of ghastly underlighting like a camp flashlight! So I took some cheap chinese led strip I had around (about $12 for 5 meters) and made a light panel:

IMAG1753

And the finished product:

IMAG1745

And on the badge:

IMAG1729I’m thinking of modifying the code to upload higher res pics to the Internet with an imprint, or printing them on a portable printer I picked up at a yard sale!

By the way, I left the Raspberry Pi’s wifi dongle attached, as it made it much easier to debug with SSH from my laptop. That said, I did also plug another hub into the one exposed port to use a keyboard and mouse (even though the touch screen does work!) If I had to do it over again, I might bring at least one more port out for other devices.

You’ll notice in the first picture, the Wyolum Logo across the top. Elizabeth Shaw cut that for me and delivered it the morning of the OHS, and it fit perfectly!

 

Lazertag hacking

My friend Nick asked if we could find a way to create enhancements to the fantastic, but no longer made Lazertag Team Ops system.

Many people believe that this was the Pinnacle of consumer lazertag, and I tend to agree. In addition to working better both indoors and out, it could host games where it kept track of the scores of multiple players.

Nick and his friend Max came over and we were totally successful! Here’s a brief video showing our results.

First we looked up what was known about the protocol. I found this:

http://web.archive.org/web/20090304155723/http://lasertagparts.com/ltto.htm

via the LTTO (LazerTagTeamOps) Yahoo group. As you can see the page is no longer in service, but the archive still has it.

Here’s the cool diagram that they created in the past, apparently based on Aaron Nabil’s reverse engineering effort:

From the Internet Archive’s record of http://www.lasertagparts.com/images/ltto_signals.gif

Of course it’s easy to say this now, but the protocol was pretty easy to decode by looking at the output on a scope. The only difficulty I had was capturing just the shot, as the dome is constantly shooting out messages saying what team, etc.

Here’s an example of a shot that is created by our program:

Lazertag shot

you can see that it uses a 38 kHz carrier (to distinguish it from random IR noise. Fortunately Ken Shirriff wrote a terrific IR Remote library for the Arduino. It’s not really well documented, but there is a sendRaw() function that we used to send the actual timings for the shot. Grab his library here. The library uses preset pin numbers for the LED output, but you can change them in the library itself, you just need to use one of the PWM pins as he uses the timer function to create the carrier frequency.

unsigned int shootOne[] = {3000,6000,3000,2000,1000,2000,1000,2000,1000,2000,1000,2000,1000,2000,1000,2000,1000};

// the one confusing thing with the irsend.sendRaw command is that the last argument is labled hz, but it’s really
// kiloherz. The lazertag team ops uses the common 38kHz frequency.
irsend.sendRaw(shootOne,sizeof(shootOne)/sizeof(int),38);

For the TV-B-Gone, I modified the original firmware to send out the appropriate pulses, similar to my previous hack for camera remotes. The V1 firmware uses uncompressed codes, so that is what I started with.

Grab the example code zip here, and let me know on google+ if you build anything with it!

Also if you want to use Git to pull the code (whether or not you want to fork) it’s all checked in to the baldwisdom github repo:

https://github.com/osbock/Baldwisdom

 

Introducing Raspbery Pi à la mode

Our first prototypes are back, and working quite well! SeeedStudio fabricated the prototype boards and quickly sourced the parts.  The boards were of excellent quality. We ran into a few hiccups along they way, but Seeed Studio took care of them right away, and rushed to make up time.

If you haven’t been following, Anool Mahidharia, Justin Shaw and I from the Wyolum.com OSHW collaborative have been developing a stackable Arduino compatible for the Raspberry Pi.

While there are lots of emerging examples of interfacing hardware to the Pi, it’s just not as easy as the Arduino, and the Arduino already has hundreds of libraries for interfacing with motors, sensors, and displays. While you can always plug an Arduino into the USB port, but it’s not as neat and embed-able as a a GPIO interfaced board. You can write a program on the Pi in any language you want to control or monitor your Arduino application, making Internet integration and control super easy. In addition you can even program the AlaMode directly from the Pi.

Here are the features including a few extra goodies:

  • Flexible power. Can be powered directly from the Pi, standalone with a battery or wall-wart, or USB power. This is important if your shield takes more power than the Pi can provide or if you want to undock it for standalone operation.
  • Programmable via the Pi’s UART on the GPIO pins, or an FTDI USB-Serial adapter or ISP.
  • Header for connecting Fastrax UP501 GPS.
  • DS3234 Real time Clock. The Pi doesn’t have it’s own battery backed RTC. You can set a program in the AlaMode to report the time to the Pi via serial or I2C
  • Micro-SD card slot. Useful for datalogging, and big-memory  for your Arduino applications
  • Row of Servo Headers connected to the PWM pins with a configurable power and ground rail

We’re in limited Beta right now, but as soon as it’s thoroughly tested, we hope to produce them for sale as soon as we can!

Introducing: Carduino, a micro for Car hacking.

Becoming a member of Wyolum has it’s privileges (and responsibilities)! While waiting for my AlaMode boards to come back, I’ve been helping out on another project led by David Pincus, with electronics and layout by Anool Mahidharia.

David originally wanted this to supply power to his new in-car DVR that has the capability of recording triggered by motion detected by it’s on-board accelerometers. He was worried that if he didn’t drive the car for a few days, it might drain the battery. This little Arduino compatible board can monitor two voltages (through a precision resister voltage divider) and shut off a solid state relay if the voltage falls below a selectable value. There’s also an optional display board (shown here displaying the supply voltage). If you don’t want to use the display, the row of pins is a handy breakout of many of the unused Arduino pins.

 

 

 

Other features:

  • i2C port (sensors anyone?)
  •  2.5 A solid state relay.
  • Jumper block for setting shutdown voltage. Here we got a bit clever, using a resistor ladder tied to an analog pin. Uses just one pin but multiple values.
  • FTDI and ISP programmable
  • Can be powered by FTDI or VBATT input (up to 15V)
  • Protection diodes on all the power inputs
  • Screw terminals for easy connection.
  • Easy to assemble through hole kit.

We’re making a few tweaks, and then we are thinking about doing a kickstarter to judge interest. We’d love to hear what you’d do with it, I think the applications aren’t limited to cars. Certainly, boats, RV’s and maybe solar applications also come to mind.

I’ve learned a lot on this project. I did the logistics, ordering the boards from Laen (http://oshpark.com, Dorkbot PDX’s new online submission system), kitting parts and writing some test code and trying out the first version.

If you are interested, give us a shout (either on my google+ stream, or at the wyolum.com forums.)