Monthly Archives: June, 2013

SainSmart Joystick Gaming Kit

Advertisements

Raspberry Pi Snail Mail System

You will need:
Raspberry Pi + SD card loaded with Raspbian Wheezy OS
powered USB hub with a 5V power supply.
micro USB cable to power the Pi
network connection or USB wifi dongle for the Pi
webcam
SainSmart 1602 I2C display
Logic level shifter
Some connection to the Pi GPIO – IDC connector, ribbon cable and electonics prototyping breadboard
resitors
LED
microswitches
a length of thin wire
Some kind of box (we used lego)

The Python code required is on GitHub:
https://github.com/paulbarber/raspi-gpio.git
Required files:
take_picture_and_email.py
send_gmail_attachment.py
lcd_display.py
i2c_lib.py

Run with:
sudo python take_picture_and_email.py
(root access with sudo is required to access the GPIO)

More details: http://www.instructables.com/id/Raspberry-Pi-Snail-Mail-System/

Arduino Excuse Generator

Need an excuse in a hurry?

Look no further than the Excuse Generator.

You will need:

Arduino Uno
LCD Module (HD44780 compatible)
Potentiometer
Tilt Switch
220 Ohm Resistor (Red-Red-Black-Black)  / (Red-Red-Brown) or 470 Ohm or 560 Ohm is fine too

Wire up the LCD module to the Arduino as listed below and illustrated in the Diagrams.
Don’t forget to wire in the Pot and the Tilt Switch too as shown.

Wire up the LCD Module as follows:

LCD pin (1)   / Vss      -> Gnd
LCD pin (2)   / Vdd    -> 5V
LCD pin (4)   / RS      -> 12
LCD pin (5)   /  R/W  -> Gnd
LCD pin (6)   / E         -> 11
LCD pin (11)  / D4      -> 5
LCD pin (12)  / D5      -> 4
LCD pin (13)  / D6      -> 3
LCD pin (14)  / D7      -> 2

In addition you need to wire 5V/Gnd to the A/K of the backlight LED (pins 15/16); and wire in a potentiometer to adjust the contrast (pin 3).

Without the contrast adjustment and the backlight the LCD will not Display anything visible.

More details:  http://www.instructables.com/id/Arduino-Excuse-Generator/

Arduino / Raspberry Pi Internet Radio

This is a project for Arduino and Raspberry Pi to make an Internet Radio, aimed at intermediate skill level. Some familiarity with Linux usage will be beneficial (or access to someone who can help out if required).

Raspberry Pi runs mpd music player daemon to receive and decode the internet radio stream.
ALSA running on the Raspberry Pi provides the sound through either the Jack Socket or the HDMI output.

Arduino runs a nanpy interface code to interface with Python, providing Text output of the Radio Station playing and Button inputs to control Playback.

Objectives:
* Learn how to use the mpd/mpc on the Raspberry Pi
* Learn how to use the nanpy library for Python to interface the Pi to the Arduino
* Make a Cool Internet Radio

You will need:
* Arduino UNO
* LCD / Keyboard Shield e.g. (http://goo.gl/XAhvx)
* Raspberry Pi
* USB and Ethernet cables

More details at: http://www.instructables.com/id/Arduino-Raspberry-Pi-Internet-Radio/

A stupidly simple way to connect 3.3V logic to a Sainsmart relay board

Jovian Outpost

A lot of hobbyists are using Sainsmart relay boards with their projects because the boards cost less than buying the relays, or come really close. The boards include circuits to drive the relay coils so that a typical logic output can be connected directly to the board. Each driver circuit uses an optocoupler so that the driver and the coils only share a ground potential. This is a great scheme to allow the driver to work at a different voltage than the relay coils, but the board was intended for use with 5 volt supplies for both. The drivers start to work reliably from around 3.8V up to 5.5V or so. The result doesn’t work well with a 3.3V supply for the drivers operated by 3.3V logic; some relays will function, and others won’t. The solution is to give the drivers a 5V supply, but then the floating driver inputs…

View original post 469 more words

Raspberry Pi Lights: how to sync Christmas lights to midi audio

The Raspberry Pi and I

** UPDATE 9/21/2014 **

I updated the source code today. Now lightorgan supports more than 7 output channels.  It chooses the pin to light up based on both the pitch and the octave of every note. Now the number of supported output channels is limited only by how dynamic the range of the midi file is. I observed that this worked practically for at least 24 channels on several Christmas songs. This is cool because the new Rasperry Pi Model B now supports up to 28 pins!  See Gordon’s page at http://www.wiringpi.com.

Also, the WiringPi pins that lightorgan uses are now configurable. Just modify the array called pinMapping[] that’s near the top of the lightorgan.c file to add, remove, or remap a lightorgan channel to a corresponding WiringPi  pin. Recompile with your changes and then you should be good to go.

Check out the new source code from the google…

View original post 1,289 more words

Mini Arduino enviroment monitor

This is an Example of how you can use the Arduino to monitor various environmental parameters And display them on a LCD screen.

Arduino uno R3 or compatible
Sainsmart “1.8” TFT Color LCD Display  
DHT11 Digital Temperature and Humidity Sensor
Mini Breadboard
Jumper Wire

For more details:

http://www.instructables.com/id/Mini-Arduino-enviroment-monitor/

Diagram:SainSmart 1.8 “TFT LCD modules connect with Raspberry Pi

 

Prototype contactless bathroom power switches with Arduino and Sainsmart relays

Reblog From: http://www.grantgibson.co.uk/blog/2013/05/arduino-sainsmart-relay/

A couple of months ago a friend showed me his plans for a new bathroom in his house.  The plans included a number of electrical items – fans, lights, etc – all of which required switches.

The problem is that – in the UK at least – there are tight regulations around electrical switches in the bathroom.  Two standard solutions are to either have all switches outside the bathroom door, or have ceiling-mounted switches inside controlled by pull cords.

Neither solution was ideal – having to leave the bathroom to change the lights isn’t great, and the number of different electrical items made pull cords impractical (they’d need at least four cords in the corner of the room and it’s unlikely any guest would be able to work out what did what.

I proposed a solution using infra-red proximity sensors mounted underneath a sealed glass shelf.   I then got to work on a prototype which is shown in the video below.

The system uses four IR proximity sensors (approx £5 each) linked to an Arduino Uno.  The Arduino is hooked up to a Sainsmart 4-way mechanical relay capable of switching mains voltage at up to 10 amps.  Also linked to the Arduino are four RGB LEDs.  We’re using the blue and red inputs on each LED to indicate the on/off state of each relay.

Controlling the switches is pretty straightforward.  The proximity sensors project a fairly narrow beam directly above, allowing them to be mounted fairly close together without problems.  They also have an analogue distance adjustment, controlled by a screw on the underside, which determines how high above themselves they can ‘see’.  To switch the relay on or off you simply pass your hand 0-15 centimetres above the relevant IR sensor.

I’ve written an Arduino sketch that does some basic checks and ‘de-bounces’ rapid flickering hand movements so the relays aren’t triggered on then off again say by two fingers that are slightly apart.

Here’s a basic breadboard schematic of the setup (click for full size):

Relay breadboard

The Arduino sketch is available on GitHub: https://github.com/grantgibson/ir-switch/

Important disclaimer: I have no electrical qualifications.  I don’t even know if this system meets wiring regulations for bathrooms (or any room for that matter).  It’s just a prototype I built for my own amusement.  If you try to follow my method you assume all responsibility for anything that goes wrong or right.  Remember – mains voltage can kill.

Raspberry Pi Control Garage Door

Several months ago our Craftsman garage door openers stopped responding to our remotes. I tried everything I could think of to fix this problem, short of buying anything new. Garage door opener parts are expensive, to the point buying new openers is a better option.

After much research I found out that RF interference was the issue. No new remote or logic board was going to solve the issue, even getting new openers wouldn’t solve the issue.

By knowing the wall switch which, still worked, simply closes the circuit I set out for a wireless solution. I wanted to try my hand at an Arduino, but getting WiFi to one isn’t cheap. I then discovered the Raspberry Pi had programmable pins. Getting wireless to the Pi was nearly $80 cheaper. I soon placed an order on Amazon for all my parts.

After getting the parts in I wrote a quick node.js app that serves a single page and also has a 2 backend requests to open each garage. I also quickly wrote an iOS app as well. I’m using Forever to make sure the app stays up.

The only issue I came across was that the relay I bought turned on when firing low, and off when high. The Raspberry Pi has a default state of low, but the GPIO pins are set to input mode so the relay doesn’t immediately fire until the pin is set for output.

As far as wiring goes, I have 2 sets of door switches. The regular wall switches that came with the openers which are right next to each other, then a separate set of switches wired in another part of the garage. I went to Lowes and got some Alarm Wire (it has 4 wires inside of it), this made me only have to make one run from the Pi. I just connected my wires to the back of the wall switches using the COM and NO ports from the relays.

I have open sources the node.js app at brentnycum/garage-node. I have also open sourced the iOS app at brentnycum/garage-ios. There isn’t much to learn from these projects except using node.js and the GPIO pins on a Raspberry Pi. You can find a picture of the built product from my tweet.

A picture of the device put together can be found in my tweet.

Originally from: http://itsbrent.net/2013/03/hacking-my-garage-with-a-raspberry-pi/