Skip to content
This repository was archived by the owner on Oct 12, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions _posts/2018-04-11-toasty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
layout: post
title: Toasty
date: 2018-04-11
categories:
- python
- raspberrypi
- arduino
- projects
description: Simple bluetooth controlled 4 motor robot, using a raspberry pi and arduino
author: Zachary Johnson
author-image: https://avatars1.githubusercontent.com/u/22699646?s=460&v=4
author-bio: First Year Computer Science Student at RIT
author-email: zrj5139@rit.edu
author-social:
github: https://github.com/ZacharyRJohnson
---

## Summary
Over winter break I bought a small 4 motor robot chassis with the intent of learning some basic hardware and robotics topics. Toasty is the result of that learning experience. Toasty uses a Raspberry Pi as its brain and an Arduino as an I/O slave board. The Pi runs a python script that gets input from the PS4 controller and then sends commands to the Arduino driving the motors.

## Toasty's Physiology
Toasty's main logic is written in Python and uses nanpy, a python library, to control the Arduino. The PS4 controller connects to a playstation wireless dongle plugged into the Pi and then the script uses pygame's joystick module to get the button and axis states on the controller. With these the pi can interpret which buttons are pressed and how far down they are pressed to send appropriate commands to the arduino and move the robot. The actual code running on Toasty is pretty simple, I made a few classes to make controlling the motors easier and reduce the amount of repeated code. Then in the main Control.py file, a main loop continuously reads the input from the controller and sends commands via nanpy telling the arduino what to do.

## Toasty's Anatomy
The main hurdle involved with making Toasty was the hardware. I hadn't done much with hardware prior to this so debugging everything was a challange but once it was all hooked up properly it came down to implementing features in the code. The hardware of Toasty consists of a Raspberry Pi 3 board connected through usb into the Arduino Uno. The arduino then connects to two Dual TB6612FNG motor drivers connected to the motors. The motors are powered by 5 AA batteries and the Raspbery Pi and arduino are powered by a portable battery bank through a micro usb cable. You can see a wiring diagram for Toasty below, minus the Raspberry Pi.

<img src="https://github.com/ZacharyRJohnson/BC-Car/blob/master/BCCarWiring_bb.png?raw=true" width=400 alt="Toasty Wiring Diagram">

## Future Augmentations
In the future I'd like to give Toasty a proper platform to hold the components that isn't just an Extra Toasty Cheez Its box glued to the frame. Also, the main feature I'd like to add would be hooking up a camera to the Raspberry Pi and implementing some basic OpenCV or computer vision functionality to make Toasty a bit "smarter."

## GitHub
Checkout how Toasty works below.

[Toastys GitHub](https://github.com/ZacharyRJohnson/BC-Car)