posts tagged with the keyword ‘arduino’

2016.02.08

LED PWM

Somehow the folks at UWM’s Peck School of the Arts convinced me to become an Adjunct Lecturer and teach a Physical Computing course titled “Electronics and Sculpture”. Okay, I’m being a coy, I jumped at the chance, and I’m pretty excited about it!

I’ve been playing around working with Arduino microcontrollers for a little over five years now, building all sorts of strange projects, and truth be told, I did a lot of weird electronics projects when I was a kid, and even took electronics classes in high school. As for the sculpture part, I think a bunch of these projects qualify as sculptures.

Potentiometer LED

I’m still designing the course as I go, so this semester is extra hard. (I taught a digital art lab class last semester, but the material was all provided for me.) Developing curriculum is hard! Luckily I’ve got a great group of students are we’re figuring it all out together. I’m also trying to bring in bits and pieces from the world I’m used to; un-conferences, open-source, hackerspaces, maker culture, DIY, etc. So far it seems to be working.

Photocell LED

As for these diagrams, I did them all with Fritzing. I also recently used Fritzing to design and fab a circuit board. Since it’s proven so useful to me, and using it has somehow become part of my job(s) I wanted to contribute. I donated some euros to the project. I wish I could do more, but perhaps in the future I can contribute more than just cash. Still, it’s a start!

2016.01.25

Video Installation

Last summer Ray Chi got in touch with me about an installation he was doing for the Milwaukee Art Museum. He wanted a video screen that could be activated to play a video by touching a metal plate. Well, actually six videos and six video screens and six metal plates.

I told him I’d figure out how to get it all to work the way he wanted. I came up with a few ideas, one of which was using Processing, which I did get working, but at the time Processing wasn’t really running on the Raspberry Pi, at least not officially (or very well) and since the Pi was what we ended up choosing, I needed another solution.

For an installation that’s going to be running for years, simplicity and reliability are key. I had used Pis in the past many times for video players using omxplayer. Typically I’d just launch omxplayer on boot and have it play a video, looping, forever. For this application we wanted the video to play only when the metal plate was touched by a human hand (and then stop playing when someone stopped touching it) which meant capacitive touch.

Rather than spend a lot of time coming up with something that might work, I went with something that I was 98% sure would work. I used Adafruit’s Standalone Momentary Capacitive Touch Sensor Breakout attached to a Teensy LC. Why a Teensy LC? Because it’s a low-cost (LC!) Arduino-compatible microcontroller and it can emulate a keyboard.

Yes, a keyboard! If you have a USB keyboard connected to a Raspberry Pi computer while omxplayer is playing a video, you can just hit the space bar to play the video, and then hit it again to pause the video. Those are the two things we needed to do.

Video Player Controls

So, Raspberry Pi, running omxplayer to play the video, with a Teensy LC attached programmed to work as a USB keyboard, and triggered by a capacitive touch sensor, which was then connected to the metal plate. Simple!

There was this issue of……. timing.

So in theory, the Teensy would just need to send a space character to play the video, and it would do this when you touched the metal plate. But! (And it’s a Big But) the issue was that we wanted the video to start playing at boot and then pause at the beginning and sit there waiting… for someone to touch the metal to start the video playing. Rather than fire up the video via the typical Linux methods, we ended up just starting up the Pis, auto-logging in, and having them wait at the command line… yes, just sit their waiting, doing nothing… Sort of.

When the Pi booted up, it provided power to the Teensy, which then started running its sketch. The sketch would start at boot, wait 45 seconds to ensure the Pi was booted up and sitting there waiting at the command line, and then it would type:

/bin/bash /boot/video.sh

So we actually used the Teensy to send the text to the Pi (just as if a human typed it) which then fired up the script and started the video playing. The sketch would then wait 2.4 seconds and type a space character, which would pause the video. This set the state of things exactly where we wanted them. The video way paused, just waiting for the next command from the Teensy, which was… space, of course!

Now, there’s the concept of “rising edge” and “falling edge” when it comes to pressing buttons. A rising edge is the transition from low to high, and a falling edge is the transition from high to low. That’s a fancy way of saying we can tell when the button is being pressed, and when it’s being released. It’s best to use debouncing for this, and there’s a library for that.

Video Players Mounted

So with everything mounted in place we still had to deal with one issue. The HDMI displays worked find as long as they were turned on before the Raspberry Pi computers. If they were turned on at the same time the resolution wouldn’t set right, and the video would be letter-boxed. There were two options, one would be using two different power strips to get power to everything, with instructions for museum staff to follow a specific order. This wasn’t ideal, so we went with option two. I used a time delay relay so that one single power strip could be turned on, which would turn on the HDMI displays, and then a few seconds later turn on the computers. It worked. (And yes, I found out later I probably could have fixed the issue in software. Duly noted.)

Are there things we could have done better? Yes. Did we get the project done on time, and within (or under) budget? Yes. Was it fun and challenging? Yes and Yes. You may read this and think “Hey, you totally could have solved problem X by doing Y!” and you’d probably be right. I’ve found a number of things I’d do slightly differently if I were to do something like this again. That’s all part of experience, and learning, and sharing… right?

Video Player

When the installation was all done and tested, I got photos of everything, and then set to work on documenting it all. I delivered a 14 page manual on the construction and operation of the video players, along with the code and instructions on how to use one of the backup SD cards that was prepared in case of failure.

Besides, now I can (sort of) say that my work is in the Milwaukee Art Museum. ;)

2015.12.09

Teensy

I’m working on a new exhibit that will be using an Arduino (actually, a Teensy++ 2.0) to talk to an application running on a PC via serial data. The Teensy will be sending one byte to control the application’s behavior. This is an upgrade from an older version where the Teensy just sent keystrokes to the application. The nice thing about sending keystrokes is that it was very easy for anyone to troubleshoot because they could just open Notepad and press some buttons to see if they were sending any output. The bad part was that if a normally closed switch was open, it would just stream characters to the computer, which could make things hard to troubleshoot for some people.

ATMTester

To deal with the troubleshooting issue (which will eventually come up, as it always does) and make it easy for non-technical people to view a serial data stream, I wrote a simple application in Processing that reads the byte and displays the value, along with the status of each physical control of the exhibit.

ATMTester

The exhibit should always have the Teensy plugged into COM3 on the PC, but again, once something leaves the shop we never know what strange things might happen. When the application starts up it will present a dialog showing the COM ports, and asking you to select the correct one. If you select the wrong one it will just display nothing. This should be enough to help troubleshoot things via phone or email.

The trickiest part was the code to choose the COM port. (I know, we don’t call them “COM ports” on Mac OS X, and yes, the application works fine on Mac OS X, that’s another thing I love about Processing.) The code for choosing the COM port came from this forum thread How to let the user select COM (serial) port within a sketch?.

I did have to install Java to get the application to run, but it looks and functions like any other Windows application. Here’s hoping this all works and never has to be used, but is there just in case…

2015.11.22

Click Whir Squee

Occasionally I show up at Milwaukee Makerspace with no clear idea of what might happen when I’m there. This piece, titled “Click Whir Squee” is the result of one such visit. Another member brought in a box of old computer hardware, including a Hewlett Packard Colorado T100E Tape Backup Drive. Being a fan of old technology (1997 is old, right?) I opened up the drive to take a look inside. I also powered it on and stuck a tape in it. The drive came to life and unspooled the tape and made a lot of spinning motor and tape loading sounds. Not everyone knows what these things sound like. It brought back some memories. (At my first job in the tech industry I had to load daily backup tapes into two tape drives. I remember the sound fondly.)

I somehow decided I should mount the tape drive to a piece of wood for display, so I went to the Wood Shop and started cutting up some scrap wood I found. Steve showed up to do some training, so I sat in on that for a bit so I could use the compound miter saw and the band saw. I had all the pieces cut by the end of the evening and knew how I was going to mount it.

I ended up taking all the pieces home and assembling it in my basement workshop. I manage to only split one piece of wood. Just a minor split, but a reminder to slow down when working with wood. The rest of the assembly went very smooth.

Click Whir Squee

Since the majority of fun with this drive is the startup sequence, I decided it should continually turn on, do its thing, then turn off, and keep repeating that. I’ve been playing with ATtiny85 chips lately, so I put one into service to trigger a 5 volt relay (which I also grabbed from Milwaukee Makerspace) and put the following Arduino code on it.


