Saturday, October 26, 2013

Teardown: ZIF Socket

I recently designed a ZIF programmer for an ATmega328p. This will mainly be used for programming the TinyISP-Tuner and preloaded ICs for the FriedCircuits shop. One problem I ran into was the footprint for the ATmega328p has smaller drills than your standard 0.1in headers, which the ZIF socket would fit in. In trying to make it, fit I messed up the metal clips inside the ZIF which made them closed all the time. So here is a teardown of the ZIF socket as I took it apart to fix it by bending the metal clips back into shape. These are from Adafruit Sparkfun sells them as well.


ZIF socket all parts

Sunday, October 20, 2013

Raspberry Pi Camera Module and Streaming

Now that the camera is connected it's time to test it. I have always liked setting up a camera for real-time streaming, plus it's helpful whenever I am away on a trip. With the PIR project, I could use that to record on motion instead of using image based motion. This would allow for no false positives, unless of course you have animals.

You can use the standard mjpg-streamer but it can't read from the camera module directly and therefore you need to save a file and then read it back. This would be a fast way to wear out your your SD card. I knew there had to be a better solution. Then low and behold I found this:

https://github.com/jacksonliam/mjpg-streamer

He wrote a module that allows you to stream directly from the camera module. It's not the fastest but it works.

From your home directory:

git clone https://github.com/jacksonliam/mjpg-streamer

$ cd mjpg-streamer/mjpg-experimental

$ make clean all

To launch

$ export LD_LIBRARY_PATH=.
$ ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"

Connect via your browser

http://RPi_IP:8080/


I created a mjpg.sh file in my home directory that contains the above and then made it executable:

$ nano mjpg.sh
#!/bin/bash
cd ~/mjpg-streamer/mjpg-streamer-experimental
export LD_LIBRARY_PATH=.
./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"

$ chmod +x ./mjpg.sh

You could also add this to crontab to have it start with the system.

$ crontab -e

then add

@reboot ~/mjpg.sh


You can use VLC as a streaming client but there is a much greater delay due to buffering. This might be adjustable, I just haven't checked yet.

Raspberry Pi Camera Module + PiBow

Previously I show how to mount the Raspberry Pi module in the Pimoroni camera mount, but now we need to connect it. Connecting the camera to the RPi is pretty easy if you are careful and there plenty of guides, but I wanted to use it with the Pibow case. The new PiBow cases have a slit for the ribbon cable but if you have the older version, you can make it work. Here is how I did it:




Check out this post about using the camera and real-time streaming with mjpg-streamer.


Sunday, October 6, 2013

TinyISP-Tuner

In my recent experience with the ATtiny2313, I had problems with the serial communication at 8Mhz. Which in turn my research led me to learning about tuning the internal oscillator. The ATtiny is a small microcontroller by Atmel, the same company that makes the ATmega328p in the Arduino UNO. It doesn't have all the features but it is cheap and great for embedding in projects. Here is a link to more info on them: http://www.atmel.com/products/microcontrollers/avr/tinyavr.aspx . The great part is that there is a add-on for the Arduino IDE called Arduino-Tiny. This way you can use the same code with the ATtiny's.

After some trial and error and some help from the forms, I was able to figure out how to tune the ATtying2313 and get reliable serial communications. As a result I decided to design a kit that makes it much easier to tune.



The TinyISP-Tuner connects to your computer via a FTDI cable and has an ATmega328p as the controller. The ATmega328p is running the TinyISP sketch with tuning and KnockBang. KnockBang allows you to pass serial debug info via SPI over the FTDI cable to your computer. Very convenient. When tuning is enabled there is a 16ms pulse sent out to the ATtiny you are programming. Plus you can program the ATtiny once it is tuned with your sketch. All with this one kit.


Supports ATtiny84/44/24, ATtiny85/45/25, and ATtiny2313/4313.

Kit Contents:
1x PCB
1x 6pin Right Angle header for FTDI programming
1x Atmega328p DIP (Pre-programmed with TinyISP configured for tuning)
1x 16Mhz Resonator
2x 0.1uF Capacitor
1x 10K Resistor
1x 330Ohm Resistor
1x Red LED
1x 20pin socket
1x 14pin socket
1x 8pin socket
1x 28pin socket



Check out the guide: http://friedcircuits.us/docs/tinyisp-tuner/
If you want to buy one: https://www.tindie.com/products/FriedCircuits/tinyisp-tuner/

Friday, October 4, 2013

PiGlow from Pimoroni

In a recent Adafruit order I couldn't resist picking up the new PiGlow for the Raspberry Pi. This is a neat 18 LED add-on that connects to the GPIO header of the Raspberry Pi and communicates over I2C. With the example Python code, I was blinking in color in no time.

You can buy them from Adafruit in the US or directly from Pimoroni in the UK. The Pimoroni site has all the links to get you started. I used the link to Jason Barnett's Gihub which has a in depth how-to and a lot of examples to get you started and playing in color.



The LEDs are in a spiral pattern, making for a great binary clock, which is included in the code examples. I ended up taking it to work leaving the clock to run all day. Within the clock example you can set the LED brightness. All of the 18 LED brightness can be set from 0 to 255. I can tell you that 255 is super bright, I mean especially bright, as in put on your sunglasses. Especially the white LEDs in the center. Which just made me think of one cool project. With a PIR and light sensor you could make a hallway light, and even tweet when it is activated. That is how bright the white LEDs are.

All the LEDs are a single color. Starting from the center you have white, blue, green, yellow, orange, and red. Plenty to play around with. One great feature is that if you have their PiBow case, it fits with the case completely closed.



I think its a great addition to the Pi and there is so much you can do with it. The only thing I would like to see is maybe a version that doesn't block all the GPIOs with maybe a stacking header. It only uses power and I2C but you lose access to the rest. You could use a breakout like Adafruit's Cobbler or T-Cobbler and then connect the needed connections to the PiGlow.

This can be a great learning tool for someone new to the Raspberry Pi and Python. You can learn Python with instant feedback.