Tag Archives: wifi

Beta2test.Safety connection

Today the remote control of the drone is done  via wifi with my laptop trou ssh.

By the way the software is designed (even if not yet completly developed) to receive commands from any type of devices (smartphone, tablet and so on). See this post for tips.

comm

So it is fundamental that the drone  keep a stable and constant connection with the remote control.

In order to verify a constant connection I created a new class that I called  netscan  that use  the ping command to verify the connection with a given ip address.

This object can work in a parallel thread that can monitor the connection on a fixed time interval.

In the code example you can find the netscan.py and the netscan_test.py

In netscan_test.py  you can see how to createand initialize  the netscan object and start the parallel thread.

I put an important effort on the performance of the system in order to verify that it is not time consuming.The time to perform a task ( in this exemple a basic calculation) does not change if I start or not the netscan.For the moment I tested it only on my laptop and the results are great.

As soon as the communication is lost the netscan  react on this.

This new object will be added to my code in the next coming  beta3_test.py

 

 

 

Advertisements

Alfa3test. PID introductionand more…

Starting with this series of tests Alfa3,I added some new features that move the project to the final setup.alfa3_pic1In particular I add the following modification that allow the system to work wireless:

  1. I added a second ESC and a second motor.
  2. I modified the connector board adding a new 3 pin connector (C in the photo) where there is the zero volt (black wire),  the signal (white wire) that is bridged with the 4th signal (green wire), and also added the 5 volt (red wire) .connector_board In this way I can choose if rpi is powered by  the ESC (C connection) or not (B connection).
  3. So the schema for this test consist of the connection of motor M[0] in A and motor M[1] in C.
  4. I connected also my wifi dongle in the rpi usb port. I discovered that neither the pc nor the wifi dongle can act as access point. You can verify this using the comand:

iwconfig ap

So I used my smartphone activating the router wifi function,building up a network including the PC and the rpi.

Below the references used in the test:

alfa3_convention

  • M[0] turns counterclockwise, the red wire is connected to the “T” wire of the esc (the one that is closer to the T of the Turnigy logo),and the yellow wire to the “Y” wire , the black wire with the center wire of the esc.
  • M[0] mounts a standard left prop.
  • M[1] turns clockwise, the yellow wire is connected to the “T” wire of the esc ,and the red wire to the “Y” wire ,the black wire with the center wire of the esc.
  • M[1] mounts a right prop. (marked  R).
  • According to the position of the IMU,I have a negative roll rotation if M[0] moves down.

I did already some tests with this configuration. In the next post the first results and the description of th enew sw module rc.py that is the remote control module.

SW Installation

Hello, today I inaugurate the english version of my blog.

As soon as I can I’ll translate also the static pages.

By the way, consider that this project is based on raspberry pi (rev B) for the motion control of the quadcopter.

Here there is a description of the necessary sw installation.

I’m using a laptop with ubuntu, and there I installed  ninja IDE, direcly from  ubuntu software center.

On this laptop I create a folder home /home/pyton/qpi.

Considering the rpi installation:

I copied a 2013-02-09-wheezy-raspbian.img on a  2GB SD.(right now you can find an updated verison of raspbian, on the rpi website  here: link

Start rpi connected on a monitor,my case was tv  via hdmi wire , mouse and keyboard and a ethernet cable.

Leave the default setting in the config.

Now you can disconnect all from rpi except the ethernet wire.

On the router  I defined a static address :192.168.0.50 , related with rpi mac address. (i have a netgear router and it waas really intuitive to set it ).

From the laptop , on the terminal use [See note below if you encounter problem with ssh]:

ssh pi@192.168.0.50
password : raspberry

Now yuo are using rpi from the laptop

Execute:

$ sudo apt-get undate
$ sudo apt-get upgrade

The update/upgrade can take up to one hour.

Since I ‘ll use rpi to pilot the motors I ‘nned to install the library that can manage the GPIO in rpi.

This library  RPIO allows to set any output as PWM:

$ sudo apt-get install python-setuptools
$ sudo easy_install -U RPIO

Now let’s see how to set up the Wifi Connection via usb dongle.

Do not connect the usb dongle.

Install the  wpa_supplicant  utility:

$ apt-get install wpasupplicant

Run the utility to create the password_phrase:

$  wpa_passphrase My_WiFi_SSID mypassword

Yuo will get this output.

network={
    ssid="My_WiFi_SSID"
    #psk="mypassword"
    psk=b2abb0fcd2f4527e11817de0823a57bb19ba4622f4595062c94ec4dd1370b5fe
}

Copy the  psk value.

Run the editor to modify the  /etc/network/interfaces

$ sudo nano /etc/network/interfaces

Modify the file (pasting the psk value):

...

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
  wpa-ssid "My_WiFi_SSID"
  wpa-psk b2abb0fcd2f4527e11817de0823a57bb19ba4622f4595062c94ec4dd1370b5fe

Switch off  RPi.

Connect teh dongle and disconnet the ethernet wire.

Restart rpi and you are on line.

Set the router in case you want a fixed ip address for the wifi connection.

Link:

ninja IDE

RPIO

NOTE: recently I clean up my laptop and installed ubuntu 13.10 on it.

From that moment it has been not possible to use ssh using wired connection.

So I solve it modifying the rpi eth0 configuration manually.

pi@raspberrypi ~ $ sudo nano /etc/network/interfaces
iface lo inet loopback
#iface eth0 inet dhcp
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1

In the same way, in the laptop I defined a static ip address 192.168.1.1