Saturday 28 October 2017

RC-Car-2 - RC car driven by Raspberry Pi

[28/10/17]
1.  I have a 6.4V Li-Ion battery that makes the motors go, so good. It was pointed out to me yesterday that most mobile phone batteries are Li-ion, but all of those that we have are 3.7 Volt, so unless I can stack them in series I can't use them.

2. I have four Memory cards. 
  [1] 16Gb contains ?
  [2] 8GB  boots up, has the correct IP address, but no WebIOPI. Plastic is breakingup.
  [4] 8GB MicroSD is good to go
  [5]? 8GB MicroSD is in car

3. How to proceed: 
  [a] Update [1] and [2] to latest Raspbian (done - Stretch)
   Wireless
   and WebIOPI, set up and test.
  [b] figure out how to change to have pcm control of Forward/Back.

4. Tools  that I use:
 ssh to connect
  Filezilla as an FTP client to transmit files between computers,
nano to edit files.

5. Which R-Pi ports support PWM?


[30/10/17] Card [2] in R-pi, Booted on Ethernet, Fing shows IP 192.168.1.20
ssh gets  Connection refused. Why?

FIX: As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. 
For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card.
-.-.-.-.- 

Then will sudo raspi-config
sudo apt-get update
sudo apt-get upgrade
edit /etc/network/interfaces and
/etc/network/wpasupplicant

reboot and see if wireless works.
NO.  and neither does Ethernet, so I can't fix it.
[3/11/17]
FIX: edited /etc/network/interfaces and /etc/wpasupplicant/wpa_supplicant.conf using sudo kate on PC.  Had to change the permissions of Wpa_supplicant.conf to r_xr_xr_x, but that got it connecting via IP 8.

use filezilla to copy WebIOPI zip file to R-Pi

At this point go to [*] below because this is debugging to get to that state and I am rewriting the process to show the steps.

ssh'd into R-Pi
$ tar xvzf WebIOPi-x.y.z.tar.gz
$ cd WebIOPi-x.y.z
$ sudo ./setup.sh
3 WebIOPi files to copy in:
/etc/webiopi/config                this shows where others should go.
myproject = /home/pi/rc-car/python/script.py
doc-root = /home/pi/rc-car/html   file index.html

edited config with nano to set it up, as I couldn't ftp it into place because of permissions.


started it with sudo webiopi -d -c /etc/webiopi/config but got errors that "GPIO is not defined"

need to add a couple of files and rebuild. See: 
1] http://webiopi.trouch.com/issues/140/

mv ../gpio.c python/native/gpio.c pi@raspberrypi ~/WebIOPi-0.7.1 
mv ../cpuinfo.c python/native/cpuinfo.c pi@raspberrypi ~/WebIOPi-0.7.1 
mv ../version.py python/webiopi/utils/version.py pi@raspberrypi ~/WebIOPi-0.7.1 
mv ../webiopi.js htdocs/webiopi.js 

or maybe this fix?
2] https://github.com/thortex/rpi3-webiopi/issues/12    Don't think so, doesn't give right output.

or
3] https://raspberrypi.stackexchange.com/questions/37327/global-name-gpio-is-not-defined-errors-on-webiopi

or
4] https://www.raspberrypi.org/forums/viewtopic.php?t=98981  has a couple of solutions.

or:
5] https://github.com/doublebind/raspi
will try this first.


]2017-11-04 15:51:35]
HTTP - DEBUG - "GET / HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.16
; Bush Spira B2 10 tablet Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Safari/537.36>)
2017-11-04 15:51:35 - HTTP - DEBUG - "GET /webiopi.js HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.16 ndroid 6.0; Bush Spira B2 10 tablet Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Safari/537.36>)
2017-11-04 15:51:35 - HTTP - DEBUG - "GET /jquery.js HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.16 droid 6.0; Bush Spira B2 10 tablet Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Safari/537.36>)
2017-11-04 15:51:35 - HTTP - DEBUG - "GET /webiopi.css HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.16 Android 6.0; Bush Spira B2 10 tablet Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Safari/537.36>
)
2017-11-04 15:51:36 - HTTP - DEBUG - "GET /map HTTP/1.1" - 200 OK (Client: ::ffff:192.168.1.16 6.0; Bush Spira B2 10 tablet Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Safari/537.36>)
2017-11-04 15:51:36 - HTTP - DEBUG - "GET /favicon.ico HTTP/1.1" - 404 Not Found (Client: ::ffff:192.168.1.16 Linux; Android 6.0; Bush Spira B2 10 tablet Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Safari/
537.36>)

It sort of worked, but didn't display buttons. 


[2017-11-06] Stuck an Icon called favicon in rc-car/html.
No errors but no buttons.

[*] New start place

ssh'd into R-Pi
$ tar xvzf WebIOPi-x.y.z.tar.gz
$ cd WebIOPi-x.y.z 
from  https://github.com/doublebind/raspi
$ wget https://raw.githubusercontent.com/doublebind/raspi/master/webiopi-pi2bplus.patch
$ patch -p1 -i webiopi-pi2bplus.patch
$ sudo ./setup.sh
3 WebIOPi files to copy in:
/etc/webiopi/config                this shows where others should go.
myproject = /home/pi/rc-car/python/script.py
doc-root = /home/pi/rc-car/html   file index.html

edited config with sudo nano to set it up, as I couldn't ftp it into place because of permissions.

started it with sudo webiopi -d -c /etc/webiopi/config

Tuesday 3 October 2017

Some people call them Brain Farts

Yesterday, I went upstairs to put a new duvet cover on the bed. At the top of the stairs I came across the Vacuum cleaner. I thought I had better dust before vacuuming so got out a duster. In the second room, I noticed that the window sill and curtain were dirty, so Took off the curtain and took it downstairs  and put it in a sink to soak.

Later in the day I got upstairs again, and this time got out the Jif and rag and cleaned up the window frame and even the window.


When did I get around to putting on the duvet cover?  Much later.