posts tagged with the keyword ‘raspberrypi’

2017.03.13

MMS WebCam

It’s been way too long since I posted anything about the Time Lapse Bot project. Here’s some good background info, if needed.

Time Lapse Bot 3, which I haven’t written about since 2011 (or maybe 2012) has seen a few upgrades. Don’t worry, it’s still running an ancient PowerBook G4 (how, I don’t even know) but we long ago upgraded to a Logitech C910 USB camera. We then added a long gooseneck to allow for easy adjust-ability. And finally, it’s also known as the Milwaukee Makerspace Webcam, and it published views of Milwaukee Makerspace at http://mkemake.us/webcam

But really, Time Lapse Bot 3 hasn’t changed very much in the past few years… probably because I’ve been working on Time Lapse Bot 4, which uses a Raspberry Pi.

tlbot4

Time Lapse Bot 4.01 made an appearance at Maker Faire Milwaukee in 2016, using a completely hacked together frame on one of my owl rolling chair bases, and it worked for the weekend, but I’ve got plans… I’ve got plans.

I’ve made a lot of progress with software, and picamera is something I highly recommend! I’ve also got TLBot4 automagically uploading to a server, just like the Milwaukee Makerspace Webcam (running EvoCam, which may be dead now, as the web site of the developer has gone AWOL) and it’s also doing the daily videos compiled from the still images. I’m 90% happy with the software… I mean, the last 10% is the hardest, right?

I’m also working on a new physical build of Time Lapse Bot 4, which will feature many mounting solutions, and an interchangeable wide angle lens for capturing crowds.

Hopefully I can get TLBot 4 up and running for an event in the next few months, but in the meantime, I’ll be testing it in my workshop. (And hey, it’s offline now, so what the heck!?)

Also, I used the knowledge and experience I’ve gained (especially from picamera) to create part of a museum exhibit that has been running trouble-free (knock on HDPE!) since November. Huzzah!

2016.12.14

T35TP4TT3RN

T35TP4TT3RN (aka TEST PATTERN) is a piece I created for Maker Faire Milwaukee in 2016. It consists of a Raspberry Pi single board computer connected to an old Sony broadcast monitor. (I got the monitor from another member of Milwaukee Makerspace who was getting rid of old equipment.)

T35TP4TT3RN

As I often do, I wanted to contrast old hardware with modern hardware. I ended up using a Raspberry Pi Model B which has composite video out via an RCA jack. I used an RCA to BNC adapter to connect to the monitor. The display is a whopping 640×480 pixels.

T35TP4TT3RN

I used the Raspberry Pi Slideshow technique and with most installations, I tried to do a good amount of testing beforehand, letting it run for days at a time. I came across an issue where the system would freeze, and it would get stuck on an image. I contemplated switching to display of a video, but really wanted to avoid that, so I set a cron job to reboot the Pi every 30 minutes. I figured that if someone saw the screen during reboot it would be an extra BTS sort of treat. (The Pi boots very fast.)

T35TP4TT3RN

I did end up altering the monitor a bit. I removed the case and broke out a bit of the battery compartment so I could slide the Pi and extra cable into the battery slots. Since I’ll probably never own the batteries for this unit, hacking it seemed like a no-loss situation.

Here’s a collection of a few of the test patterns that were displayed.

T35TP4TT3RN

T35TP4TT3RN

T35TP4TT3RN

T35TP4TT3RN

T35TP4TT3RN

2016.07.14

The Sonic Titan

You probably remember The Sonic Titan, which had its debut at Bay View Gallery Night. The details concerning the construction of The Sonic Titan were shrouded in mystery, just a hazy cloud of unknowns, but no more! Here is the story of The Making of The Sonic Titan!

The concept for The Sonic Titan was kicking around in my head for a long time. When Neil Gershenfeld talks about making, there’s this idea of personalization, and producing products for a market of one person. The Sonic Titan may have a market of one person, myself, and I’m fine with that.

speaker-box-01