/*
 * TapeDriver.ino
 */

int relayPin = 3;
int onTime = 70000;
int offTime = 15000;

void setup() {
  pinMode(relayPin, OUTPUT);
}

void loop() {
   digitalWrite(relayPin, LOW);
   delay(onTime);
   digitalWrite(relayPin, HIGH);
   delay(offTime);
}

Yes, this is pretty much a glorified blink sketch. Sometimes the simplest things are exactly what you need. (Astute readers will see that the device will be on for 70 seconds, and then off for 15 seconds, and repeat indefinitely.)

Click Whir Squee

To power the ATtiny85 and the relay I found a Samsung phone charger on the Hack Rack at Milwaukee Makerspace. It even had a long cord, which was quite useful. You can also see one of the tapes that this machine uses. Now, if you really want to find some contrasts, consider that the modern day phone charger pictured here was used to charge a phone that probably had 8GB (or more) of solid state storage. The tape next to it could store 400MB of data (or 800MB of compressed data.) I should have included a MicroSD card which can store 8GB of data that I routinely buy for about $6 USD.

Click Whir Squee

Click Whir Squee

Since I removed the case there was no indication of what this thing was. I felt I should have something that told a bit of the story. I chose to mount the beige power pack, with “Hewlett Packard” emblazoned on it prominently.

Click Whir Squee

Oh, and while the whir of the motor is quite satisfying, we can do better. There is a wooden arm to which you can affix a small piece of material with a binder clip, which will then be activated when the primary motor spins. Fans of baseball cards and bicycle spokes, this one is for you! I call the “Annoy-o-tron” mode. (Look, if you’re going to use an ATtiny in an Annoy-o-tron, at least be original, right?) I’ve experimented with paper, vinyl, and plastic, but finally settled on a piece from an anti-static bag which some electronics were shipped to me in. It seemed fitting.

Click Whir Squee

Click Whir Squee

Click Whir Squee

Gallery owners and curators take note! This piece is ready to be mounted to a wall, and needs just two outlets to power it. It’s pretty much guaranteed to amuse some visitors while annoying other visitors. Art isn’t always about being pretty.

Enjoy the video below which allows you to experience this wonderful piece over the Internet while in the comfort of your own home (probably while wearing pajamas.)

2015.11.15

Sensors

I recently prototyped a device to read cards (physical cards with printing on them) for a project. I used five SparkFun Digital Line Sensor Breakout Boards attached to a 3D printed mount and wired up to an Arduino.

Card and Sensors

The cards have five blocks at the bottom, which are either black or white, representing 1 or 0. Using ones and zeroes allows us to create a binary encoding scheme, so with five positions we use 1, 2, 4, 8, 16 for the values and can represent any number from 1 to 31.

Sensor Mount

I started by grabbing the image of the sensors from the SparkFun product page and dropping them into Inkscape (sized appropriately) so I could design the barcode part of the card, and so I could design the mount for the sensors.

Sensor Mount

Once I had a 2D design in Inkscape I exported it as a DXF file and used the linear_extrude command in OpenSCAD to create a 3mm tall plate, and then added another plate. It wasn’t perfect, but it was fast. I started the 3D printer while I got to work soldering…

Sensors

Sensors

Sensors all soldered up, mounted to the plate with 3mm screws, and wired to an Arduino via a breadboard. All of this is still prototyping stage. It doesn’t look pretty, but it worked and it was enough to test things out and do a demo.

Cards with Barcodes

Here’s an example of some card templates. Can you determine what number is being passed by reading it in binary? Since we’ve got 5 positions we can have 31 different cards… If you needed 63 cards, you would need 6 positions (and one more sensor.) 127 cards? That would be 7 positions and two more sensors. Any more than that and you might consider using the SparkFun Line Follower Array which has 8 sensors on a single board.

Card and Sensors

The total time to create this prototype was just a few hours from starting a design in Inkscape to 3D printing a piece, soldering up and mounting the sensors, and writing the code. (I also wrote a simple Processing application which read the serial output from the Arduino to display the card data on screen.)

« Older Entries |


buy the button:

Buy The Button

top recent artists: