I am a complete newbie to robotics, so please excuse me if this is a simple question. I bought this robot starter kit and need help understanding which features are associated to which GPIO pins:



Here are the schematics: Schematics

Is this information sufficient for me to know what feature is mapped to the GPIO pins or do I have to follow some type of trial and error process to figure it out? Your help would be greatly appreciated.


Waveshare maintain a wiki page for the Alphabot2.

In the resources section on that page, there are some links to demo code which contains definitions for the allocation of GPIO pins.

It looks like the specific file you want is AlphaBot2-Demo.7z

The compressed file contains a folder named Python:

Python folder

I've taken the mappings below from these files. Note that this list of GPIO mappings may not be exhaustive as I haven't fully followed through on checking file dependencies etc.

Note also that the pin assignments used in the code use Broadcom GPIO numbers (BCM). These are the GPIOxx numbers on the diagram below, not the actual pin numbers on the header:

Raspberry Pi GPIO pins

AlphaBot2.py appears to control the robot's motors. The pin assignments are:


Ultrasonic_Obstacle_Avoidance.py and Ultrasonic_Ranging.py specify:

TRIG = 22
ECHO = 27

Which are obviously the pins allocated to your ultrasonic sensor

Similarly, Infrared_Obstacle_Avoidance.py specifies

DR = 16
DL = 19

which are the pins used by the IR sensor

TRSensors.py specifies:

CS = 5 
Clock = 25 
Address = 24 
DataOut = 23 
Button = 7

IRremote.py sets

IR = 17

For your remote control

Joystick.py assigns the following pins:

CTR = 7
A = 8
B = 9
C = 10
D = 11
BUZ = 4

Line_Follow.py also sets GPIO7:

Button = 7

Finally, ws2812.py sets the LED pin to 18

LED_PIN = 18  # GPIO pin connected to the pixels (must support PWM!).
| improve this answer | |
  • $\begingroup$ Thank you so much for your detailed response. $\endgroup$ – c0D3l0g1c Feb 23 '19 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.