Wednesday, 13 May 2020

2020-May- Further experiments with Raspberry PI RC car - Can I make it respond faster

The starting point for this is using the R-Pi as an ad-hoc  connection so that I don't need an access point, as described here:
https://madsmaddad.blogspot.com/2020/02/raspberry-pi-ad-hoc-wireless.html

In a recent issue of Linux Format magazine I found an article about alternate ways of doing all this so I have to try them.

3 things that you can do:
1. Overclock the pi, done with SD card 4 in a R-Pi B and seems to work
2. Mocdify the maount of RAM that is used, but the Pi-B only has 256 MB so difficult to do and wonder if there is any measurable  advantage.
3. Use different Web interfacing. Article not much use, look further.

As SD disk 7 is the one active in Car3, I'll try overclocking it.
Just set overclocking to 950Mhz (high) from basic 700MHz.

June 8 2020
Just did a search on Speed optimization in Flask. Got some good results

https://stackoverflow.com/questions/39788630/speed-optimisation-in-flask

https://blog.socratic.org/the-one-weird-trick-that-cut-our-flask-page-load-time-by-70-87145335f679

https://damyanon.net/post/flask-series-optimizations/   Don't know how useful this one will be.

https://anthonyblackshaw.me/2018-02-17/speeding-up-url-for-for-flask


I have to think about how I will test these.  One thought is to build a new SD card  for the car 3 and use it as a test bed, or else to use car 2 which I have here and it has the servo steering modification. Thisn one uses SD card 4.  I think car 3 because the reactions will be more obvious.

First step will be to build a new SD card of the software, not forgetting the overclocking modification above.

I have used SD card 10 to duplicate 7. As an aside, I now have a backup of card 7 on my computer.
https://beebom.com/how-clone-raspberry-pi-sd-card-windows-linux-macos/    worked. - No it didn't. the file created was too large to blow onto the repalcement SD card.


I liked this tutorial.
https://towardsdatascience.com/python-webserver-with-flask-and-raspberry-pi-398423cc6f5d

14/6/20 Rebuilding System on another SD card. Connecting from Chrome on PC Via access point wireless, the response is very fast. So perhaps this is where I have to look for speeding up the system. When I have added the AP software to the R-Pi I'll connect the PC to it.

18/6/20 I think that word should be Ethernet, not wireless, But I will build a basic system (No AP)  and try that via Router wireless.

Wireless to Tablet is the slow item, so is it the browser/software in the tablet. How to test that.

20/6/20 The RC-Car on uSD card 4 responds pretty quickly to the tablet.
Must check again card 7 and 10 for response times.

Ethernet to PC - very fast
Ethernet to tablet, nearly as fast  - So that sort of says the Application on the Pi and the Wifi and Browser on the tablet are not holding it back.
Had a thought that it could be the AP software so searched for Hostapd causing slow action, and found hints that I should configure hostapd for wmm=1.

Now to test.
Humph. Wifi AP doesn't work at all. Not on house network or it's own.
from Dmesg:
  18.436844] usb 1-1.2: Direct firmware load for zd1211/zd1211b_ub failed with error -2
[   18.436875] usb 1-1.2: Could not load firmware file zd1211/zd1211b_ub. Error number -2
[   18.436888] zd1211rw 1-1.2:1.0: couldn't load firmware. Error number -2   


Difficult to resolve. Had to remove Hostapd, and update and then Upgrade SD card #7.  One of the things that seems to have happened is that the zd1211 drivers seemed to have disappeared so I had to reload them. That is probably the error above. Have got it working again with external AP, now need to reinstall hostapd and start again. 

                    











No comments: