Sunday, 18 June 2017

Raspberry Pi User Group, June 17, 2017

Happy Father's Day to all the fathers out there, and their families!

Today is also the day of the Johnny Miles marathon and we still have runners going by the house. Lots of the energy there!


Raspberry Pi User Group Meeting, June 17, 2017
Place: New Glasgow Library, New Glasgow, NS


Arduino / Python Serial Communications Using PySerial:

We had a Raspberry Pi User Group Meeting yesterday, June 17th. I was working on my robot yesterday. I am working through some tutorials on YouTube about Arduino and Python Serial Communications. I had looked up a number of tutorials online and worked through a couple of them. However, whenever I tried to do something that expanded on the ideas presented, it never worked. That is why I did some more searching and found the topic above.

Here is a link to the first video of a good set:
https://youtu.be/KB67cuaEJOU?list=PL5YMW87TmMmUBdNSM7dDS3-1WLwEUkhFU

These videos are short and very relevant to how I want to use an Arduino and a Raspberry Pi Zero Wireless together on my robot. To make things really simple, I am using a USB cable to interface Arduino and Python. For testing and learning purposes, I am using a PC running Ubuntu with my Arduino. Using Linux and Arduino really cuts down on prototyping time as the programs compile and upload very quickly with such a system. It also works fairly quickly to actually develop on the Raspberry Pi Zero W but, there it time to go back and forth between the RPi and a PC to view any kind of web-based tutorials.

By the way, this topic uses PySerial and works with Python 2 and Python 3.


The Robot:

This is my robot in its current state:

This is a mess of wires! However, if you take the time to look through the wires,
you can see the USB Boarduino in the middle, the photocells are to the left setup as voltage dividers with the resistors in the breadboards. The new additions as of late are the H-bridge motor drivers on what is the front right and right side of the robot. I placed the RPi Zero W and a USB hub to give an idea of what is to be added. It looks like I will have to add another layer to the chassis to fit the other devices. I might also add a 16x2 LCD and some push buttons. Once I get it going, I will consider refactoring it by soldering together some permanent circuit boards for the H-bridge motor drivers and the photocell/resistor voltage dividers to free up the solderless breadboards.


Underneath are the geared motors with wheels, the battery pack with
rechargeable batteries, and the swivel caster wheel. The battery pack is held in place with two elastics. You can also see the IR sensor on the bottom that will allow the robot to be line-following. It is not hooked up yet as I have not made it light-following yet.
 The motors work and so do the photocells. I need to normalize the three photocell/resistor voltage dividers to allow for easy programming of signals going to the motor drivers. That way it will follow light uniformly for light shone on all three photocells.


PAW Server:

For a change in direction, and possible use on a robot at some point, we checked out running a web server on an old Android phone. I chose a tutorial on the PAW Web Server which is a simple app that runs on Android without having to root the device. It has some excellent features but keep in mind that a single-core 800 MHz, 512 MB RAM device will not run much at blazing fast speeds.

All the same, it is fun to use a webcam server, robot text-to-speech, and of course, serving up actual webpages. There is too much to describe but it looks very useful and the interface is very easy to use. Just search for tutorials on the PAW Server and you should find something to guide through orientation.


List of Topics To Date:

Here is an updated list of things we have worked on or covered in some way, to date:
  • Raspberry Pi radio - your own little FM broadcaster!
  • Command line music players and how to use them to edit music files
  • FlightRadar24 - watch airline data
  • How to set up your RPi the first time
  • Minecraft Pi workshop - programming in Python to make your own custom Minecraft game
  • How to make an LED turn on and off using Python and RPi General Purpose Input/Output (GPIO) pins
  • Free RPi material such as magazines and short books provided by "The MagPi" magazine
  •  Setting up your own private LAN (not Internet accessible). This is useful for places where organizations keep their own Internet Accessible LAN locked down. This means you cannot do simple things such as using SSH to login into your RPi. If you set up your own private LAN, you can connect both your PC and RPi and login remotely using SSH.
  • Run a servo motor using Python.
  • RPi 3 as desktop PC replacement - would do if that was all you had but, not really recommended.
  • RPi 3 - 3.5 inch touchsreen
  • Starting to explore Arduino/RPi Zero W USB communications (same as Arduino/Python Serial Commuinications)
  • Forward/Reverse Relay modules
If you would like to see something specific covered, drop me a line! You can also drop by the meetings once they resume again in September, 2017.

No comments:

Post a Comment