Day 18: Installing the camera

I followed the instructions described in the Mod my Pi blog:

First step: Update the system:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove

Second step: Enabling the camera

sudo raspi-config

raspi-config

Third step: Installing the camera

  • Shutted down the system, removed the power cable, video cable, sd card, etc
  • Followed James Adams’ video at YouTube:

Fourth step: Taking pictures

raspistill -o raspbox.jpg

raspbox

We can also shot videos:

raspivid -o video.h264 -t 5000

These programs have several options for setting resolution, file format, etc

Advertisements

Day 17: Controlling a DC motor

I bought this car in a second-hand-stuff shop. Originally it was remote-controlled but when I bought it, it no longer had the remote control. I don’t know the motor specification. This car has five AA batteries (7.5V), so I think it is safe to use my 5V power source. I put it on a box to avoid it to run away.

???????????????????????????????

This time I used the L293D attached to GPIO 18 and 23 in a way I can make the motor run forwards or backwards.

???????????????????????????????

I used the Servo Blaster library as presented on Day 14. In order to run the motor forwards, I kept one signal at zero and changed the other one.


echo "2=0" > /dev/servoblaster

echo "5=500" > /dev/servoblaster

To run backwards, I inverted the signals:


echo "5=0" > /dev/servoblaster

echo "2=500" > /dev/servoblaster

It worked with values from 300 to 2000.

When the motor runs forwards, the white LED is on. The LED is connected after the L293D.

???????????????????????????????

When the motor runs backwards, the green LED is on. The LED is connected before the L293D.

???????????????????????????????

Day 16: Assembling the pan/tilt bracket

The ROB-10335 Pan/Tilt bracket from Sparkfun is a device that allows positioning something using two servos.

I have assembled it through the following steps:

1) Screw the support to the base servo

Tilt-1 Tilt-2

2) Attach the lower part and the inner servo support. The support was not firmly attached at this time.

Tilt-3 Tilt-4

3) Screw the support to the top part and assembly everything together. First, I put the screw to the server (right side of the picture), then I put the screw in the another axis, and at last I tighten the screws for the inner support.

Tilt-5 Tilt-6

In order to test the final assembly, I used the same setup from Day 14.

Day 14: Controlling a servo using ServoBlaster

I connected the servo control wire (the white one) in the GPIO-24 pin and connected an external 5V power source to the red and black wires:

???????????????????????????????

As usual, the external power source ground is connected to the Raspberry Pi ground.

Using the Servo Blaster library was pretty simple. The first step was setting up the library:


sudo ./servod --min=50 --max=250

By default, Servo Blaster assigns servo 6 to GPIO24. For my servos, the valid pulse width values go from 75 to 225 (750 µs to 2250 µs), centering in 150:


echo "6=75" > /dev/servoblaster
echo "6=150" > /dev/servoblaster
echo "6=225" > /dev/servoblaster

To stop the Servo Blaster deamon:

killall servod

Day 13: Sharing files

I used the instructions in this post to configure shared directories.

Step 1: Install Samba:


sudo apt-get install samba samba-common-bin

Step 2: Configure the shared directory in the /etc/samba/smb.conf file.

I have inserted the following section to share the directory I had just created (/home/pi/share):


#======================= Share Definitions =======================

[pihome]

comment= Pi Home

path=/home/pi/share browseable=Yes

writeable=Yes

only guest=no

create mask=0777

directory mask=0777

public=no

Step 3: Set the password for smb


sudo smbpasswd -a pi

Step 4: Using it

In windows, I open a Windows Explorer and type the current IP address of my Pi (\\192.168.2.10).

Day 12: Playing with LEDs (III) – PWM and L293D

This time I replaced the red LED in the circuit I used on Day 11 for a ultra bright white LED.

The white LED requires more power than the Pi can provide, so I added the external power source used on Day 9 and a motor control chip, the L293D. I did the wiring based on this Adafruit tutorial but my Cobbler is connected in the inverted position.

This is the final circuit:

???????????????????????????????

Notes:

  • I used the following wire color guidelines: Black for ground, Red for Vcc, Yellow for data, and Blue for control.
  • The white LED can take up to 80mA and is connected to 100/3 = 33 Ohms resistor.
  • The green LED is connected to a 330 Ohms resistor.
  • I used an external 5V power source connected to the bottom-right corner.

The following picture shows the connections from another direction:

???????????????????????????????

This is the final result: