Wireless Robot: Programming a Python GUI

Making the GUI

We wanted to be able to control the robot remotely so we chose to set up a Raspberry Pi to get the job done. The pi ran a python program for the GUI made with TKinter. All we had to do was use remote desktop viewers that way, we could access the GUI on the pi from an external tablet.

We chose to use TKinter when making the GUI mostly due to ease. We were using Python2 and its built in editor. All it took was importing the TKinter library and we had access to writing with TKinter commands. We simply created a window, added buttons, labels, and a slider, and from there it was a lot of customization. When a button is pressed, it calls the associated method which in turn sends a character to serial.

Here is an example of our GUI code for how a button and its method works:


def moveUp():
 label.config(text = "Moving forward")
 ser.write("F")

button2 = Button(root, text=" ^ ", command=moveUp)
button2.place(x = 200, y = 150)
button2.config(height = 6, width = 15,
 bg = "powder blue", fg = "steel blue")

GUI Screenshot

RobotGUI

 

Video of Working Robot with GUI 

Wireless Robot: Schematics

For our schematics, we originally started working with the L298N Dual H-Bridge/Full Bridge Motor Driver. As soon as we started trying to implement the H Bridge, we ran into a couple of issues. We discovered that we were using the L298N which was a 5V logic driven chip when we were only supplying 3.3V logic from the A3BU. To solve this issue, we switched to a different motor driver, the L293D. This driver was able to be driven using the 3.3V logic supplied by the A3BU. In order to do this, we were able to use inputs 1 and 2 to select the direction of the left motor and inputs 3 and 4 to select the direction of the right motor. This allowed us to have the motors run in a way that would allow the robot to turn left, right, forward, and backward.

As for the other schematic, we used the MAX232CPE USART Chip from our previous lab. This chip allows us to control the speed of our motors to allow our robot to run at different speeds. Our work for this chip wasn’t nearly as involved as the L293D because of the fact that we had already assembled it and had it working from a previous lab. 

After we had the h-bridge working, we assembled all of our components into the chassis and had a working robot. We used an external battery to drive the motors to prevent us from ruining the board by having an over current issue. We used a 12V lipo (lithium polymer) battery in order to do this. We also used a portable battery pack with a 5V 3A output to power the A3BU and the Raspberry Pi.

 

 

downloaddone MAX232CPE Serial Interface Combined

Wireless Robot: The Big Picture

We decided that for our final project, we wanted to design and create a wireless robot that could be controlled externally from a GUI. In order to do this, we utilized a raspberry pi to allow us to remotely send serial commands to the A3BU. Through the use of a remote desktop, we were able to control the pi and run the GUI from an external laptop that was linked to the pi through a wifi hotspot. The physical robot is created in a tripod fashion with two standard wheels in the back and a free rolling, non-powered ball in the front. This allows the back wheels to be the power and steering and the front ball to be there for stability. Though this is a very basic design it would be easy to expand upon this. By connecting different sensors and parts, you could easily use our base to develop a robot that can do innumerable tasks. Because of the nature of the serial commands used as a controller, the robot, even in its current state, could be scripted to autonomously drive preset paths.