The physical manifestation of The Sonic Titan started with this speaker cabinet I saw in the alley on my way home one night. One of my neighbors was throwing it away. I always like to build upon the detritus and waste of society, so I grabbed it.

speaker-box-02

As an electronics nerd, I loved the giant capacitor bank circuit thingies on the back. I considered using them, but it didn’t fit the aesthetics of the piece.

speaker-box-03

I grabbed a screwdriver, hammer, and pry bar and got to work tearing the speaker cabinet apart.

speaker-box-04

Mmmmmm, delicious fiberglass insulation! People really knew how to DIY speaker cabinets in the olden days!

speaker-box-05

Why not add some roofing shingles to your speaker cabinet? Glue then down with some weird industrial adhesive to keep them in place, because acoustical properties.

speaker-box-06

I got the speaker out in one piece. I didn’t end up using this speaker, but I’ve still got it on the scrap pile for a future project.

inside-doom

A fully formed cabinet emerges! I must have forgotten to take photos of the construction process. Basically after I broke apart the cabinet I rebuilt it into the size and shape I wanted with the help of the table saw, drill, and a bunch of screws. (Oh, and there was a fun adventure with the jig saw for the speaker holes.) I also grabbed some old scrap wood my brother dropped off at my garage about two years ago. The wood had all sorts of weird slots cut into it. (Thanks, Brother!)

Anyway, the above photos shows how everything is lovingly stuffed into the cabinet. There was no careful thought or long consideration about putting things in there. It was basically “jam it in and make it fit” the whole way. Mostly.

speakers-spades

Spade terminals come in handy for this sort of thing, and I had some handy, so I used them. The speakers came from Milwaukee Makerspace, which is always full of all sorts of weird old junk. The large fender washers are actually the scrap pieces from when I drill out Aluminum boxes to make USB controllers. Reuse!

raspberry-pi

Hey look, it’s a Raspberry Pi! Yes the “Doom Box” is Linux-powered, which seems appropriate for so many reasons. But seriously, folks… I love Linux. It allows me to do things like this quickly, easily, and at a low cost. Open source is a wonderful thing.

The Raspberry Pi is secured in place by… gravity? Yeah, it’s just sitting there. It’s got a Micro USB cable for power, and a 1/8″ cable for audio out.

power-supply

There’s a 12 volt power supply, this provides power to the audio amp, and to the Raspberry Pi. Wait, the Raspberry Pi needs 5 volts, not 12 volts… what!?

buck-converter

Oh look, there’s a buck converter which takes the 12 volts and knocks it down to 5 volts. These are handy when you don’t want to have two power supplies. Just split the 12 volt power and run to the converter and you get your 5 volts. Sweet!

screw-terminals

There’s a few of these screw terminal blocks. This one feeds the 5 volts from the converter to the Micro USB cable that had one end cut off. Just use the red and black wires from the USB cable for power… no signal wires needed!

audio-amp-01

Here’s the audio amp. It’s got spade connectors all over. Two for the 12 volt power, and 4 for the two speakers. I’m pretty sure I screwed this down to the board. Oh yeah, I did, we’ll get to that later…

audio-amp-02

It’s a Pyle cheapie audio amplifier. Nothing fancy or super-loud, but I had it in the shop so I used it. The cover was removed because I had an idea to mount it right up to the front and use the integrated volume potentiometer and add my own wooden knob. That worked until I broke things…

audio-pot

…so there’s a potentiometer that got added in to replace the one I broke. And it’s not a dual pot, just a single, and probably not the right resistance. When things break and you’ve got a deadline you grab whatever you’ve got available and get things done. (At least I do, or I try to.) Wires are delicately soldered because deadline.

greeble-slot-01

Some of the greebles were put into place to cover the gaps that were created when the cabinet was built because I didn’t have quite enough wood to do it right. I call the greebles a “feature”.

greeble-slot-02

This little greeble works well to stuff the extra cables into. See, “features”!

greeble-slot-03

And this greeble closes up the gap at the bottom… (Note: hard drive magnets are great for keeping random screws in one place!)

greeble-slot-04

