# OberBot

## Projekte die damit möglich sind

- Line following robot
- Kartographierung
- Hindernis Erkennung

## Software

Neben der Implementierung in C / C++ ist die Programmierung in MicroPython möglich. Am besten kapseln wir die ganze Hardware noch schön in ein Modul. Folgender Beispiel-Code lässt die Roboter gerade aus fahren:

```
import machine
import time

stepLeft = machine.Pin(0, machine.Pin.OUT)
stepRight = machine.Pin(12, machine.Pin.OUT)
dirLeft = machine.Pin(2, machine.Pin.OUT)
dirRight = machine.Pin(13, machine.Pin.OUT)
motorDisable = machine.Pin(14, machine.Pin.OUT)

motorDisable.off()
dirLeft.off()
dirRight.off()
while 1:
    stepLeft.on()
    stepRight.on()
    time.sleep_ms(1)
    stepLeft.off()
    stepRight.off()
    time.sleep_ms(1)
```

- [Oberbot Python Library](https://git.oberlab.de/oberbot/python)
- [MicroPython Doku](http://docs.micropython.org/en/latest/esp8266/tutorial/index.html)
- [WebREPL](http://micropython.org/webrepl/)

## IDE

[https://github.com/mu-editor/mu](https://github.com/mu-editor/mu)

```
git clone https://github.com/mu-editor/mu.git
cd mu
pip3 pip install -r requirements.txt
python3 run.py
```

## Aktuelle Hardware Hypothese

Favorisierte Lösung: Wemos D1 mini mit steppern und A4988 Treibern. Alles Weitere wird, wenn möglich über I2C angeschlossen.  
Kostenübersicht bei schneller Beschaffung:

<table id="bkmrk-bauteil-anzahl-koste"><thead><tr><th>Bauteil</th><th>Anzahl</th><th>Kosten</th><th>Gesamtkosten</th><th>Status</th></tr></thead><tbody><tr><td>[WEMOS D1 Mini](https://www.ebay.de/itm/ESP8266-ESP-12-D1-Mini-WiFi-Develop-Kit-Development-Board/143003871118)</td><td>1</td><td>4,10</td><td>4,10</td><td>lagernd</td></tr><tr><td>[Boost Converter](https://www.ebay.de/itm/SX1308-Step-Up-Booster-Converter-Spannungsregler-Wandler-DC-DC-2-24V-2-28V/162475858855)</td><td>1</td><td>3,41</td><td>3,41</td><td>bestellt</td></tr><tr><td>[A4988](https://www.ebay.de/itm/5stk-StepStick-Stepper-Motor-A4988-Driver-Module-fur-Reprap-3D-Drucker-TE906/123465083534)</td><td>2</td><td>1,16</td><td>2,32</td><td>lagernd</td></tr><tr><td>[stepper](https://www.ebay.de/itm/3Sets-28BYJ-48-DC5V-Stepper-Motor-with-4-Phase-5-Wire-ULN2003-Driver-Board-TE759/132816404359)</td><td>2</td><td> </td><td>4,46</td><td>lagernd</td></tr><tr><td>[port expander](https://www.ebay.de/itm/NEU-PCF8574T-Remote-8-bit-I-O-expander-IOT-I2C-Bus-Arduino-Raspberry-Pi-DIY-209/282747767852)</td><td>1</td><td>1,99</td><td>1,99</td><td>chips lagernd stangenware</td></tr></tbody></table>

Gesamtkosten knapp über 17 Euro. Und das noch ohne Spielerreien. Shopping in Europa macht keinen Spaß!!! ![😉](https://twemoji.maxcdn.com/v/12.1.2/72x72/1f609.png)

Status: für Prototypen  
Bei den Steppern ist der ULN2003 schon dabei! Eventuell Versuch mit port expander und uln2003

Pinout revision 0

```
d1 mini pro
         reserved | RST      TX | UART / programmer
                  | A0       RX | UART / programmer
   reserved servo | D0       D1 | I2C SCL
     motor enable | D5       D2 | I2C SDA
motor rechts step | D6       D3 | motor links step
 motor rechts dir | D7       D4 | motor links dir
                  | D8      GND |
                  | 3V3      5V |
```

## I2C Bus

<table id="bkmrk-adresse-device-0x20-"><thead><tr><th>Adresse</th><th>Device</th></tr></thead><tbody><tr><td>0x20</td><td>port expander 1</td></tr><tr><td>0x29</td><td>TOF</td></tr><tr><td>0x3C</td><td>Display</td></tr><tr><td>0x68</td><td>IMU</td></tr></tbody></table>

## Hardware Optionen

- Schrittmotoren: [28BYJ-48](https://de.aliexpress.com/item/Smart-Elektronik-Neue-Marke-28BYJ-48-DC-5-v-Reduktion-Schritt-Motor-Getriebe-Schrittmotor-4-Phase/32864445067.html) mit 
    - ULN2003 - Vorteil: geht mit 5 Volt Nachteil: 8 Pins Verbraucht
    - A4988 Driver Vorteil: Step/Dir Interface - dadurch nur 4 Pins. Einstellbarer Strom. Nachteil: operational &gt;8V!. Der mit [Stepup converter](https://de.aliexpress.com/item/2-24-V-zu-2-28-V-2A-DC-DC-SX1308-Step-UP-Einstellbare-Power-Module/32873124342.html)
- Controller: ESP8266 plain: Vorteil: Bauhöhe 
    - [WEMOS D1 Mini](https://de.aliexpress.com/item/Smart-Electronics-D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based/32659152063.html) vorteilhaft, da programmer mit drauf.
    - Upgrade: ESP32 - eventuell notwendig wegen IO pins
- Line following hardware: [IR Sensoren](https://de.aliexpress.com/item/10pcs-IR-Infrared-Obstacle-Avoidance-Sensor-Reflection-Photoelectric-Module-for-Arduino-Reflective-Photoelectric/32807780678.html). Min 2, besser 4
- TOF sensor [VL53L0X](https://de.aliexpress.com/item/GY-530-VL53L0X-World-smallest-Time-o-f-Flight-ToF-laser-ranging-sensor/32738458924.html)
- mpu6050
- [OLED](https://de.aliexpress.com/item/0-96-Zoll-IIC-Serien-Wei-Oled-display-modul-128X64-I2C-SSD1315-12864-Lcd-bildschirm-Bord/32840168680.html)
- [port expander](https://www.aliexpress.com/item/PCF8574-PCF8574T-I-O-for-I2C-Port-Interface-Support-Cascading-Extended-Module/32673494148.html)

Kosten:

<table id="bkmrk-bauteil-anzahl-koste-1"><thead><tr><th>Bauteil</th><th>Anzahl</th><th>Kosten</th></tr></thead><tbody><tr><td>mpu6050</td><td>1</td><td>0,66 $</td></tr><tr><td>A4988</td><td>2</td><td>0,75 $</td></tr><tr><td>28BYJ-48</td><td>2</td><td>1,25 $</td></tr><tr><td>UL2003</td><td>2</td><td>0,40 $</td></tr><tr><td>WEMOS D1 Mini</td><td>1</td><td>2,15 $</td></tr><tr><td>VL53L0X</td><td>1</td><td>2.61 $</td></tr><tr><td>Stepup Converter</td><td>1</td><td>0.34 $</td></tr><tr><td>IR Sensoren</td><td>4</td><td>0,28 $</td></tr><tr><td>OLED</td><td>1</td><td>1,95 $</td></tr><tr><td>portexpander</td><td>1</td><td>0,80 $</td></tr></tbody></table>

Gesamtkosten: 13,6 $

Was kostet 3D Druck?!

## Supply Chain Management ![😉](https://twemoji.maxcdn.com/v/12.1.2/72x72/1f609.png)

<table id="bkmrk-bauteil-anzahl-koste-2"><thead><tr><th>Bauteil</th><th>Anzahl</th><th>Kosten pro Stück</th><th>Anmerkung</th><th>Status</th></tr></thead><tbody><tr><td>[WEMOS d1 mini](https://www.aliexpress.com/item/1PCS-D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266/32843721010.html)</td><td>20</td><td>2.25</td><td>black friday + DHL eCommerce shipping</td><td>10 bestellt</td></tr><tr><td>[A4988](https://www.aliexpress.com/item/3D-printer-machine-driver-module-A4988-A4983-StepStick-Stepper-Motor-Driver/32459985724.html)</td><td>40</td><td>0.80</td><td>black friday + DHL eCommerce shipping</td><td>26 bestellt</td></tr><tr><td>[stepup](https://www.aliexpress.com/item/2-24V-to-2-28V-2A-DC-DC-SX1308-Step-UP-Adjustable-Power-Module-Step/32873124342.html)</td><td>20</td><td>0.34</td><td> </td><td>14 bestellt</td></tr><tr><td>[IR sensor](https://www.aliexpress.com/store/product/10pcs-TCRT5000-infrared-reflectance-sensor-Obstacle-avoidance-module-tracing-sensor-tracing-module/1817254_32676606328.html)</td><td>+40</td><td>0.41</td><td>black friday + DHL eCommerce shipping</td><td>40 bestellt</td></tr><tr><td>[28BYJ-48 5v](https://www.aliexpress.com/item/1pcs-Wholesale-28BYJ-48-Lead-25cm-Stepper-Motor-DC-5V-4-Phase-Step-Motor-Reduction-Drop/32946280978.html)</td><td>40</td><td>1.42</td><td>black friday + ePacket (20-25 tage)</td><td>17 bestellt</td></tr><tr><td>[oled](https://www.aliexpress.com/item/WAVGAT-White-ouble-color-128X64-OLED-LCD-LED-Display-Module-For-Arduino-0-96-I2C-IIC/32828120727.html)</td><td>20</td><td>1.94</td><td>black friday. uncooler versand. nur 10 stück ordern</td><td>10 bestellt</td></tr><tr><td>[dupont cable, f/f](https://www.aliexpress.com/item/40PIN-Dupont-Line-10CM-20CM-30CM-Male-to-Male-Female-to-Male-and-Female-to-Female/32891879068.html)</td><td>5x40</td><td>alle 3.3</td><td> </td><td>200 bestellt</td></tr><tr><td>[motor connector](https://www.aliexpress.com/item/50PCS-Lot-XH2-54-Pin-Header-Connector-2P-3P-4P-5P-6P-7P-8P-9P-10P/32820868041.html)</td><td>1</td><td>1.13</td><td>für 50 stück!</td><td>50 bestellt</td></tr><tr><td>[pin header farbig](https://www.aliexpress.com/item/10PCS-40Pin-1x40P-Male-Breakable-Pin-Header-Strip-2-54mm-Long-Blue-Red-White-Green-Yellow/32863408765.html)</td><td>1 mal je schwarz, rot, gelb, grün</td><td>2</td><td>preis für alle</td><td>4x400 bestellt</td></tr><tr><td>[dupont housing 4 pin](https://www.aliexpress.com/item/For-dupont-connector-6pin-single-row-2-54mm-for-dupont-plastic-shell-through-hole-100pcs-lot/32637991458.html)</td><td>1x100</td><td>1.69</td><td> </td><td>100 bestellt</td></tr><tr><td>[dupont housing 2 pin](https://www.aliexpress.com/item/For-dupont-connector-6pin-single-row-2-54mm-for-dupont-plastic-shell-through-hole-100pcs-lot/32637991458.html)</td><td>1x100</td><td>1.21</td><td> </td><td>100 bestellt</td></tr><tr><td>[batterie halter](https://www.aliexpress.com/item/1pc-AA-Size-Battery-Storage-Box-Case-Holder-Leads-With-1-2-3-4-Slots-Container/32848865853.html)</td><td>10</td><td>4.4</td><td>erst mal 10. muss erst getestet werden!</td><td>10 bestellt</td></tr><tr><td>[schalter](https://www.aliexpress.com/item/21-15mm-On-Off-Boat-Car-Rocker-Switch-2Pin-6A-10A-250V-125V-AC-Button-Best/32914963172.html)</td><td>10</td><td>1.75</td><td>erst mal 10. muss erst getestet werden!</td><td>10 bestellt</td></tr><tr><td>[taster](https://www.aliexpress.com/item/10Pc-Limit-Switch-Push-Button-Switch-1A-125V-AC-Mouse-Switch-3Pins-Micro-Switch/32923912315.html)</td><td>2x10</td><td>1.24</td><td>erst mal 20. muss erst getestet werden!</td><td>//</td></tr></tbody></table>

[PCB Fertiger](https://www.electrodragon.com/product/pcb-service/)