Tag Archives: Raspberry Pi

Pi Maker Workshop and RasPi resources

One of the most interesting things I did all summer was a workshop called Pi Maker that I conducted as a launch event for a new MakerSpace in Noida (close to Delhi, India). Helping a group of people visualize the endless possibilities in the world of DIY electronics by using the Raspberry Pi as a medium, was in itself, quite rewarding. ๐Ÿ™‚

The main content for the workshop was provided by Inventrom robotics initially, which I modified to include all that I’d discovered and learnt in these past few years of working with the Pi. I also had a lot of support from RobotechLabs in Delhi to help setup this entire event.

I’ve uploaded the material on SlideShare and anybody looking to get started with the Pi from scratch (no electronics/programming past experience) or maybe on the hunt for some inspiration can have a look at them ๐Ÿ™‚ Feel free to share and use but please don’t modify the slides in any manner that removes the existing watermarks.

Here’s a link to the first presentation in a set of 6:

http://www.slideshare.net/mayankjoneja/1intro-37584027

Head over to these websites and check out the cool work they’ve been doing too!

http://raspberrypiworkshop.inventrom.com/
http://inventrom.wordpress.com/
http://www.robotechlabs.com/

https://www.facebook.com/makerspacenoida
https://www.facebook.com/inventrom

In order to draw in more participants, here’s a sort of promotional video that I’d cooked up :

I’d promised to put up the relevant explanation for this Intruder Alert system, and here’s my shot at it.
Here’s what happens when a person tries to enter my room:

  1. A PIR sensor detects a human presence which sends a signal to a GPIO pin on the Raspberry Pi
  2. The Pi communicates with the Arduino via serial and also plays a wailing siren from omxplayer
  3. The Arduino Uno, on receiving data from the Pi through a USB cable, switches on the christmas lights on the floor through a relay board.
  4. The Pi sends me an e-mail using ssmtp saying that somebody tried to enter my room
  5. An IR LED connected to the Raspberry Pi is used to trigger off my Nikon camera mounted on a tripod using LIRC

    Here’s a look at the code:

code

and here’s a peek at the hardware layout ๐Ÿ™‚
Layout

This is the basic PIR sensor code I’d implemented first before setting up the Intruder alert system:


import RPi.GPIO as GPIO
from time import sleep
# from subprocess import call
import os

GPIO.setmode(GPIO.BOARD)

GPIO.setup(7,GPIO.OUT)
GPIO.setup(11,GPIO.IN)

GPIO.output(7,True)

while True:
	sleep(1)
	if GPIO.input(11) == True:
		os.system('omxplayer /home/pi/Projects/PIR/hey.mp3')

I’d hoped to get some individuals hooked on to this amazing and rewarding world of magic through this workshop and I hope that the slides I’ve uploaded help me in spreading this know-how to other far-off places thorough the internet.

Just to show off the MakerSpace and give a glimpse into the 2 day workshop:

Advertisements

IR Remote for Nikon Camera using the Raspberry Pi (LIRC)

I finally came around to trying out LIRC on the Raspberry Pi to use it to trigger my Nikon D5100. ๐Ÿ˜€

I haven’t fully utilized the capabilities provided by it yet, but I’ve managed to get it up and running quite easily thanks to a lot of great posts and troubleshooting guides on some blogs and the Raspberry Pi forum.

I mainly followed these links:

http://www.instructables.com/id/Raspberry-Pi-Universal-Remote/

http://alexba.in/blog/2013/01/06/setting-up-lirc-on-the-raspberrypi/

To make a very simple remote using the Raspberry Pi, all you have to do is follow the steps given on either of these links.

Since I didn’t really have the physical Nikon ML-L3 universal remote which I wanted to emulate, I followed the steps given on these links after which:

1. I upgraded the firmware:

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

2. Got the Nikon ML-L3 lircd.conf file:

http://lirc.sourceforge.net/remotes/nikon/ML-L3

and replaced the contents of

/etc/lirc/lircd.conf

3. Restarted the lirc daemon:

sudo /etc/init.d/lirc restart

4. Checked if the remote was configured correctly:

irsend LIST Nikon2 "" 

This should show a list of the commands offered by the remote for triggering the shutter.

5. Tested the shutter command:

irsend SEND_ONCE Nikon2 shutter

6. Once that worked properly, (after a silent fist-pump) I decided to write a small python script that I can use for Timelapse shoots:

#Created: 09-07-2014 AM 02:38 
#Author: Mayank Joneja
#https://botmayank.wordpress.com
#Timelapse code for Nikon Cameras using the Raspberry Pi (LIRC)
#IR LED on GPIO 22 , usage:
#sudo python NikonCamera.py [no. of shots] [delay in seconds]

from time import sleep
import subprocess
import sys

if(len(sys.argv)<3):
	print "usage: 'sudo python NikonCamera.py [no. of shots] [delay in seconds]'"

else:
	shots = int(sys.argv[1])
	delay = float(sys.argv[2])

	for i in range (1,shots+1):
		subprocess.call('irsend SEND_ONCE Nikon2 shutter',shell = True)
		sleep(delay)

I’m quite happy with this setup as of now, but I plan to hookup a TSOP and make a small setup for recording and transmitting IR signals with the Pi. I guess I’ll then have a simple Flask based web-app for such an IR blaster.

