Saturday, May 16, 2015

HDMI cables are NOT all the same!

Sometimes very cheap or thin HDMI cables do not work with the Raspberry Pi Camera extension kit I made. Even if a camera is correctly plugged at startup, the Rpi cannot detect the camera and output an error message. In this short post I will explain why and show a quick fix.

First a normal HDMI cable with 19 lines. This is the most common design. There are four data buses (one is hidden behind in the pictures) with 3 cables in each, a GND line and a GND shield. The HDMI connectors are also put to GND. The Raspberry Pi Camera extension kit works with this kind of cable.


Now, this is a smaller diameter (it was Micro HDMI before I cut it) cable with only 15 threads. This cable has 5 data shields but there are no GND lines in them! There is not GND shield, just a wrapping that was cut before taking the picture. The HDMI connectors are put to GND. This cable does not work out of the box with the Raspberry Pi Camera extension kit.

The trick to make the second cable work with the kit is to connect with a short piece of wire and solder the GND on the PCB and the HDMI connector. Of course this must be done on both sides of the cable. Et voila!
Even if there are no data shields, the quality of the image from the camera does not seem to be affected.



 If at this stage if there is no image from the camera it is time to ask me an exchange.

Note that I could have connected the HDMI connector to GND by default, I decided against this. For safety reason I try to avoid connected metallic parts floating around.  

Thursday, April 16, 2015

The Raspberry Pi Camera Extension Cable


The Raspberry Pi camera is wonderful;  video and still images are high quality and the functionality of the camera can be controlled with shell commands or using the Picamera Python module.

The flat ribbon cable that connects the Pi to its camera is fine for short distance but it is hard to find longer versions (Adafruit has a complete line-up), and it is fragile and sometime hard to place in a design. I needed a longer and stronger cable with solid connections for my designs. For example, I want to use the Pi camera in my garden or close to heavy machinery.
 
Searching the web I did not find anything usable for my applications. However a thread on the Raspberry Pi forum gave me the idea to try using an HDMI cable for extension. Surely an HDMI cable would be convenient, it can be purchased at a low price in local stores in length up to five meters.


By comparing the diagram of the Pi Camera connector with an HDMI connector one can see that both have four data buses made by pairs of cables with a ground shield.






Please read Peter Vis's very informative and detailed article on the Raspberry Pi CSI camera module and connection for a complete description of the bus.


The design I made put the right cable at the right place to transform the flat ribbon into a round cable. There are four pins left since HDMI has 19 pins, these may become handy to use a few sensors close to the camera.

I have tested successfully simple 5 meter HDMI cables, cheap or expensive cables work the same. The video signal should not show any degradation until a certain distance (yet to be found). Passed the limit the video signal will be lost entirely.



I made a kit available on Tindie, so far it sells very well! It looks like I wasn't the only one in need of something like this.


I sell on Tindie

Tuesday, May 13, 2014

32x32 RGB LED matrix, Painting with Light

Here at last is my 32x32 RGB LED attempt. I bought a while ago a matrix from Sparkfun with the idea to use the Teensy 3 to control it (the code posted below does not work with Arduino).

I have seen quite a few projects with LED matrices, specially the Pixel V2 or the GameFrame and the QR clock. All these projects are quite impressive, each offering something a bit different. My idea is to make a bit of each while keeping things simple and cost down, the total was around 100$.

- Like for the LED cube I made last year, I wanted an interactive drawing system where my son can paint in Processing and pass the pixel data through the Serial interface.
- In addition I tried to separate each LED to have a "cleaner" lighting; I removed the matrix front panel and replaced it by a laser cut grid. This gives the "square" look of Pixels we are familiar with. Then I covered the grid with two sheets of tracing paper to "blur" the lights (if someone has a better idea, please...)


- Since the Arduino library made by Adafruit does not work with the Teensy at the momen; I first wrote a code which helped me understand the working of the matrix but was two slow and flickered a lot. Then I found the code Markus Lipp published, thanks again. After a few tweaks, here is a simple sketch which will display an image and allow to change the color of each LED with a Serial message. With some additions, the code can also display animations from Serial or an SD card at 24bit colors and with a good frameRate.


Can you read this QR code? I am using the QRduino library to generate QR codes. With the Teensy RTC capability it is possible to make a fun clock!

 

Here is a Sketch for the Teensy 3 or 3.1. I use some pins which are underneath for the matrix, so that I still have the SPI pins for an SD card and Serial 2 to play with Bluetooth.  If you want to use this code with the top pins only, you can change PORTB to PORTC.