And over here there’s a lovely gap for the power cord to exit. Mind the gap! Use the gap! Love the gap!

Is it mere coincidence the photo above and the Dopesmoker art below share a similar color palette? Probably… or… maybe not!?!?

dopesmoker-01

Check out that stoner caravan! I hope they are enjoying their journey! They should have a Doom Box to listen to!

vinyl-mask

I used Bauhaus 93 as the typeface that came close to matching the Sleep logo I liked, and made a few pieces of vinyl which were put on the wood so I could use them as stencils and spray paint on the name and labels. I like vinyl and stencils and paint. They work well together!

Wait, wasn’t there something about Linux? Of course there was! After I had the Raspberry Pi up and running with Raspbian I added mpg123 for playing the audio:

sudo apt-get install mpg123

I then wrote a long and complex script to start the audio playing and keep it playing forever by using a loop. Here’s the long and complex script:

#!/bin/bash
mpg123 --loop -1 /home/pi/Dopesmoker.mp3

I saved that script and then set it to run after bootup by adding a call to it in the /etc/rc.local file, right before the exit line.


/bin/bash /boot/playaudio.sh
exit 0

And that’s how I built The Sonic Titan. I hope you enjoyed the journey.

2016.01.31

Slideshow

I’ve been using Raspberry Pi single-board computers for video players for years now, and I’ve also used them as audio players, but I was missing a good way to use them as slide show devices… Until now.

I’ve used Screenly OSE for the MMPIS at Milwaukee Makerspace, and while Screenly is great for what it is (a network-connected, browser-controllable, digital signage device) sometimes you don’t want all the options and features and you don’t have a network. So I needed another solution.

I found fbi, “the Linux framebuffer imageviewer”, which can run at boot up and display a folder full of images at full screen with a configurable delay between changing images. Perfect!

Boot Volume

Now, there’s one more thing… If I’m going to put this somewhere that doesn’t have a network connection (like, in a museum) I want to be able to easily update the slides. The slides won’t be changing daily, but may be changing every month or so. For something like this it’s easy to store the images directly on the /boot volume, which is accessible on the SD card when you pop it in a Mac OS X or Windows computer.

You’ll notice a folder names “slides” and a file named “slideshow.sh”, which do the hard work here. It’s actually ridiculous to call it “hard work” because it’s dead simple. The slides folder contains images which will be displayed in alphabetical order. (Sadly, my screen shot does not reflect this!) In an ideal world you’d name your images 0001.jpg, 0002.png, 0003.jpg, etc. Just name them in order, and they’ll display in order. Easy.

Images

The SD card only has about 40MB of free space for you to put images on, but with JPG compression of photos, you can probably fit plenty of them. OK, so once you’ve got your folder full of images (which you can easily update on the SD card) you’ll need some way to run the slideshow.sh script.

Typically I do a sudo nano /etc/rc.local and add what’s needed to run my script. In this case it’s the /bin/bash /boot/slideshow.sh & you see on line 20. Oh, don’t forget to set the Pi to auto-login at boot. Since it’s been added to recent versions of Raspbian you don’t even have to muck around anymore.

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/bin/bash /boot/slideshow.sh &

exit 0

So yeah, we’re all set… but you probably want to see the code in slideshow.sh, right? This is it. Right here. Yes, it’s pretty much just two lines. Linux is like that sometimes… It’s not hard implementing something, it’s just hard finding out exactly how to implement something. It can be hard finding those two lines that you need! (The 20 may need adjustment. Longer may be better, but in my testing on a Raspberry Pi 2 Model B it worked well.)

#!/bin/sh

sleep 20

fbi -a -t 6 --blend 200 --readahead --noverbose -T 1 /boot/slides/* >/dev/null 2>&1

There’s some parameters you can set, like -t 6 which sets each slide to display for 6 seconds, and the blend thing, which sort of works. Hey, it’s a slide show, okay!?

I’ll probably work on this more, but I was pleased to find a solution so I thought it was worth sharing.

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. ;)

« Older Entries |


buy the button:

Buy The Button