I haven’t really tried out the range of the setup yet but I think in case of any issues I’ll simply amplify the signal with an NPN transistor like a BC547 and add another LED in parallel for better coverage angle. I’ll post any updates on this project as and when I get to them.

P.S.:I hope to click a nice timelapse sequence with this camera ASAP and upload that too. ๐Ÿ™‚

DIY Portable Speaker Amplifier using LM386

For one of my first audio circuits, I decided to make a simple amplifier circuit based on the LM386 IC to power an 8 Ohm 0.5 W Speaker. I started off based on the schematic provided in this instructable:

http://www.instructables.com/id/Portable-Speaker-1/?ALLSTEPS

But once I was done with it, I wasn’t really impressed with the audio quality. The audio would start to crackle really soon and there was very little clarity. As it turns out, all I had to do was add a 0.047 uF capacitor at the output and a 0.01uF capacitor ย at the input as decoupling capacitorsย to get a remarkable upgrade. The more common schematic for this application was available at:
http://www.instructables.com/id/Make-a-Simple-Audio-Amplifier/

Oh and for anybody interested in making this project, do check out this awesome detailed post and video by Hackaday:
http://hackaday.com/2011/05/01/lm386-altoids-tin-amp/

and the original hackaweek post:
http://hackaweek.com/hacks/?p=131

So effectively the schematic I used resembles:

(http://hackaweek.com/hacks/wp-content/uploads/2011/04/LM386ampschematicfinal1.jpg)

In order to test my amp, I even wanted to try using an Arduino to drive this speaker instead of the usual annoying Piezo Buzzer I’d used so far for audio output. I used the sample code from the tutorial dealing with the tone() function in Arduino:
http://arduino.cc/en/Tutorial/tone

Here are some pics of my implementation:

And here’s how it sounds:

Future Plans:
1. Adding a bass boost as mentioned in the reference post
2. Trying out a guitar input and output to headphones
3. Putting it in a case

Running the Nokia 6610 LCD with a Raspberry Pi

A while back, I’d bought the Nokia 6610 LCD thinking of it as a nice cheap display to incorporate into certain projects.

http://www.onlinetps.com/shop/index.php?main_page=product_info&cPath=9_41&products_id=776

When I finally got around to using it, I thought of looking for instructables/references on interfacing it with the RasPi, but all I found was:

https://www.sparkfun.com/tutorial/Nokia%206100%20LCD%20Display%20Driver.pdf

and

http://www.instructables.com/id/How-To-Use-a-Nokia-Color-LCD/

and slowly learnt that this particular display has been quite a challenge for the online community for a while now. I did find very nice posts about how to interface it with other platforms though:
Arduino:
http://playground.arduino.cc/Code/LCDPCF8833

AVR:
http://thomaspfeifer.net/nokia_6100_display_en.htm

But after a lot of hunting, once I started looking for projects based on the LCD’s drivers, I finally came across a github project:

https://github.com/engpedrorafael/pcf8833

I really felt a rush of gratitude towards him once I found this because the task of porting the entire C library to be used with the Raspberry Pi through Wiring Pi seemed too daunting to me. Or atleast something I’d be too lazy to do to run a simple colour LCD ๐Ÿ˜›

All the steps for running the LCD are there on his git page. In short,
1.Make the connections:

(LCD connections)

2. Get his code
3. Run it and test, convert images to the relevant dimensions (132×132 pixels) and file format, and use the python modules he’s created.

I just hope this post helps somebody else find this particular implementation much sooner that it took me considering how easy things became once I found this. Major props to Pedro. ๐Ÿ™‚

In terms of connections, I ended up using a 330 Ohm resistor between 12V and the LED+ pin to make the display bright enough, I tried to use the 7806 but IMHO the display wasn’t really readable.

Here’s my setup:

P.S.: In case anybody’s having issues running the D-Link DWA 132 N300 Wi-Fi Dongle with the Pi, check out:

https://xneosis.wordpress.com/category/linux/raspberry-pi-linux/

Works like a charm and the dongle is one of the most reliable ones I’ve used.

P.P.S.: If you want to make your own bench power supply and haven’t seen this yet, check out my post:

https://botmayank.wordpress.com/2014/06/24/diy-bench-power-supply/

Blink!

SONY DSC

Greetings.

So, I finally managed to motivate myself enough to get on with this blog. Stuff you can expect to see here regularly-

  • Arduino, Raspberry Pi related hacks
  • Regular posts related to an academic Wireless Sensor Networks project on UC-Berkeley’s TelosB motes using TinyOS
  • Photographs to show new techniques of photography that I’m trying or some of my old work
  • Drum Covers of some songs or hopefully some original compositions in the future

I seriously hope I get better at this along the way. It’ll be cool if the work I put up here helps some lost soul scouring the internet for a solution to some weird technical roadblock. It might just also be a source of some amusement to some shutterbug or wannabe-drummer.

I really don’t know how regular or how interesting I’ll be able to make this blog (I feel I’m really rusty in terms of writing) . If you’re reading this, do leave constructive criticism or stuff you would want me to talk about related to these fields.

Until the next post… ๐Ÿ™‚

May the force be with you.