Category Archives: hacking

NovaBooth – Improving the Open Source Photobooth

NoVa SnapAs you may have read here previously, we (the Wyolum Gang) created a photobooth for the Open Hardware Summit, for the purpose of customizing the e-paper badges we made for the conference attendees. This processed the pictures into a small black and white image for the e-paper badge, and saved it onto the badge’s micro-sd card.

I was headed to help out at the Northern Virginia Maker Faire, and thought it would be fun to update the photobooth to take full color pictures, upload them to the Internet and offer to email them to friends and relatives.

The email message and logo files are easy to add and customize.

For basic construction, visit the original post, but download the new software here:

github: https://github.com/wyolum/NovaBooth

The fabricate directory has the laser cut files, arduino for the AlaMode Program, and scripts for the python photobooth code.

Edit custom.py to customize the email subject and message. config.py contains the authentication information for the google email and posting accounts. You’ll need to set up application specific passwords for this on your google account. You can use the same account, or separate.

Wireless keyboard, had to add a powered hub.

Problems

  • External powered hub was a pain.
  • Proto-screw shield was too heavy and lifted off
  • Some of the nuts came loose in travel.

Photobooth 1.5

To solve the first problem, I determined to replace the non-powered hub in the photobooth with a powered one.  I tried to add power to the unpowered hub, and this worked at first, but then took out the power supply and made the raspberry pi flakey too.

Scratch that, I ended up using a small belkin powered hub. I y-connected the power to it.
I noticed that  a convenient orientation put  4 ports right next to the edge,  so I cut a hole in the box to expose them.

Luckily AlaModes ship without shield headers installed, so I replaced the AlaMode and protoshield with an AlaMode that was directly soldered to the button, led-strip, power and ground.

I updated the AlaMode’s photobooth program directly from the photobooth. Apparently the new AlaMode’s pullups weren’t as strong, so I added a 5.7k pullup to the Button Pin.

 

Instant Party for Arduino Day!

You Do It Electronics in Needham asked me to help out with their Arduino Day celebration on Saturday March 29, and I wanted to make a nice Arduino demo that uses parts that they sell, relatively simple, and Fun! You Do It also sells DJ and disco equipment, so I thought what would be better than Arduino controlled Disco lights and Music?

Here are the Parts I chose:
Sparkfun Motion sensor (to trigger the Instant Party)
Sparkfun MP3 Shield
Arduino
Sparkfun proto-screw Shield (to make it easy to hook up.)
Power Switch Tail – turn on the disco lights

You’ll also need a micro-sd card and some music. I chose some Creative Commons Techno from Soundcloud:

https://soundcloud.com/captain-karacho/city-17
https://soundcloud.com/captain-karacho/brainwreck

First, we need to find out what pins are in use in the MP3 Shield so we can figure out where to hook up the motion sensor and power switch tail.
The easiest way to do that is by looking at the schematic, or this page at Sparkfun: https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup/hardware-overview
MP3 Shield hookup

Digital Pins 5 and 10, and Analog Pins A0-5 are all free.

I used the analog lines because they are close to the power and ground pins for both the power switch tail and the PIR motion sensor.

Because the PIR output is open collector, I use the internal pullups on the Arduino.

Git the code here: https://github.com/osbock/InstantParty

 

A Brief detour into Cryptocurrency

dogecoinI attended a meetup of HackBoston, run by Abby Fichtner (HackerChick) from the Harvard Innovation lab. Project 11′s Reed Sturtevant wanted to learn more about Cryptocurrency, so he started experimenting and shared the basics with us at the meetup.

Most people have heard of BitCoin, but Reed shared that it’s so hard to mine now, it’s very difficult to experiment without putting in real money. He found DogeCoin as a fun, and lighthearted alternative. Often used as a +1 or like tipping system for blogs and on social networks.

Pre-work was to set up wallets before the meeting, as they take time (about 5 hours) to synch with the network.

We each recieved 2000 dogecoin at the beginning of the meetup. Then we learned the basics of how to use addresses (essentially the destination of coin transfers. We transferred money to each other.

While doing this Reed went over the basics of cryptocurrency, which I won’t cover here, but the wikipedia article covers it pretty well.

We also created accounts at tipdoge.info which lets you send DOGE via twitter. (feel free to tip @osbock)!

Intro to Mining

If you read the wikipedia article, you know that transactions are verified by a cloud of contributers performing cryptographic checks distributed across the Internet. “Miners” are rewarded both through the creation of new “coin” (which slows) and the distribution of transaction fees. Without special hardware, your chance of winning a race to solve the puzzle that is a cryptocurrency transaction is minimal, so mining pools were created to distribute the work and the reward.

We created accounts on the mining pool site dogehouse.org, created workers (essentially addresses within the pool for your mining processes to communicate) and downloaded and configured mining software.

I recently got a nice “gaming” laptop from Lenovo, because it offered very good price performance, plus it has an Nvidia graphics card which I wanted for computer vision experiments.

Because Nvidia graphics cards contain many parallel processing cores, and Nvidia has released an API that allows their use for general purpose parallel computing, they are often employed for mining.

The Experiment

Following instructions from dogehouse.org, I set up cudaminer (cuda is what Nvidia calls their processing cores) and another instance running the pooling cpu-miner to take advantage of the native cpu cores of my laptop’s i7.

Each mining process (cudaminer and pooling-cpu-miner) were configured to report to a “worker” setup at dogehouse.org.

I then mined overnight to determine:

  1. The kH/s (thousand’s of hash per second) capability of my laptop
  2. How much doge/hour I could mine
  3. Electricity cost of running the computer. (determined with a P3 Kill-a-watt)

Using an exchange rate, I converted into dollars to see if I could mine more doge than the electricity cost.

The Results

The cuda miner was reporting an average of around 80 kH/s and the cpu-miner around 54 kH/s

In 14.07 hours I mined 261.229 Doge for 18.57 Doge/hour, or $.0147/hour (at an exchange rate of .00079$/Doge.) Power usage was approximately 1.4 kWh, which I calculated to cost $.19.

Projecting out to a month, at  134 kH/s, I’d earn a whopping $.95 (and lose a lot of the computing bandwidth of my laptop!)

I could invest in a fancy graphics card and dedicate a computer, but I imagine it would cost even more electricity.  So, I would say  overall, a negative return on investment.

This apparently became the case for bitcoin as well, until people developed specialized hardware that gives a high H/s rate at low electricity usage, first using FPGA’s and then specialized ASICS (Application Specific IC’s). Doge uses a different Hash algorithm than Bitcoin, so you can’t use the now ubiquitous ASIC mining equipment optimized for the SHA 256 algorithm. There’s a new ASIC to be released soon that supports Doge’s (and litecoin, and others) Scrypt algorithm, and by extending my calculations, the cheapest of these devices ($119) would pay for itself in 3 or 4 months.

I’m going to try to get one to see. Of course, all these calculations are based on assumptions of stability (exchange rate, mining rate etc.) which are completely unreasonable. Still it’s fun to try!

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.

 

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

 

Using GPS with AlaMode

We included a header for the UP501 GPS module on AlaMode.
The UP501 is popular, and has the additional advantage of having a PPS output which can be used to do ultra-precise timing.

Unfortunately we made a little mistake and reversed the silkscreen on the connector (documented in this forum article.) The actual orientation is actually quite logical the RX pin of the GPS lines up with the corner of the AlaMode.

Mikal Hart wrote a wonderful GPS library called TinyGPS

http://arduiniana.org/libraries/tinygps/

The GPS library doesn’t actually talk to the GPS module, but parses the output (NMEA statements) In this case, our example code uses the SoftwareSerial library (also by Mikal Hart!) to listen for the output and feed it to the GPS library.

The pins used in AlaMode are 6 (receive on the Arduino, output from the GPS), and 4 (Transmit on Arduino, input into the GPS module.) Note you shouldn’t actually write to the GPS module from the Arduino, as it’s a 3V module, and the Arduino’s outputs are 5V. It is, however safe to read.

SoftwareSerial nss(6, 4);

also in the setup() function initalize the SoftwareSerial for 9600 baud:

nss.begin(9600);

After that, you are good to go! Stay tuned, in a future post, we’ll have a guest blogger who will be using the GPS feature of AlaMode to build a compact WarDriving module.

Here’s a copy of the GPS example code, pre-edited for use with AlaMode:

 

Repairing Raspberry Pi SD holder

Do a quick Google, and you’ll find a lot of people have broken their Raspberry Pi SD card socket. Justin Shaw and I both broke ours within 15 minutes of each other while chatting on the Internet. In my case, I put my finger on the card while unplugging the HDMI cable.

The plastic is very brittle on the SD card holder of the Raspberry Pi. This one broke off on the right side when it was dropped with a card in place.

Adafruit makes a nifty half length Micro-SD to SD slot adapter. If I had this to begin with, my slot probably wouldn’t have broken. When I saw it, I thought maybe I could glue it in to restore function to the broken Pi. Phil Torrone of Adafruit graciously sent me one to try. (Warning: It’s hard to fix this slot, and hard to find a replacement, so I really had little to lose, but it would also be easy to mess things up further. If you don’t fix your Pi, and end up with a glued in sd adapter you can’t use, I’m not responsible!)

There’s a gap between the bottom of the “Card” and the PCB, so we’ll need a space filling glue that sticks to fiberglass

I happen to have some 5 minute epoxy that I purchased on a trip to Japan. It has glass in the pictures, so I figure it will do.

I always get a little nervous at this step.  Mix according to instructions. Equal amounts of the two parts. It sets up in 5 minutes but you should leave it overnight before applying too much force.

Glue and Clamp. I put some along the edges of the socket (make sure you don’t get it on the contacts) and then placed the adapter, and dripped some in to the gap. You should probably wait over night. While it’s pretty solid in 5 minutes, it may not be totally bonded/cured for 24 hours.

Ok, I couldn’t wait overnight. after about 10 minutes I tried it. Hack Successful!

he finished project. You can’t use SD cards anymore, but micros are pretty easy to come by, and it no longer sticks out for you to apply leverage.

 

Simplified Setup for Arduino on Raspberry Pi

I just got back from the Open Hardware Summit and World Maker Faire. It was fantastic and I spent a day and a half doing demos of Alamode and the Raspberry Pi in the Makershed. I’ll have more on that later, but I got a lot of questions about setting up Arduino, and I realized that things have been simplified since my last blog post on the subject.

I recommend you download the latest raspbian (these instructions are for that version.)

2012-09-18-wheezy-raspbian

After running through the setup (raspi-config) which runs automatically the first time do a:

$ sudo apt-get update
$ sudo apt-get install arduino

You used to have to get the avrdude and gcc packages separately and install them in an unzipped version of arduino, but there’s now an up-to-date package. This works out of the box with FTDI Arduinos, but Uno’s /dev/ttyACM0 and the Raspberry Pi /dev/tty/AMA0 aren’t recognized by the Arduino IDE. To do that we create some “udev rules” that create symbolic links to those devices that are named /dev/ttyS1 (uo) and /dev/ttyS0 (alamode) respectively.

I created a setup script to do the hard work for you (note the $ represents the command prompt, don’t type that!):

$ wget https://github.com/wyolum/alamode/blob/master/bundles/alamode-setup.tar.gz?raw=true -O alamode-setup.tar.gz
$ tar -xvzf alamode-setup.tar.gz
$ cd alamode-setup

If you want to be ready to run Alamode, and the Uno run:

$ sudo ./setup

which disables logging and getty on the internal serial port (so you can use it to program alamode), sets up the /dev/tty links, and installs a modified avrdude that has a new programmer type, -c alamode. This should be completely safe, as I only and (I think properly) added a new programmer type, but I haven’t tested it thoroughly on other programmer types. It also sets up the board type for alamode in the Arduino IDE.

reboot to get rid of the logging and getty.

If you just want Uno support, type:

$ sudo arduino-setup

Here you probably don’t have to reboot, just

$ sudo udevadm trigger

If you want Bonjour, which will allow you to refer to your raspberry Pi on the local network as raspberrypi.local

$ sudo apt-get update
$ sudo apt-get install libnss-mdns