Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
---
title: Skittlebot build journal, 7th May 2017
date: 2017-05-07
tags: [robot building, piwars, opencv, electronics, power, raspberry pi robotics project, raspberry pi opencv project, gpiozero robotics project]
thumbnail: content/2017/05/07-skittlebot-build-journal/skittlebot-chassis-thumb.png
---
Skittlebot is designed using the 4Tronix initio robot base. It is built around a Raspberry Pi for remote control, and for experiments with computer vision.

I'd built this initially as a simple Arduino robot in 2016, but now it is time to make it something far more exciting. It's called Skittlebot because it's original goal was to follow a plastic, brightly coloured skittle (bowling pin) around.

It is being prepared for possible entry into the PiWars 2018 competition.

This setup used VNC to control the robot and see the output of the camera. The camera is a Raspberry Pi camera module.

## Progress so far - OpenCV colour tracking

Last night the opencv work to track colour was finally attempted right on the robot itself.

I was able to get the output I wanted - console output, and the display (via vnc) of the tracking, with the tuning parameters.

However, vnc is a little bit iffy here, and stops actually doing screen updates.

I then started to combine it with code to drive the motors.
The motors and the shared power were unplugged, with the Pi running off a USB supply while I was working on it.

I also seem to have destroyed a memory card yesterday on this set up.

When it tried to drive, the system reset - after a tiny movement of motors.

So - the next step is to look for power issues.

The power issues could be:

- Low batteries - check them all - should add to more than 6.6v.
- Bad connections - check these - I did undo wiring.
- The UBEC could actually have gone wrong, as I had USB voltage while the UBEC still present. lets hope not.
- Under-volting as motor current makes the system drop - the UBEC should help, but it drops at 6.6v.

## Batteries

This is unloaded voltages on an array of 8 AA batteries - these are high voltages for NiMH.

- 1.363
- 1.364
- 1.365
- 1.365
- 1.365
- 1.365

About 8v. They are dead or dying alkaline batteries.

## Wiring

Nothing there seems to be wrong, or shorting.
Lets put batteries in again.

Measure this, and try the simple motor test code.
-8.18? probes are right. Battery box red terminal on red probe. Whaaat?

Okay - just confusing wiring.
Powers up - motors turn until I disable motor controller
Lets see the Raspberry Pi come up...

VNC has reconnected.

