Visuino Obstacle Module, Stepper Motor, OLED Lcd, DRV8825 Driver
by RonFrtek in Circuits > Arduino
2491 Views, 8 Favorites, 0 Comments
Visuino Obstacle Module, Stepper Motor, OLED Lcd, DRV8825 Driver
In this tutorial we will use stepper driver DRV8825, OLED lcd, IR sensor module, led, buttons, resistors, stepper motor, Arduino Mega and Visuino to start/stop when obstacle is detected by IR sensor. Watch a demonstration video.
What You Will Need
- Arduino MEGA (can be any other Arduino)
- Breadboard (or breadboard shield)
- Jumper wires
- RED LED (or any other color)
- IR sensor module
- OLED lcd
- 4X Pull-up resistor (50k ohm)
- Stepper motor 28BYJ48 (can be any other stepper, just make sure that you know how to wire it on controler)
- DRV8825
- Capacitor 100qF/16V
- Visuino program: Download Visuino
The Circuit
- Connect GND from Arduino to the breadboard pin(-)
- Connect 5V from Arduino to the breadboard pin(+)
- Connect IR sensor pin(vcc) to breadboard pin(+)
- Connect IR sensor pin(gnd) to breadboard pin(-)
- Connect IR sensor pin(AO) to Arduino pin(2)
- Connect pin(13) from Arduino to the resistor
- Connect resistor to LED(+)
- Connect LED pin (-) to breadboard pin(-)
- Connect OLED LCD pin(vcc) to breadboard pin(+)
- Connect OLED LCD pin(gnd) to breadboard pin(-)
- Connect DRV8825 RESET and SLEEP pin to breadboard positive pin
- Connect DRV8825 GND pin to breadboard negative pin
- Connect DRV8825 DIR pin to Arduino pin (5)
- Connect DRV8825 STEP pin to Arduino pin (6)
- Connect Power Supply for the motor to DRV8825 VMOT and GND
- Connect Capacitor across VMOT and GND
- Connect stepper motor as shown on the picture.
(note that this motor is UNIPOLAR but the driver is used for BIPOLAR motors, so we will wire this motor as it would be BIPOLAR, this means that we will left one wire unconnected) **if the motor is humming and not moving when you run the circuit, it means that the wires of the motor are not connected correctly **To check what wires are A1,A2 or B1,B2 on a motor use multimeter (beep function) and connect wires to it, if it beeps it means you have found the right pair
Start Visuino, and Select the Arduino MEGA Board Type
To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://www.arduino.cc/.
Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this Instructable will not work!
If you have not done follow the steps in this Instructable to setup the Arduino IDE to program ESP 8266! The Visuino: https://www.visuino.eu also needs to be installed.
Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino MEGA 2560" as shown on Picture 2
In Visuino Add Components
- Add Pulse Generator, set frequency to 200
- Add Inverter component
- Add AND Logic gates
- Add Led component
- Add ObstacleAvoidance component
- Add Delay component and set interval to 50
- Add OLED display component
- Double click OLED component ad in the dialog (right)select "Fill screen" drag it to the left side under properties set color to tmcBlack
- select "Draw Bitmap" drag it to the left side under properties "Bitmap" load desired bitmap (like stop sign), under properties "X" set it to 40, and "y" to 20
- select "Draw Text" drag it to the left side and under properties "Text" type "CLEAR WAY", under properties "X" set it to 10
- select "Draw Text" drag it to the left side and under properties "Text" type "DETECTED OBSTCALE", under properties "X" set it to 10
In Visuino: ​Connecting Components
- Connect Pulse Generator pin Out to logic gate1 component pin [1]
- Connect logic gate1 component pin [out] to Arduino pin digital [7]
- Connect Led1 pin [out] to Arduino pin digital [13]
- Connect ObstacleAvoidance1 pin [out] to logic gate1 component pin [0]
- Connect ObstacleAvoidance1 pin [out] to inverter1 component pin [in]
- Connect Inverter1 pin [out] to LED1 pin[in]
- Connect Inverter1 pin [out] to OLED Fill Screen1
- Connect Inverter1 pin [out] to Delay1 pin [start]
- Connect Delay1pin [out] to OLED Draw Text1
- Connect Delay1pin [out] to OLED Draw Bitmap1
- Connect ObstacleAvoidance1 pin [out] to OLED Clear
- Connect ObstacleAvoidance1 pin [out] to Fill Screen1
- Connect Arduino pin serial[0] to Oled lcd pin[in]
- Connect Arduino pin digital out[2] to ObstacleAvoidance1 pin [in]
- Connect Arduino pin digital out[2] to Arduino pin serial[in]
- Connect OLED lcd I2C pin [out] to Arduino I2C pin [in]
Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.
Play
If you power the Arduino Mega module, the Oled Lcd will start showing text "Clear way" and the stepper will rotate, once you put any obstacle infront of IR sensor, the stepper motor will stop and LCD will show "obstacle detected".
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable. You can download and open it in Visuino: https://www.visuino.eu