Page:
LEGO
Pages
Audio Input und Speech Recognition
Cocoon man
Coffin ghost
Crazy Witch
Deploying flask with uwsgi and nginx
Dungeon
Eyes in the dark
Grave riser
Halloween Control Center
Hanging ghost
Home
How to get the NodeMCU up and running
How to install py neopixel spidev
How to install pylibftdi for DMX
Ideas 2018
Ideas 2019
Ideas for 2021 (hopefully)
Ideas for 2022
Ideas for 2023
Ideas for 2024
Ideas for refactoring 2021
Installations
LEGO
Monster in a box
Open a reverse shell
Prisoner
Raspberry Pi Overview
Setting up a new scary RPi
Setup Remote Software Update
Spider
Swaying Zombie
USB Audio on Raspberry Pi Zero
Web API
Weremonkey
Zombie Fence
No results
7
LEGO
mishi edited this page 2020-10-18 14:42:46 +02:00
Table of Contents
LEGO
Description
The LEGO is not yet defined but is based on up to for DC motors controlled via the RPi's hardware PWM. The RPi interacts with H-bridges such as L293D instead of the classic relay board. Up to 8 pins are used 4 with the hardware PWM and 4 for the direction selection.
Network location
- Hostname: lego
- URL: http://lego.local
- URL for motor control: http://lego.local/motor
Workflows
- accelerate: Motor speed is increased by 20%. The speed can't go above 100%.
- decelerate: Motor speed is decreased by 20%. If the speed goes negative, the direction is reversed. The speed can't get lower than -100%.
- stop: Motor speed is set to 0%.
- full_forward: Motor speed is set to 100%
- full_backward: Motor speed is set to -100%. The direction is reversed.
Raspberry Pi pinout:
| RPi Pin | RPi Name | Destination | Wire | Function |
|---|---|---|---|---|
| 1 | 3V3 | H bridge VCC | brown | |
| 6 | Ground | H bridge Gnd | black | |
| 12 | GPIO18 | H bridge IN 1+ | red | PWM motor 1 |
| 16 | GPIO23 | H bridge IN 1- | orange | DIR motor 1 |
| 32 | GPIO12 | H bridge IN 2+ | PWM 2 | |
| GPIO | H bridge IN 2- | DIR 2 | ||
| 33 | GPIO13 | H bridge IN 3+ | PWM 3 | |
| GPIO | H bridge IN 3- | DIR 3 | ||
| 35 | GPIO19 | H bridge IN 4+ | PWM 4 | |
| GPIO | H bridge IN 4- | DIR 4 |
TODO
- Expand implementation to four motors. Today, only PWM 1 and DIR1 are supported. PWM 1 pin mapping is hardcoded as well.
- Make the transitions of the motor speed smoother by changing the speed in 20% steps. Today, it can change from -100 to +100% which creates are large ruck.
- Accelerate the handover of speed changes. Today, the new speed is hander to the PWM control task which applies the new value every 100ms.
Also, the speed changes are applied with a HTTP GET which requires a page to be returned. With a PUSH it might be quicker. Same as for the button toggles. This would require a custom control page for the motor controls like the system page. How about a slider for the speed? We need a generic route for setting the motor speed.DONE- PWM frequency should be made a parameter.
- The speed step size (today 20%) should be made a parameter.