Lets try initialising it (I should initialise to stopped early)
Can I measure the battery output now? 7.34 - still good. (no it wasn't, they were dead)

## Testing

Using gpiozero robot object in the code.

- Initialised.
- Motor power enabled.
- Lets try forwards.
- Reset? Or non responsive after enabling power. Lets switch from vnc to putty.
- It's not reset - uptime 5 minutes.
- Just vnc..

Okay it moves.
So that is not the reset.

- `robot.forward()` was fine.
- `robot.left()` was a reset!

Why is that?

- Uptime confirms it is a reset
- Backwards is fine.
- Right is ALSO a reset. Is this a big current pull trying to turn? Can we reduce current by reducing speed? The l298 is famously not too clever about this overcurrent stuff.

## Making a lower power board

Lets rejig power:

Ubec to Pi and for L298 digital side. Only motors go from battery directly.
Create a lower power distribution board (regardless of battery/usb it makes sense).

From bottom to top deck we need:

1. +5v
2. gnd
3. line - right - signal
4. line - mid - signal
5. line - left - signal
6. motor left a
7. motor left b
8. motor right a
9. motor right b
10. motor sense left a
11. motor sense left b
12. motor sense right a
13. motor sense right b

call it 14 (extra one for a sensor?)

Then we bring up 2 sets of 7.

### Right side

Pi Power is here

1. +ve
2. gnd
3. motor right a
4. motor right b
5. odometry right a
6. odometry right b
7. line sense right

### Left side

1. unusued
2. line sense middle
3. motor left a
4. motor left b
5. odometry left a
6. odometry left b
7. line sense left

Wiring is getting too messy.
Lets swap it out for a picon zero - sounds better.

## Next steps

- Get the wiring working and reliable.
- Get the power sorted.
- Make a video of this in action
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: My Raspberry Pi computer vision robot Skittlebot works!
date: 2017-05-14
tags: [robot building, piwars, opencv, electronics, power, raspberry pi robotics project, raspberry pi opencv project, gpiozero robotics project]
thumbnail: content/2017/05/14-skittlebot-video/skittlebot-working-screenshot.png
---
I now have my Raspberry Pi based computer vision demonstration robot working! This is a big step forwards, as I can start looking at more interesting projects and competitions with it.

## Specifications

- 4Tronix PiCon Zero
- Raspberry Pi 3
- V1 Camera module
- 4Tronix Initio chassis
- Logic power is a USB power bank
- Motor power is 6xAA batteries
- Raspberry Pi image created with PiBakery - and using precompiled NUmpy and OpenCV libraries
- Programmed in Python

## Updates since last time

I've rewired to use the PiCon Zero instead of the L298n and all that point to point wiring. This has made it a lot neater, and there's less to debug.

I've also separated the Raspberry Pi power out to a USB power bank. This means I can run the Pi without the motors, and I can also run the motors without the Pi. This is a good thing, as it means I can debug the motors without the Pi crashing. It also means that large current issues won't reset the Raspberry Pi.

## Video

The Skittlebot video tells the story of it's creation, and adaptation from the Arduino robot, along with the first tests of the computer vision system.

<iframe width="560" height="315" src="https://www.youtube.com/embed/z14HcflsRW0" frameborder="0" allowfullscreen></iframe>

Skittlebot was built when I found that armbot was too big to come to PyCon Uk 2016. It uses a camera and visual processing to locate coloured objects, and knock them over. See how I built it, see it running, why I made it and how the code was written.

The video mixes footage that was unreleased from multiple sessions, and includes the point where I'd shaved my head for a while!

## Code

The software uses PiCamera, Python and OpenCV.

The code is at <https://github.com/orionrobots/skittlebot>.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions content/2017/10/2017-10-13-turning-skittlebot-into-piwars-robot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Turning Skittlebot into a PiWars Robot
date: 2017-10-13
tags: [robot building, piwars, opencv, electronics, power, raspberry pi robotics project, raspberry pi opencv project, gpiozero robotics project, piwars, robotics competitions]
---
Skittlebot based on the Initio chassis may actually be a little slow to be a piwars bot, but it's certainly a great platform to get the basics down.

So the plan is a set of experiments, to get the code going, get the Raspberry Pi and power in a good state, then look at making it all faster and lighter.

this plan is likely optimistic, but lets get as many ideas down as we can first.

## Major areas to cover

* Remote - I have a Playstation Six Axis controller. Getting this paired with the device, and repeatable so I have code + PiBakery recipe is expected.
* Straight Line autonomous - build a rig similar to the straight line at piwars - get SkittleBot good at touching no sides and going as fast as it can along the line - not that there IS a line to follow on the floor too - which may be easier than other sensors.
* Camera - the over the rainbow challenge, and the rear ultrasonic sensor.
* Spec out replacement chassis - customised:
* 3D printed, off the shelf, toy hack or CNC carved?
* Faster motors.
* Line follower modules.
* Power - separate Pi and motor (as SkittleBot already does).
* Make the bottom half only first - get this right, with a simple bracket for the pan/tilt mechanism I already have.
* Test driving WS2801's from a Raspberry Pi.
* Replacement top
* Get styling here - something unique to orionrobots - possibly doing a few thick structural 3D print areas, but many thin/hollow areas that are purely for style.
* Consider the WS2801 6 Status LED's at this point.

## Remote

The SixAxis controller is Bluetooth. There is a [PiBorg guide](https://www.piborg.org/rpi-ps3-help) on connecting them up. Lets follow that - and get it driving over bluetooth.

Consider the inputs library? <https://pypi.python.org/pypi/inputs>

A bit less heavy than pygame - but not sure it'll work with the ps3 sixaxis. This library has come from Zeth, a rather instrumental part of PyCon UK!

The PyGame route: [PS3 controller with PYGAME](https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=147234)
Loading
Loading