Micromouse 🔬 🐭

Clara Casas Castedo & Miguel Sánchez de León Peque

2019-11-09

Introduction

OSHWDem 🐙

Micromouse

Electronics

Infrarred sensors

Mount

Simple schematic

Complex schematic

Distance calculation

\[ y = e^{\frac{a}{x+b}} \]

More on micromouseonline.com

Noise cancellation

Errors

Linearity

Motor Drivers

Encoders

Gyroscope

LEDs, speaker, buttons, switch

Bluetooth

Battery and power coversors

Microcontroller

Peripheral Use
ADC1 Phototransistors
ADC2 Battery
TIM1 PWM signal for speaker / Sensors state machine
TIM2 Left motor quadrature encoders
TIM3 PWM signals for left and right motors
TIM4 Right motor quadrature encoders
USART Serial, Bluetooth
SPI Gyroscope
GPIOS Infrarred emitters, LEDs, buttons
SYSTICK Control, encoder, distances

Prototyping

Mechanical design 🔧

Wheels… but how many?

Image taken from micromouseusa.com

Image taken from micromouseonline.com

Image taken from micromouseonline.com

Image taken from micromouseonline.com

Better start with 2…

Image taken from http://haido.blog.jp/

CAD designs

Image taken from http://haido.blog.jp/

And the fan?

Image taken from http://haido.blog.jp/

Robot physics

Goals 🎯

  • Straight lines
  • Turns
  • 👍 😂

Limitations 😅

  • Acceleration

System

Angular velocity

\[ \begin{aligned} \overline{v_2} &= \overline{v_1} + \overline{w} \wedge \overline{r_{21}} \\ v_2 \overline{u} &= v_1 \overline{u} + (w \overline{u_z}) \wedge (2d \overline{t}) \\ v_2 &= v_1 + 2dw \\ \\ w &= \frac{v_2 - v_1}{2d} \end{aligned} \]

Linear velocity

\[ \begin{aligned} \overline{v_M} &= \overline{v_1} + \overline{w} \wedge \overline{r_{M1}} \\ v_M \overline{u} &= v_1 \overline{u} + (w \overline{u_z}) \wedge (d \overline{t}) \\ v_M &= v_1 + wd \\ &= v_1 + \left(\frac{v_2 - v_1}{2d}\right)d \\ \\ v_M &= \frac{v_1 + v_2}{2} \end{aligned} \]

Control

Approach

  • Neural networks?
  • State space control?

PID! 👍 😂

Feedback controller

Trapezoidal speed profiles

Speed profile

Calculating turns

From the motion equations:

\[ \begin{aligned} \dot{x} &= v_m cos \theta \\ \dot{y} &= v_m sin \theta \end{aligned} \]

Considering \(\dot{w} \equiv cte.\) and \(v_m \equiv cte.\):

\[ \theta = w_0 t + \frac{k}{d} t^2 \]

Discrete integration approximation

Sinusoidal speed profiles

Why not?

\[ \omega = \omega_{max} sin\left(\frac{x}{\lambda}\right) \]

\[ \dot{\omega} = \frac{\omega_{max}}{\lambda} cos\left(\frac{x}{\lambda}\right) \]

Thanks Peter! 😄

Theoretical forces (straight)

\[ F_α = {mα \over 2} \]

Theoretical forces (turn)

Angular acceleration

\[ F_{Δω} = {IΔω \over 2T} \]

Centrifugal force

\[ F_ω = {mvω \over 2} \]

Forces on each tire

\[ F_R = \sqrt{(F_α + F_{Δω})^2 + F_ω^2} \\ F_L = \sqrt{(F_α - F_{Δω})^2 + F_ω^2} \]

While turning \(F_\alpha = 0\):

\[ F = \sqrt{\left({I\dot{\omega} \over 2T}\right)^2 + \left({mv\omega \over 2}\right)^2} \]

So… 🎉 🎉

\[ F = \sqrt{{I^2\omega_{max}^2 \over 4T^2\lambda^2} cos^2\left({x \over \lambda}\right) + {m^2 \omega_{max}^2 v^2 \over 4} sin^2\left({x \over \lambda}\right)} \]

\[ F = \sqrt{k_1 cos^2\left({x \over \lambda}\right) + k_2 sin^2\left({x \over \lambda}\right)} \]

If \(k_1 = k_2 = k_0^2\):

\[ F = k_0 \sqrt{cos^2\left({x \over \lambda}\right) + sin^2\left({x \over \lambda}\right)} = k_0 \]

Search turn trajectory

Search turn forces

90° turn trajectory

90° turn forces

Other trajectories

Notebook on GitHub

Advantages

  • Constant force
  • Linear speed does not affect turn parameters!

Maze-solving algorithm

Floodfill 🌊

  1. Assume there are no walls
  2. Calculate distances to target
  3. While goal not reached…
  4. Go to the cell that is closest to the target
  5. Update walls
  6. Update distances

Update process 👀

Software design

Sensors state machine

  • 16 KHz trigger
  • Sequentially power on and off
  • 4 states * 4 sensors

Systick

  • 1 KHz trigger
  • Update ideal speed, encoder, distances
  • Motor control

Main

  • Setup
  • Buttons, debug LEDs
  • Speed profiles
  • Algorithm
  • Communication

Required tools

Hardware

  • Battery charger
  • Power supply
  • Programmer
  • Soldering station
  • Polimeter
  • Logic analyzer
  • Oscilloscope

Software

  • C language - libopencm3, gcc, clang format
  • Python - notebooks, scripts, communication
  • Continuous integration - github, travis
  • Reviews & management - github
  • Documentation - doxygen, sphinx
  • Board design - upverter

Maze

Logging

Plotting

Costs

Very optimistic costs

  • Around 60 €
  • Half is just for motors+encoders (second hand)
  • Electronic parts and boards are really cheap (carefully selected)

Realistic costs

  • Lots
  • Replacements
  • Shipping costs
  • More than 100 €
  • Not counting tools, maze…

And then…

Time… 😂

That’s all! 🎉

Resources 🔗

Bulebots
Peter Harrison
Green Ye

Thanks! ❤️