Raspberry Pi

Raspberry Pi related posts

Raspberry Pi 3 Mini Cluster

I recently constructed a mini cluster consisting of 3 Raspberry Pi 3s.  I am planning on using these machines for various little projects.  I’ve installed some services on one of the nodes.  Currently that node hosts Redis and RabbitMQ instances.  I’m sure that I’ll have other services to install in the near future.  I may even use it to tinker with clustering those services.  Below are some pictures of the cluster as I was putting it together and a parts list.


Posted by Chad Dotson in Raspberry Pi, Technology, 0 comments
Raspberry Pi 7″ Touchscreen Unboxing and Thoughts

Raspberry Pi 7″ Touchscreen Unboxing and Thoughts

This week I ordered and received the official Raspberry 7″ touchscreen ($60).  I’ve been tinkering with some ideas for it (some car based projects) and wanted it on hand to try out.

Opening the Box

The screen is packaged and presented really well.  It comes with all that you need to connect and power it from the Pi itself.  It comes with 4 screws to mount the Pi, the ribbon cable to connect it to the Pi’s DSI port, and 4 jumper wires, 2 of which are for powering the display on the Raspberry Pi 2 B+.  The other 2 are used when attaching the display to an older model A or B.

The Screen Itself

The screen itself seems really well made, I’m really impressed by it.  The LCD side seems pretty sturdy and the backside seems better than I would have expected.  Mine has a little give around the are the ribbons from the control board enter the LCD itself, but its nothing to complain about.

Connecting It All

In this case with the Raspberry Pi 2 B+, the screen connects easily via DSI ribbon and 2 jumpers to 5V and ground.  Once wired its an easy job to mount the Pi onto the screen.  In these pics you also see my cheap wifi and old keyboard dongle.  I think I will want to buy a good Bluetooth adapter and keyboard shortly.  I found a really need looking one here: http://www.amazon.com/gp/product/B00BX0YKX4.

Up and Running

Once all connected, the Pi boots right up to the console.  At this point you need the external keyboard to actually login and run startx, unless you’ve already configured Raspbian to do so.  You will also need to install a virtual keyboard like Florence or Matchbox.

Using It

The biggest shortcoming is the need for a physical keyboard, like I mentioned in the preceding section, and it is probably the biggest drawback.  The out of the box touch features seems only to augment physical keyboard functionality.  That’s because unlike Android or iOS, the virtual keyboard isn’t dynamic, it is either always there or not.  I suppose that a custom interface would be more touch oriented.  The one oddity I have found is that counter to other touch screens, the hotspot for a touch seems off and to me it seems more exaggerated near the edges of the screen.  It’s not a show stopper, but takes some getting used to.

Overall Opinion

After getting it all hooked up, I found that it seems a bit clunky.  It left me wondering if a better solution isn’t just a raspberry pi running as a server and using a Android or iOS device as a head.  However, assuming you stick with the Raspberry driving its own display, a longer cable might be desirable, depending on your project.  In that case a regular HDMI touchscreen with usb connections might be the better fit.

The lack of good cases is also a problem.  Nothing I have found yet, fully encloses the pi and the display.  Coincidentally, I had an old project box laying around that seems to fit almost perfectly.  At 7.5″ x 4.3″, the Hammond 1591ESBK‘s dimensions are only a little shy of the actual dimensions of the displays bezel (less than 0.25″).  I’ll post new photos if / when I do that.

Other Resources:

Posted by Chad Dotson in Raspberry Pi, 0 comments

Hardware vs Software – A Realization

I spent some time over the past year tinkering with Arduinos and Raspberry Pis and had a bit of a realization: Hardware circuit components are simply the syntax for creating physical devices.  As a software person, putting hardware into that context has really given it a lot of meaning.

Posted by Chad Dotson in Arduino, Raspberry Pi, Technology, 0 comments

DSLR Lightning Trigger

June 15, 2011 Lightning CompositeLightning

I use my Nikon D5000 to take a lot of lightning photos.  This one to the right is a composite of several taken during a storm that produced a good amount of of photogenic lightning a few years back.  The photos that make up this one and many of my others were created using timed exposures of up to 30 seconds on length.  This is problematic, at times, due to other light sources, camera movement, etc.  Using simple, arduino-based circuit, we can create a device that will attempt to detect lightning strikes and trigger a camera shutter when one is detected.

Prototyping The Circuit

This circuit consists of 2 major pieces: lightning detection and shutter triggering.  To detect lightning, a phototransistor or photoresistor is required.  For this project, I used a photoresistor.  To trigger the shutter, a 940nm infrared LED is required.  These LEDs can be used to trigger cameras from Nikon, Canon, Pentax, Olympus, Minolta, Sony and possibly others.  Below is the complete parts list I used along with links to them on Amazon.


  • Arduino UNO R3 (buy)
  • Photoresistor 5mm GM5539 (buy)
  • 940nm Infrared LED (buy)
  • Yellow LED (buy)
  • 1 – 200 Ω Resistor (buy)
  • 1 – 100k Ω Resistor (buy)
  • Miscellaneous jumpers and breadboard (buy)


The Code