Wednesday, April 30, 2014

Teensy 3* Development Board & Arduino Shield



I needed a breakout board to access all the [Teensy](https://www.pjrc.com/teensy/teensy31.html) 3 and 3.1 pins, and I needed a board to plug Arduino shields with the Teensy. This board is not "Teensy" small but has a lot of space to design many circuits. All the Teensy pins from #1 to #33, VBAT, Program, A14/DAC or Reset on Teensy 3.0 are connected.
Finally there is a lot of space left open for prototyping.
First I ordered a few boards for myself, and found them very useful to convert the unique breadboard prototypes I have for many projects around the house into more permanent installations. 


I thought this device could be a good candidate to experiment with Tindie, so I started a shop for it and will report about this adventure in e-commerce when I have a bit more feedback. There are a lot more details about this board in Tindie.
I sell on Tindie

Sunday, December 29, 2013

LED CUBE

I have been playing with many WS8211 RGB LED. Thanks to the Teensy3 which is programmed exactly like an Arduino and the OctoWS2811 library it is very easy to control strips of LEDs and display any kind of animation in realtime. Since Paul Stoffregen (maker of the Teensy, thanks again) and others have already built many wonderful projects with these LEDs I had to come-up with something a bit original.

Few month ago I decided to build a cube made of hand-built 8x8 LED panels (Adafruit did not sell their panels yet). I ordered from AliExpress 500 LEDs and spent a few evenings with my soldering iron, a bit repetitive task but its a hobby so I can't complain. A 5V 60W power supply was also purchased from the same vendor, the cube can use around 6 Amperes when fully white.
Note: I paid 0.12$ per LED at the time, now it seems the price almost doubled! 



Here is the cube almost finished. It was first assembled with hot glue which melt after 5 minutes of use! This think can get very hot. Everything is now assembled with transparent Silicon caulk, so far so good and it is easy to dismount for maintenance.

My first animation test was to play Space Invaders; the faces are animated like in the game. Each face is an array of 64 binary values, and there are eight arrays for the scrolling motion of each alien.

It's hard to evaluate on the picture but these LED are very bright, almost painful to watch, certainly too bright for kids eyes.

To reduce brightness and give a nice blurred effect I covered the faces with a white somehow opaque film supported by a simple frame. My idea was to give a Japanese lantern style of light. 



I decided to complete this project before Christmas, indeed the cube is a nice addition to the Christmas tree. A simple loop of random colors switches the lights every second, finally my kid was amazed... a little.



Programming the Cube 

Since my kid is a fan of Minecraft, I thought that he would be happy to paint cubes like in the game; so to make the device more interactive and interesting, my intent was to build a realtime "pixel paint" application for 3D objects. 

I coded a small application with Processing to represent the cube as a map. One can choose a color and just paint the faces. The LEDs are lighted in realtime, by Serial communication. I added a cheap bluetooth module for remote programming, et voila! 










Here is the code I wrote (in part) for this project. There is a Sketch for the Teensy 3, it needs the OctoWS8211 library. The sketch is a simple adaptation of an example given with the library.
The wiring of the Teensy 3 follows the recommendation to use a 74HCT245 to convert 3.3v signal to 5v for the LEDs and 100Ohm resistors close to each pin. 
The sketch for the Teensy 3 CubePaint.ino

Then the Processing project to send colors by Serial communication to the Teensy 3. The color wheel was copied from an example by Ira Greenberg This sketch shall work with any micro controller connected to Serial. Should be re-wrote with objects for clarity and easy update.
The Processing project CubeCross

Friday, April 15, 2011

Petitduino, another breadboard friendly Arduino

 This is my attend to build a small and simple yet complete version of the Arduino.  Browsing the Internet I found quite a few versions of Arduinos; the Freeduino page has an impressive list of very exotic variants. Also there are already very similar boards for sale, it was very rewarding and instructing to come-up with a design optimized for my needs.  What I wanted is a board easy to mount on a breadboard and also pluggable into standard IC sockets for projects (this time the Arduino is the Shield).

All the components can be hand soldered, the circuit has one side only and the traces are wide enough to be printed with the hot iron method. This is a real "Do It Yourself" version of everyone's favorite controller.
Programming is done with a FTDI cable or FTDI adapter. There is a LM7805 to convert supply voltage to 5 volts; however even if the crystal is 16Hz, it seems that the ATMEGA328 will accept to run with 3.3v. 

Now I plan to build a few boards and leave them embedded in all the projects I have around.