wifi connection not working

The brains of your robot

wifi connection not working

Postby pversteeg » Sun Jan 11, 2015 10:31 pm

Hi there,

With my 2 sons we've built the raspberry pi camera robot.
Almost (see additional remark) no problems encountered either with the hardware nor the powering or creating the necessary SD card.
So today we're ready to power up the robot and have some fun. But it didn't. During the booting up the wifi dongle doesn't respond at all (no blue light flashing). Looking at chrome typing the IP address doesn't give anything (but a time out). We've turned the robot on/off many times. I tried to find a solution whole day but no result so far and now end up at this community (as a qick learning newby from the Netherlands).
I'm able to connect a terminal to the pi and can use the LXterminal-program. Using ifconfig I can see that the IP-address 192.168.42.1 is given. Also a Bcast 192.168.42.255 and mask 255.255.255.0.
During booting there are no failures (red text) shown. I can see the booting up of the pi-system until; starting ISC DHCP server ; than the rasbian screen appears.
The wifi dongle I use as a Wi-Pi
The wifi-dongle isn't broken. When I use another program (on another SD-card) to control the robot (from penguin tutor) the dongle is working fine. With that program I can use putty/SSH to (wifi) connect to the pi.

When connecting a LAN cable to the the Pi and rebooting the pi, there is still no internet connection possible/available. Even when I remove the wifi dongle.
So I'm out of ideas now, and hope that someone on this community can help us.

@dawn robotics.
I've purchased the pan/tilt kit recently. I was a little surprised by the changing of the location of the cables; to the smaller side. So it's almost impossible to attach the kit as shown on the pictures (on which the cables come out at the longer side). I had in fact to create a new exitpoint of the cables (of the pan-servo) and therefore disassemble the servo.
pversteeg
 
Posts: 4
Joined: Sun Jan 11, 2015 5:20 pm

Re: wifi connection not working

Postby Alan » Mon Jan 12, 2015 1:15 pm

Hi there,

Welcome to the forum. :)

It sounds like maybe you've got a WiFi donge which doesn't work with our software. I'd recommend an Edimax EW-7811Un if you can get hold of one.

Can you please send me a link to the WiFi dongle you're using? Also can you please send me the result of typing in lsusb on the Pi when you have it plugged in?

The Wifi dongles known to work are those based around Realtek RTL8188CUS (includes Edimax EW_7811Un) and those based around the RT5370.

With regards to the pan/tilt kit the cable has always come out of the short side, and we just squeeze the wire somewhat (and have a slightly non vertical standoff on the right hand side) when attaching it to the robot. This has caused confusion for other people assembling the robot and so I'll try to update the pictures at some point.

Regards

Alan
Alan
Site Admin
 
Posts: 311
Joined: Fri Jun 14, 2013 10:09 am

Re: wifi connection not working

Postby Bastian » Mon Jan 12, 2015 8:45 pm

Sometimes the image doesn’t boot right at once and some small adjustments have to be made manually.
I just noticed you can see DHCP starting up? Perhaps your Pi doesn’t have a static IP-address.
Try: sudo nano /etc/network/interfaces and replace DHCP - after the line iface eth0() – with static
and insert on the line direct below:
address 192.168.42.1
netmask 255.255.255.0
gateway 192.168.xx.xx
If that doesn’t solve it (or is already in your file), try to change the driver in /etc/hostapd/hostapd.conf from auto into nl80211
Finally you can activate IP-forwarding in /etc/sysctl.con
Bastian
 
Posts: 23
Joined: Fri Nov 28, 2014 11:30 am

Re: wifi connection not working

Postby pversteeg » Tue Jan 13, 2015 1:45 am

Hi there,
Thanks for the quick responding.

The wifi-dongle I use is a wi-pi;
http://nl.farnell.com/element14/wipi/dongle-wifi-usb-for-raspberry/dp/2133900

The result of lsusb;
lsusb gives for the dongle; ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
I've looked info about it up before and it should work.

I did ;
Try: sudo nano /etc/network/interfaces and replace DHCP - after the line iface eth0() – with static
and insert on the line direct below:
address 192.168.42.1
netmask 255.255.255.0
gateway 192.168.xx.xx
If that doesn’t solve it (or is already in your file), try to change the driver in /etc/hostapd/hostapd.conf from auto into nl80211


After rebooting the pi; no result

I also tried
Finally you can activate IP-forwarding in /etc/sysctl.con
with sudo nano /etc/sysctl.con
but than I got a new file??

Found on the internet the next command and tried it;
sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf

I got this message which seems usefull?;
Failed to create interface mon.wlan0: -23 (Too many open files in system)
Try to remove and re-create mon.wlan0
Failed to update rate sets in the kernel module
Using interface wlan0 with hwaddr 00:c1:40:77:11:4e and ssid 'Pi_Mini_Robot'
recv: Network is down.


Googling this error didn't help me much further so far.
Maybe you have some suggestions?

Regards Paul
pversteeg
 
Posts: 4
Joined: Sun Jan 11, 2015 5:20 pm

Re: wifi connection not working

Postby Alan » Tue Jan 13, 2015 11:17 am

Hi there,

Ok, that WiFi dongle should work, although now I'm thinking that power is likely to be your main issue, as those WiFi dongles are a bit more demanding than the EW-7811Un in terms of current requirement.

How exactly are you powering your robot? Are you able to run the Pi off a wall adapter whilst we get the WiFi working?

Regards

Alan
Alan
Site Admin
 
Posts: 311
Joined: Fri Jun 14, 2013 10:09 am

Re: wifi connection not working

Postby Bastian » Tue Jan 13, 2015 3:46 pm

I probably had to be more precise. Sorry for that!
Just to be sure:
1) gateway 192.168.xx.xx , I meant your actual gateway address (so, the x’es should be numbers)
(If it wasn’t in your file at the first time, your Pi didn’t have a static ip- address)
2) Your wifi device needs a different driver, so change:
Sudo nano /etc/hostapd/hostapd.conf and now change nl80211 in RT5370
Sorry for that one, I assumed the wrong driver!
3) I mistyped: sudo nano /etc/sysctl.con, it should be sudo nano /etc/sysctl.conf (again sorry for that one) The right file should open now and shows a commented line:
net.ipv4.ip_forward=1 Uncomment this one.

If the webserver still isn’t working, then the following steps will finalize it (the next steps only realize that the webserver can connect to the internet through ethernet while sending, but it is just to be sure everything else is correct) :
4) insert an iptables rule to allow NAT. (eth0 being the interface which is connected to the internet)
[BashCommand :] iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
5) save these IP Table settings so they are enabled every time you boot the rPi.
[BashCommand:] iptables-save > /etc/iptables.up.rules
6) To load them at boot, create a new script in /etc/network/if-pre-up.d/
[BashCommand:] nano /etc/network/if-pre-up.d/iptables, with the following contents:
#!/bin/sh
#This script restores iptables upon reboot
iptables-restore < /etc/iptables.up.rules
exit 0

7) Then, verify the permissions so that it will start on boot.
chown root:root /etc/network/if-pre-up.d/iptables
chmod +x /etc/network/if-pre-up.d/iptables
chmod 755 /etc/network/if-pre-up.d/iptables

Once everything is done, your configuration is complete.
Bastian
 
Posts: 23
Joined: Fri Nov 28, 2014 11:30 am

Re: wifi connection not working

Postby pversteeg » Wed Jan 14, 2015 1:16 am

Let start saying the wifi is finally working as an acces point.
I'm able to acces the pi-robot via using chrome (on a tablet) and i can see the streaming images from the pi-robot. Thank you very much for the support for that part. The wi-fi dongle however still doesn't flash?
I can run the pi/robot on both a wall adapter and a power bank (5V 1A (from lab31)).

Thus so far so good but that's also all I can do now.

There are still a couple of other problems i've encounterd.
when booting the robot (with the mini-driver on) the following is happening;
- initially booting is going well; the pi-camera shows a small turn (pan) to the left
- at some point/moment (after 3-5 seconds) the camera turns the right (pan) and faces up (tilt) and the servo-motors keep running (they want to turn further, but can't)
- pushing at the resetbutton on the mini-driver gives rest, but after 3-5 seconds the servo-motors continu.
- in this "state" i can see on the terminal the pi/robot is continously rebooting, until I disconnect the USB-cable from the mini-driver.
- when I start up with the servo motors unplugged from the mini-driver there also no problem.

Although i can acces the robot with chrome, the joysticks for both motors and camera doesn't work (no reaction of the robot). The camera images I can see.

So please can you help us further?
regards Paul

PS
although most of the tips were fine some of them i had to change a little;

I probably had to be more precise. Sorry for that!
Just to be sure:
1) gateway 192.168.xx.xx , I meant your actual gateway address (so, the x’es should be numbers)
(If it wasn’t in your file at the first time, your Pi didn’t have a static ip- address)
I did understand this already

2) Your wifi device needs a different driver, so change:
Sudo nano /etc/hostapd/hostapd.conf and now change nl80211 in RT5370
Sorry for that one, I assumed the wrong driver
RT5370 or rt53!70 didn't work (gave error), nl80211 is fine

