Wednesday, 6 November 2013

Raspberry Pi controls fish feeders using timer

I have finished the first level successfully, I use timer which is in Raspberry Pi to control fish feeder automatically, for example, the fish feeder will be rotated once every 5 seconds.

The results are shown in the following video:
Video 1: Raspberry Pi controls feeder using timer

This is important for my project and I have finished the first milestone. The next level is that feed fish automatically, which means that feeder will be rotating automatically if fish comes here and in the view of webcam. So the next level is challenger and it involves image processing.


Friday, 1 November 2013

The way to solve the problem

Today, I have failure to control feeder using GPIO again, I think that the GPIO cannot drive the motor. Please look at this forum:


The output current is about 20 mA, therefore, it is too small to drive the DC motor and it's enough to derive the LED light. 

I need to buy a expansion board called GERTBOARD for Raspberry Pi, the picture of this board is shown as 

Figure 1: GERTBOARD
So, I want to use it to drive the feeder, I hope it can bring luck to me.

Wednesday, 30 October 2013

Amazing happens

Today, I tried to use program to control feeder which is connected with the Raspberry Pi, however, amazing happens.

First, I tried to connected motor to 3.3V output pin (pin 1) in Raspberry Pi, the motor rotates normally as shown in Figure 1.
Figure 1: Schematic diagram for connecting motor to pin 1

However, when I program it and change pin 1 to pin 11, the diagram is shown in follows:
Figure 2: Schematic diagram for connecting motor to pin 11


However, the motor stopped all the time, but when I change motor to LED, the light will be turned on. 

So I measured the voltage of pin 11, it is 3.3V, voltage of pin 1 is also 3.3V, so I do not know why. It is amazing I am so confused. I think that there is no problem in pin 11, motor or cables. Therefore, I need to test it and find a problem. I think maybe the terminal of cable which is connected to pin 11. maybe loose or connect to other pins. I will give an answer in the future. 


Monday, 28 October 2013

Use remote desktop to control Raspberry Pi

I will introduce how to use remote to control raspberry pi using remote desktop. Firstly, install xrdp in Raspberry Pi directly or using SSH. The command is following:
$sudo apt-get install xrdp
And then install the Remote Desktop Connection in your computer. Next, find your Raspberry Pi's IP address using command.
$ifconfig
Input this IP address in the blank as shown in Figure 1:
Figure 1: Input IP for  remote connection

After that click connect, the interface is like Figure 2:
Figure 2: Input username and password for you Pi

Ok, we can connect our Raspberry Pi successfully like Figure 3:

If you can look this familiar desktop, you can control your Raspberry Pi from remote desktop.


Saturday, 26 October 2013

Use SSH to control Raspberry Pi

OK, let's think how to control your Raspberry Pi using your computer. Therefore, you do not need to connect keyboards and mice to your Raspberry Pi, you only need to control it using your laptop. I use my mac to control it, if you use Windows, the method is little different.

So the first thing is opening your Raspberry Pi and then open LXTerminal to input the following command:
$ifconfig
The following information will be shown as Figure 1, this information is related to the network of your Raspberry Pi. For SSH, the IP address is important. 

Figure 1: Display IP address in Raspberry Pi 

OK, now I know my IP address in Raspberry Pi, and then open your mac Terminal to input the following command.
$ ssh pi@Raspberry-Pi-Address

Notice: pi is the user default user name for your Raspberry Pi, if you have changed your user name, please replace it. And replace the Raspberry-Pi-Address to your IP address in Raspberry Pi as shown in Figure 2.


Figure 2: SSH interface 

OK, you can control your Raspberry Pi with using your laptop now, for example, control GPIO pins as shown in Figure 3:

Figure 3: Input command to control GPIO

OK, we can control it successfully, the result are shown in following figures:
Figure 4: LED is turned on

Figure 5: LED is turned off

OK, we have controlled Raspberry Pi successfully so far, and next I will shown how to control Raspberry Pi through remote desk.


Sunday, 20 October 2013

Python programming for controlling GPIO pins

Raspberry Pi has 26 GPIO pins, and GPIO is general purpose input/output. So if I can control the GPIO in raspberry pi, I will use raspberry pi control the devices. In this project, I chose Python to control Raspberry Pi.

There is a library can be imported to control the GPIO pins called RPI.GPIO  or another one is wiringPi. In my project, I will use RPI.GPIO. 

For testing the output GPIO pins, first of all I will use LED to test it. If LED is turned on, it means high voltage, otherwise, low voltage. So I wrote a small program for testing the output of pins as follows (save as Led_py.py):

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
while True:
           GPIO.output(11,True)
           time.sleep(1)
           GPIO.output(11,False)
           time.sleep(1)

After that, when I run this program, the command is like this:
$ sudo python Led_py.py
Notice: We cannot run this program directly because we are not root, so we must use "sudo" like root.

The results are in the following video.
Video1: How to control Raspberry Pi

The LED will be turned on for 1 second, and then turned off for 1 second, so the program will run all the time expect I stop it.


Tuesday, 15 October 2013

Connect the Raspberry Pi to wireless network "eduroam" in University

My project is related to the wireless control with using Raspberry Pi, so connecting Wifi in university is an important step in my project. It is easy to connect my Pi to normal Wifi because I know the name of Wifi, so I only need to provide the password. However, the Wifi is a little different in the university because I not only need to provide the password but also need to provide the account. 

Therefore, I decide to use WiFi Config (Figure 1) in desktop to connect the Wifi.
Figure 1: WiFi Config Logo

Next, download the certificate from the university website and save it in the desktop. Then copy it to the file /etc/wpa_supplicant, but you cannot use right click to copy if you don't log in as root, so I suggest use "sudo" command.
$ sudo cp /home/pi/the_name_of_certificate /etc/wpa_supplicant

And then open the WiFi Config in the desktop and set it using the same way in website of university.
Figure 2: The way to set WiFi "endroam"

Therefore, I can connect the WiFi to the wireless network in the university, if you cannot, try to reboot it.