This circuit’s method of detecting lightning with a photoresistor is pretty simplistic.  It simply loops infinitely recording the analog input from the photoresistor, taking the difference of it to the saved value, and comparing that to the configurable threshold.  In its current configuration, it will take 2 photos per lightning strike.  This is the first iteration of this code, so I may change it to use a moving average instead of just the last recorded value.

To fire the IR LED in the right sequence, I used the Multi-Camera IR Control Library since it supports my Nikon D5000.  In addition to the D5000, this library supports Nikon, Canon, Pentax, Olympus, Minolta, and Sony cameras. If you don’t have a camera that is supported, a custom interface could easily be created with specifics for your camera model.


To The Field

Since the protoype is fully functional, I plan on fielding it during the next thunderstom.  I will report back once I see how it works along with any refinements.


As always, I have placed the code and diagrams for this project in a github repository.  It includes code that can be compiled and uploaded via the Arduino IDE and diagrams that can be viewed or edited with Fritzing.

Other Posts in this series:

Posted by Chad Dotson in Arduino, Hobbies, Photography, Programming, Raspberry Pi, Software Engineering, Technology, 8 comments

Comparing Node.js and Python on the Raspberry PI

Picture of my simple led circuit connected to the Pi.

Picture of my simple led circuit connected to the Pi.

Programming on the Raspberry Pi

Python seems to be the more popular language for writing programs on the Raspberry Pi.  However, it is far from the only language: Python, C, C++, Java, and Ruby are some that are automatically supported out of the box.  As it turns out Node.js is also supported.  Perhaps, just based on my preconceptions, I didn’t originally consider JavaScript when interfacing directly with hardware.  The goal of this article is to compare functionally equivalent sample programs written both in Python and JavaScript.


The Goal

I decided to make the scope of the problem created for this article as small as possible.  Given that the goal will be to create simple circuit diagram consisting of a LED and then to write a program that makes the LED flash for a specified period of time.


Simple LED circuit diagram

Simple LED circuit diagram


With the Pi, a circuit that will make a LED flash is relatively simple: Consisting of just a LED and resistor.  I arbitrarily selected pin 7 on the Pi for this build.  I’ve included a diagram of it on this page.



As the goal states, the following two implementations do nothing except toggle an LED at half the specified duration (0.5s) and automatically shutoff after 60 seconds.



Since Python is the more traditional programming language for the Raspberry Pi, let us start with it.  The Rpi.GPIO module I used can be installed via pip.  Before you read the code sample, let me point out some things about the implementation.  Could it have been done simpler given that the problem was just to make the LED flash for a certain amount of time?  Yes, but I wanted to create something of an asynchronous process that could be controlled from outside its execution context.



I used pi-gpio to interface with the GPIO on the Pi in JavaScript.  It can be installed via npm. It makes use of gpio-admin so that your script doesn’t have to run as sudo.  Follow the installation instructions provided here and it should get you setup.  Note that due to differences int the languages, it was not necessary to thread (web workers) the solution.


The Findings – I was surprised

When I started writing the JavaScript side of this article, I was mainly doing it to gain experience working with JavaScript on the Pi.  I did not expect to come out of it vastly preferring it over my python implementation.  I find the Python implementation above to be to wordy and overcomplicated.  It just seems that the amount of code needed to achieve the same results is excessive.  Perhaps this is because of the problem scope and implementation.  The problem posed here was a simple one, where a functional solution is superior to an object-oriented one.  Could the Python code above be rewritten into something a bit more functional? Sure!  Are there problems that an object-oriented Python or JavaScript implementation would be the better solution for?  Definitely.  The lesson to take away: be open to working outside your comfort zone and pick solutions to problems based on their fit for the problem not your comfort level with them.

I’ve created a copy of the code as a Gist that is available here: https://gist.github.com/chaddotson/570501a3e3dcfe8928c8

Posted by Chad Dotson in Key Concepts, Programming, Raspberry Pi, Software Engineering, 8 comments
My First Raspberry Pi Project

My First Raspberry Pi Project

View of the whole setup

View of the whole setup

Almost every year, I try to select a fun project to do while off for Christmas. This year the project I selected was based on Raspberry Pi.  Specifically I decided to build a device that would, when motion is detected, find the range to the motion using an ultrasonic rangefinder, take a picture using the camera module, and finally email me the results.

After just a few hours of work, I had separate proofs of concept working for each sensor written in Python.  A short time after, I started combining all the proofs of concept into a consolidated script which I got working.  Right now I am perfecting the classes for interfacing with the range finder and the motion detector and I am currently using picamera 0.8 for interfacing with the camera module.  I’ve included a link to the git repository I’m using for source control below.


  • Raspberry Pi Model B
  • Raspberry Pi 5MP Camera Board Module
  • HC-SR501 Human Sensor Module Pyroelectric Infrared
  • SainSmart HC-SR04 Ranging Detector Mod Distance Sensor
  • 5 180 ohm resistors
  • Breadboard and miscellaneous connectors

Source Code: https://github.com/chaddotson/PiPy


Posted by Chad Dotson in Featured, Hobbies, Neat Stuff, Raspberry Pi, 0 comments