3) I mistyped: sudo nano /etc/sysctl.con, it should be sudo nano /etc/sysctl.conf (again sorry for that one) The right file should open now and shows a commented line:
net.ipv4.ip_forward=1 Uncomment this one.
Was already done

If the webserver still isn’t working, then the following steps will finalize it (the next steps only realize that the webserver can connect to the internet through ethernet while sending, but it is just to be sure everything else is correct) :
4) insert an iptables rule to allow NAT. (eth0 being the interface which is connected to the internet)
[BashCommand :] iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

5) save these IP Table settings so they are enabled every time you boot the rPi.
[BashCommand:] iptables-save > /etc/iptables.up.rules
This has to be sudo sh -c "iptables-save > /etc/iptables.up.rules"

6) To load them at boot, create a new script in /etc/network/if-pre-up.d/
[BashCommand:] nano /etc/network/if-pre-up.d/iptables, with the following contents:
#!/bin/sh
#This script restores iptables upon reboot
iptables-restore < /etc/iptables.up.rules
exit 0
7) Then, verify the permissions so that it will start on boot.
chown root:root /etc/network/if-pre-up.d/iptables
chmod +x /etc/network/if-pre-up.d/iptables
chmod 755 /etc/network/if-pre-up.d/iptables
pversteeg
 
Posts: 4
Joined: Sun Jan 11, 2015 5:20 pm

Re: wifi connection not working

Postby Bastian » Wed Jan 14, 2015 4:47 pm

Hi,
Great. One hurdle gone. Being a novice myself, I recognize some of your quests. (I started almost a month ago, building my very first robot, discovering the Raspbery Pi, learning Linux, Python, Websockets, Arduino and Python-openCV). The good news is: it all really works. It’s just hard to get ones bearings in all the new stuff. ;-0)
So, I’m not the expert (far from that), I cannot explain everything you wrote, but my thoughts are:
I do think you should look at your power source. The neck movement looks strange, but is explainable and can be solved; however the Pi should finish its booting. I’ve tried several methods to power the bot, but at the end one needs strong enough juice to feed the Arduino. The stand-alone Pi can easily be fed by a phone charger, but the full robot needs far more current. Personally I like the 6xAA pack (2400mAh or higher !) the best.
I also understand that taking the usb cable out, enables the Pi to finish booting? That looks like the Arduino is powered through the usb? The Arduino needs separate powering (could be from the same source)
The reset button, resets the Arduino, but the same sketch is initialized. It’s no use and shouldn’t be necessary as well.
At booting there are four moments the neck is activated. 1) power-up, where the neck makes a small twitch (and stays tensioned). 2) initializing the servo pins on the Arduino, where the neck twitches to upper left (and stays tensioned) 3) initializing the A-section of the Arduino, you see a blue flash of the D13 pin and the neck moves to the center (and stays tensioned) 4) when the connection (usb) between Pi and Arduino is initialized, the neck servo’s fall to rest.
When the booting is completed one can adjust the neck (it should be in the center). Within a certain range this can be done at the config page (192.168.42.1/config.html) by adjusting the PWM values. But maybe you need to take the screws out of the servo connectors, adjust the axis position and reassemble the neck (I needed to do that and tune afterwards through the config page)
Maybe I misread the part on the joysticks, but when starting up is finalized without the usb cable, there is no channel for the Pi to send its commands to the Arduino. The camera sends its images to Websockets because it is attached to the Pi.
Bastian
 
Posts: 23
Joined: Fri Nov 28, 2014 11:30 am

Re: wifi connection not working

Postby pversteeg » Wed Jan 14, 2015 11:16 pm

I've got it figured out!!
We initially connected the servos to the wrong pins D12 and D11 instead of D11 and D6.
So everytime I reconnected them wrong also.
The ThijNie Robot is working.
Thanks a lot for helping us out, it was indeed a quest.
The power banks I use (5V 1A 4400mA) work fine so far (i did a one hour trial and no problems).
So now it's up to my sons.

The next step/quest I like te do is using the ultrasonic sensor.

Thanks again
Regards Paul (and Thijs and Niels)
pversteeg
 
Posts: 4
Joined: Sun Jan 11, 2015 5:20 pm

Re: wifi connection not working

Postby Bastian » Thu Jan 15, 2015 8:11 am

Great!
In this field of play the blood is always in the details leading to illogical obeservations ;-0)
Enjoy!
Bastian
 
Posts: 23
Joined: Fri Nov 28, 2014 11:30 am


Return to Software

Who is online

Users browsing this forum: No registered users and 0 guests