For making the advanced Line Following robot, I have QTR8RC,TB6612FNG motor driver, 4 pin I2C OLED, 2 motors with encoders, mpu6050 gyro sensor, 4 buttons for menu navigation, 3 ultrasonic sensors. I used Arduino nano at first but ran out of pins. I want to use ESP-32 devkit. I am new to this. Will I ran out of pins. If no, can anyone show me the connection diagram please?
Why are you making an advanced line follower? You should be making a basic line follower.
Work this out for yourself. Draw a diagram showing how you would connect each device to the ESP32. You will discover quickly if you have enough pins. Post the diagram and the forum can check it for you.
Thanks for your reply. I tried to make the connection myself, but always end up sharing same pin for different components. Can you tell me where should I make changes?
QTR-8RC Line Sensors:
- Sensor 1: GPIO 32
- Sensor 2: GPIO 33
- Sensor 3: GPIO 34
- Sensor 4: GPIO 35
- Sensor 5: GPIO 25
- Sensor 6: GPIO 26
- Sensor 7: GPIO 27
- Sensor 8: GPIO 14
- Sensor VCC: 3.3V
- Sensor GND: GND
TB6612FNG Motor Driver:
- PWMA: GPIO 12 (PWM)
- AIN1: GPIO 26
- AIN2: GPIO 27
- PWMB: GPIO 13 (PWM)
- BIN1: GPIO 15
- BIN2: GPIO 2
- STBY: 3.3V
- VM: Motor power supply voltage (e.g., 5V)
4-pin I2C OLED Display:
- SDA: GPIO 21
- SCL: GPIO 22
- VCC: 3.3V
- GND: GND
Motors with Encoders:
- Motor A PWM: GPIO 4 (PWM)
- Motor A Direction: GPIO 5
- Motor B PWM: GPIO 18 (PWM)
- Motor B Direction: GPIO 19
- Motor A Encoder A: GPIO 16
- Motor A Encoder B: GPIO 17
- Motor B Encoder A: GPIO 0 (can be connected to a different GPIO if available)
- Motor B Encoder B: GPIO 15
MPU6050 Gyro Sensor:
- SDA: GPIO 23
- SCL: GPIO 19 (can be connected to a different GPIO if available)
- VCC: 3.3V
- GND: GND
Buttons:
- Button 1: GPIO 32
- Button 2: GPIO 33
- Button 3: GPIO 34
- Button 4: GPIO 35
- Button VCC: 3.3V
- Button GND: GND
Ultrasonic Sensors:
- Sensor 1 Trigger: GPIO 25
- Sensor 1 Echo: GPIO 26
- Sensor 2 Trigger: GPIO 27
- Sensor 2 Echo: GPIO 14
- Sensor 3 Trigger: GPIO 32
- Sensor 3 Echo: GPIO 33
- Sensor VCC: 5V
- Sensor GND: GND
I don't understand this part. Usually encoders require 2 digital inputs each.
This would use same pins as OLED.
I moved your topic to a more appropriate forum category @silver1.
The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.
In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Thanks in advance for your cooperation.
I would suggest adding a pcf8575 I/o extender. This would share same pins as OLED and gyro sensor and would provide 16 digital inputs or outputs which could be used for buttons and maybe your line sensors or motor driver pins (non-pwm). You might also want to connect the interrupt pin of the I/o extender to an ESP32 pin.
I would not use the I/o extender for the ultrasonic sensors or encoders because accurate timing of the signals is important for those sensors.
Sorry, I made a mistake. The encoders take 4 GPIO pins. I forgot to add others to the motor driver. I have another query. I want to use the OLED as menu navigating through the button. That way I can control threshold, motor speed, modes etc. and use the gyro for better acceleration, turning capability and etc. Will sharing the same SCL and SDA have any problem?
No. The SCL and SCA pins are used for the i2c bus. A bus can have several devices connected at the same time. Each device has a unique address on the bus, so that the ESP32 can communicate with each device alone.
I do not know what those are.
Time to post your diagram, or at least your updated list of connections. Maybe this time, list each available ESP32 pin and show what pin of which device it will be connected to.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.