Analog input expansion boards for Raspberry Pi


[Ken Olsen] needed a bunch of analog inputs for his model railroad project. He wanted to use the Raspberry Pi board, but alas there are no analog inputs available on the GPIO header. But there is SPI. So he used an online service to design his on Analog input expansion boards.

He mentions that Eagle can be a bit of a pain to work with. For this project he decided to give a try. This is an in-browser PCB layout tool which we looked at in a links post some time ago. The service lets you order directly from your in-browser design without the need to run gerber files or the like (boards are made using the OSH Park service). He’s very happy with the boards he got back. They feature a footprint for a connector to interface with the RPi.

The design uses MCP3008 Analog to SPI chips. Each has eight channels but [Ken] needed more than that. Since the service provides three copies of the board he made them modular by adding end connectors which chain the SPI and power rails from one board to the next. Don’t miss his full demo in the video after the break.

[Read more...]

Hardware SPI with Python on a Raspberry Pi


While the Raspberry Pi has very good support for an I2C bus, a lot of very cool chips – including the in system programmer for just about every ATtiny and ATmega microcontroller – use an SPI bus. [Louis] sent in a tutorial for getting hardware SPI on his Raspi, and even though it’s rather limited right now, it’s a step in the right direction.

Previously, [Brian Hensley] put up a tutorial for using the Linux SPI drivers with the Raspi. [Louis] wanted to play with SPI in Python, so he added a C extension to the spidev.c file (available here) that allows him to open an SPI connection, initialize, transfer, and close the connection.

After connecting an Arduino to the MOSI, MISO and SCK pins of his Arduino, [Louis] was able to transfer data from his Raspi over an SPI bus. It should be noted that a level shifter would be a really good idea here, but this is an excellent project if anyone would ever want to port AVRDude to Python.


The band’s name in lights, RGB LEDs to be exact.

A few of [michu]‘s friends formed a band named Kalikut Now and needed an awesome stage show. The band made a few 80cm-high letters of their band name, cut a few pieces of acrylic, and wired them up with a few LED modules. The work of connecting these letters to a computer and programming them fell on [michu], and we’ve got to say he did a pretty good job.

You may remember [michu] from his StripInvaders and PixelInvaders projects, basically a few RGB LED modules that can communicate with an Arduino over an SPI interface. With these huge letters, [michu] ran into a problem: he had 11 meters of cabling between the clock and data lines, far beyond the maximum recommended length for any datasheet.

[michu] looked around the Internet for common problems with SPI interfaces and found a lot of good advice from a lot of very smart people. The issue with the SPI bus was eventually solved by correctly wiring the grounds of his LED modules, building a few dead-simple SPI buffers, and reducing the clock speed of the SPI bus.

After countless hours, the band’s name is in lights, and RGB LEDs to boot. Everything can be controlled with Abelton Live, and looks absolutely fantastic as seen in the video after the break.

[Read more...]

Programming a microcontroller one bit at a time

Imagine you’re stuck on a desert island, hundreds of miles away from the nearest person, and you finally have time to finish that project you’re working on. You have a single microcontroller, but you’re lacking a computer and you need to program an ATtiny13. How do you do it? [androidruberoid] figured out how to manually flash a microcontroller (Russian, surprisingly good translation) using just three switches and a lot of patience.

[androidruberoid]‘s ATtiny13 – like nearly all Atmel microcontrollers – are programmed using an SPI interface. This interface requires four signals: SCK, a data clock, MOSI, the data line from master to slave, MISO, data from slave to master, and RESET. By connecting these data lines to buttons, [androidruberoid] is able to manually key in new firmware one byte at a time.

This technique of manually programming bits relies on the fact that there is no minimum speed for an SPI interface. In the video after the break, you can see [androidruberoid] manually programming an ATtiny13 with a simple program. It only lights up an LED, but with enough patience he could key in a simple ‘blink a LED’ program.

[Read more...]

Gaining low-level SPI access on the Raspberry Pi

Raspberry Pi - rpi

We’ve seen a ton of projects that interface hardware with the Raspberry Pi. But they usually depend on bit-banging. That means they toggle the pins in software to match a specific protocol. The thing is that the beefy Broadcom SoC that anchors the board has a lot of built-in peripherals that are just waiting to be used instead of bit banging. In this case, it’s the hardware SPI peripheral which can be accessed via the bcm2835 library for RPi.

One of the things that would have really complicated this process is the pin mapping between the Broadcom chip and the RPi GPIO header. Since not all pins are broken out, it was either luck or good design forethought that made all of the SPI0 pins from the chip available on the RPi breakout header. The library page (linked above) explains this well. But if you’re looking for more of a working example check out [EngineerByNight's] project with adds an accelerometer using hardware SPI.

Linux picture frame serves as wireless Raspberry Pi display

Here’s a novel approach to adding a display to your Raspberry Pi. Instead of using a wired display — either via the HDMI (which can feed a DVI port with a simple hardware adapter) or the composite video out — [Chris Bryden] decided to use Bluetooth to provide a wireless display. This really depends on the hardware that you have available. He snapped up a hackable digital picture frame for a song and used the 320×240 display for this project.

You can see the USB nub plugged into the RPi in the image above. It’s a Bluetooth dongle and there’s with a matching one on the digital frame. With the two networked in such a way [Chris] got to work setting up a VNC that would let him pull up the X desktop over the network.

This ends up being one of the best uses we’ve seen for the Bluetooth protocol, and the small screen offers a huge advantage over the use of a simple character display.

Salvaged LCD screen hacking

You can find all kinds of LCD screens in broken electronics. But it’s often a chore to figure out how they are controlled if you don’t have a working device that can be used to sniff the communications protocol. [Justin] grabbed this character LCD screen from an old Brother printer and decided to see if he could reuse it in his own projects. Luckily the driver card still worked so he patched into the LCD’s control lines and sniffed the signals when the printer is powered on.

He used the OpenBench Logic Sniffer for this project. It easily captured the data, and also provided analysis tools. The SPI analyzer managed to decode the command signals and message of “Please wait” that pops up at power up. After a bit of folly with the pin out of the display, he is now able to control it thanks to an Arduino library which he wrote. Check out the demo after the break to seem him scrolling through a bunch of different functions for the device.

[Read more...]