GSOC 2019 - A DIY robot kit for educators Wiki
With that project | designed an easy to assembly and program, robot from scratch. The designs is 3D printable and all the electronics parts are easy to find in any electronic equipment store. The robot have the Raspberry Pi 3+ as the main computer with Raspbian operating system combined with Jupyter Notebook as programing interface and a Node.js application as front-end main control page. You can program and control the robot through your browser using the Proteas wireless access point.
The 3D printed parts and the source code can be found here.
Proteas robot teaser video
---
Complete instructions for the Proteas Robot.
The instructions separated into seven chapters.
1. Parts preassembly 2. Parts description 3. Parts list
4, Robot assembly 5. Classes description 6. Robot usage 7. Expert users
Student
e Christos Chronis
GSoC Mentors
e traklis Varlamis e Theodoros Karounos e Konstantinos Kalovrektis
Organization : Open Technologies Alliance - GFOSS
The 3D designs, educational material and text is licensed under a Creative Commons Attribution- ShareAlike 4.0 International License.
---
Preassembly the parts
Some of the parts need preassembly to be ready for the final assembly stage. In this chapter, we will combine electronics and 3D printed parts to create the building blocks for the robot. Before you Start, be sure you have the correct electronic parts and the correct 3D printed parts. In every folder of the 3D printed parts, you can find photos of the electronic parts you need, also the code of every part can be founded in the Chapter 5 (Classes description) .
This is the only stage we will need some of the following tools:
1. Side cutter
2. Soldering iron
3. Asmall Philips screwdriver 4. A flat screwdriver
5. Hot glue gun
6. Superglue
1.1 Motor block
Remove a small piece of plastic from the yellow motor using the side cutter.
Prepare two female to female jumper wires of different colors, take the side cutter and cut the one of two female socket, after carefully remove a small length of the plastic isolation and expose the copper from inside the wire.
---
Solder to the two motor terminals the wires.
oe
Insert the motor inside the bottom part and pass the wires through the little slot of the top part.
---
Press the bottom part against the top part until secure.
---
1.2 Odometer block
Connect three female to female jumper wires to the sensor and write down the wire color to pin connection e.g. "RED -> 5V, BLACK -> Ground, GREEN -> Signal".
Slide the sensor inside the bottom of the 3D printed part in the special slots.
---
Slide the sensor disk on the shaft and place it in the special slots inside the bottom part.
---
Pass the wires through the little slot of the bottom part.
Press the bottom part against the top part until secure.
---
za
1.3 Internal odometer module
Connect three female to female jumper wires to the sensor and write down the wire color to pin connection e.g. "RED -> 5V, BLACK -> Ground, GREEN -> Signal".
Slide the sensor inside the bottom of the 3D printed part in the special slots.
---
Slide the sensor disk on the shaft and place it in the special slots inside the bottom part.
---
Connect the shaft coupler to the shaft. Later you can connect the odometer with the motor shaft using the coupler.
1.4 Infrared obstacle sensor module
---
Connect three female to female jumper wires to the sensor and write down the wire color to pin connection e.g. "RED -> 5V, BLACK -> Ground, GREEN -> Signal/Digital".
Slide the sensor inside the bottom of the 3D printed part and gently pass the two Led through the holes. The blue part of the sensor should be the upside.
Pass the wires through the hole of the top part.
---
Press the bottom part against the top part until secure.
1.5 Servo module
Slide the servo motor inside the of the 3D printed bottom part and pass the wires through the hole.
---
Press the bottom part against the top part until secure.
---
1.6 Ultrasonic Sensor module
Connect four female to female jumper wires to the sensor and write down the wire color to pin connection e.g. "RED -> 5V, BLACK -> Ground, GREEN -> Echo, ORANGE -> Trigger".
Slide the sensor inside the bottom of the 3D printed part.
---
Pass the wires through the hole of the top part.
Press the bottom part against the top part until secure.
---
1.7 Free wheel module
Pass the shaft through the hole of the large part and secure it with the wheel.
1.8 Camera module
---
Connect the flexible cable on camera.
<= ) ra) Raspberry Pi
Slide the camera inside the bottom of the 3D printed part.
Pass the flexible cable through the hole of the top part.
---
Press the bottom part against the top part until secure.
>.
me Ne —
v
1.9 Power module
Prepare two black, one red and one orange female to female jumper wires. Take the side cutter and cut the one of two female socket, after carefully remove a small length of the plastic isolation and expose the copper from inside the wire. The bottom side of the step-down circuit is labeled with the voltages. Unscrew the blue terminals and insert the orange wire to the terminal for the 9-36V and the red wire in the terminal for the 5V. Connect the black wires to the holes of the terminals with the "-" or Gnd label. Screw all the terminals and check if all the wires are secured.
---
Slide the circuit inside the bottom of the 3D printed part.
1.10 Mini breadboard module
---
Insert the mini breadboard inside the 3D printed part.
Press the bottom part against the top part until secure.
1.11 Raspberry pi base
Press the Raspberry pi carefully against the base until all the board locked on the base.
---
1.12 Multi connector module
Use the side cutter to cut 8 pins from the row.
Prepare one female to female jumper wire, take the side cutter and cut the one of two female socket, after carefully remove a small length of the plastic isolation and expose the copper from inside the wire.
---
Pass the end of the wire with the exposed copper from the small hole. Use the soldering iron and connect the wire to the first pin on the short side of 8 pin set. After connect the 7 remain pins with the first pin.
Finally press the 8 pin set in the slot until secured.
1.13 Motor diver module
This is one of the most complex to wiring component, you should be careful with the voltages and the connection, an error here can damage the Raspberry Pl.
Prepare seven female to female jumper wire, take the side cutter and cut the one of two female socket, after carefully remove a small length of the plastic isolation and expose the copper from inside the wire. Suggested one orange wire for 12V, one red wire for 5v, one black for ground and for the other four wire you are free to choose any color you want.
---
« «
a .
Remove from the board the two shortcut clip (green arrows). Unscrew the blue terminals and insert the orange wire to the terminal with 12V label, the red wire on the terminal with the 5V label, the black wire to the terminal with GND label and the other four cables to the remain terminals left and right . Screw all the terminals and check if all the wires are secured. Now connect 6 female to female jumper wires to the motor control pins (red arrows). The module is ready, please check again all the connections.
Motor B
Motor A control pins = Motor B control pins
1.14 Motor drive base
Press the motor driver carefully against the base until all the board locked on the base.
---
a ~~
1.15 Battery module
Before insert the batteries check the connections multiple times. That part requires three 18650 batteries. The circuit can charge the batteries with 12.3 V input and have 12V output . Also for the first time and every time you remove the batteries needs 12V input to activate the circuit.
1.16 Battery block
If you want to place the battery module outside the robot you should print the battery block.
---
Insert the battery module into the bottom part with the batteries cells face down and pass the charging wires through the little slot (red arrow).
Press the the top part against the bottom part and the battery block is ready. 1.17 Arm extender
Glue the small black circular hat in the slot of the arm extender. To attach the extender to the servo use the small screw.
---
1.18 Rotation base
Glue the small black circular hat in the slot of the rotation base . To attach the base to the servo use the small screw.
---
1.19 Gripper block
First you should glue the small hat to the small circular hat.
—y
a
&
---
Next screw the to the servo motor and insert it to the slot in the base.
The cable of the servo motor should pass through the small hole in the side of the base.
Next insert the other parts to the base with the follow order.
---
Finally press the top part against the base until everything is secured.
---
Parts description
2.1 Socket system with clips
The parts can attached to the robot using a special socket system with clips. For some of the parts required two circular socket space. Part file
2.2 Base
Every robot start with a main base (body). You can choose between two available bases. The difference is the height of the bases. For new users suggested the taller one because is more easy to keep in track the wiring inside the robot. Part file
---
The cover for both of the bases is the same and offers extra space for expandability. The cover secured in the top of the base using special male-female sockets between the base and the cover.
---
2.3 Motor block
The motors blocks gives to robot the ability to move around to the physical world. The motor block requires two circular space on the base. That part secures in the base using special clips. Part file
2.4 Odometer block
The external odometer block can be used for distance , velocity and acceleration calculations. Requires one circular space one the base and one wheel. The wheel should be rotate freely inside the block. Part file
2.5 Odometer module
---
The odometer module can be used for distance , velocity and acceleration calculations. That module can be used for robots with two or four motors. Can be attached to a motor block using a coupler, the coupler connected to the motor shaft from inside the base. The sensor disk should be rotate freely and doesn't be blocks from other parts or wires. Part file
2.6 Free rotation wheel block
That modules just offers to the robot better contact two the ground and requires two circular socket space. Part file
---
2.7 Metal ball caster block
That modules offers to the robot better contact to the ground and requires two circular socket space. Ca be placed below the robot. Can be used in two wheels robots. Part file
2.8 Servo motor block
The servo motor block, is very handy &) for applications as a robotic arm or in cases you want rotation with precision. The socket of the servo motor block can attached to main body using a spacer ring before the clip and can attached to arm extenders directly using only the clip. Part file
2.9 Spacer ring
That part used to attach a servo motor block to the base. Part file
---
2.10 Arm extender part
The arm extender part, attached to servo motor block using a small Philips screw. The attachment point with the screw is the pivot point for the arm extender. On the other end the part has two circular space slots. On that slots can be placed only servo motor blocks or grip block. You can combine many arm extenders and servo motor blocks but should be careful for the total torque of your servo motor. Part file
2.11 Arm rotation base
The arm rotation base, connects to servo motor block using a small Philips screw. The attachment point with the screw is the pivot point for the that base. That part has two circular
space slots and in that slots can be placed only servo motor block. With that part you can achieve rotations in Z axis. Part file
---
2.12 Gripper block
The gripper block is a complex part to assembly with many pieces. That block can be attached to a arm extender part and offers to robot the ability to grips things. Part file
2.13 L shape 2 spaces extender
The L shape 2 spaces extender offers extra space to the robot. Can be placed inside on the robot (tall base) or outside. On that part can be attached ultrasonic sensor block, camera block or any other block can be fit. Attached to the base with a male to male connector and requires one circular slot space. Part file
---
2.14 L shape 4 spaces extender
The L shape 4 spaces extender offers extra space to the robot. On that part can be attached ultrasonic sensor block, camera block or any other block can be fit. Attached to the base with a male to male connector and requires one circular slot space. Part file
2.15 Male to male connector
That part can be uses to connect parts with circular slots eg. L shape extenders. Also can be used to combine multiple bases together for a match larger robot. Part file
---
2.16 Raspberry Pi
The Raspberry Pi is the brain of your robot. Requires one circular socket space. Part file
2.17 Motor driver module
The motor driver module used to control two dc motors. That part take as input from Raspberry Pi the speed and the direction for every motor. Requires one circular socket space. Part file
---
2.18 Ultrasonic sensor block
The ultrasonic sensor block can detect objects in long distance. Requires one circular socket space. Part file
2.19 IR distance sensor block
The IR distance sensor block can detect objects in short distance. Also can be used for line following robots. Requires one circular socket space. Part file
---
2.20 Screen block
A Nokia 5110 LCD screen block. Useful to print messages to the user. Requires one circular socket space. Part file
2.21 Mini breadboard block
A mini breadboard block for experimentation with electronics. Requires one circular socket space. Part file
---
2.22 Micro breadboard block
A micro breadboard block for experimentation with electronics. Requires one circular socket space. Part file
2.23 Camera block
That block contains the original Raspberry Pi camera and can attached to any one space circular socket. Part file
2.24 Power block
The power block can handle input voltages 9-36V and can output 5v using USB port and terminal output . Part file
---
2.25 Multi connector module
That part used to multiply the the power and ground output of the Raspberry PI, also can be used to connect multiple l2C sensors. Part file
2.26 Battery Pack
Is a custom build battery pack with 3 Li-ion 18650 batteries. The BMS circuit on the pack can charge and discharge the batteries with safety. The output voltage is 12V and input voltage for charging is 12.3V. You can place the battery pack inside the robot base.
---
2.27 Battery block
You can attach the battery pack outside of the robot using the battery block. Part file
---
Parts list
Follows a list with all the electronics parts with links from Amazon and Bangood.
Part Code 1. HC-020K 2. HC-SRO4
Description
Double Speed Measuring Module with Photoelectric Encoders
Ranging Detector Ultrasonic Distance Sensor
---
20.
21.
22.
23.
24.
25.
26.
27.
Part Code
L298n
3S-BMS
TOWERPRO S$G5010
SG90 micro servo
MPU6050
Description
Infrared Obstacle Avoidance Sensor *3 pieces
5V/3.3V 8 Channel Logic Level Converter Bi-Directional Module
DC Gearbox Motor with wheels Dual H Bridge Motor Driver
A40pcs 20cm Female to Female Jumper Cable
AOpcs 20cm Male To Male Jumper Cable
A40pcs 20cm Male To Female Jumper Cable
12V 10A 18650 BMS Charger Module Lithium Battery Charging Board with Protection
18650 3.6V Li-ion Rechargeable Battery 18650 Battery Holder, 3-Slot
5110 LCD Module White Backlight
Servo motor large TOWERPRO SG5010
Servo motor small SG90 micro servo
15mm Metal Ball Caster
Gyroscope/ Accelerometer MPU6050 Push button
Noise sensor
Raspberry Pi 3 B+
Buck Converter Module, 9-36V Step Down to USB 5V
LED set
Resistors set
Mini breadboard Micro breadboard Raspberry Pi camera
Male pins
Amazon
Link 1
c. Ss Ls
Cc. iS i
c. Ss Ls
c. S —
r iS i
c. S —
c. S —
r iS i
Cc. iS i
c. Ss Ls
Cc. iS
c. Ss Ls
c. S
r iS i
Cc. iS
c. Ss Ls
c. S
r iS i
Cc. iS
c. Ss Ls
c. S
r iS i
Cc. iS
Bangood
_ =]
~ IND
i =)
~ INO
Cc =
~ INO
i i
~ IND
i =)
~ INO
Cc =
~ INO
i i
~ IND
_ =]
~ IND
i =)
~ INO
Cc =
~ INO
i i
~ IND
_ =]
~ IND
i =)
~ INO
Cc =
~ INO
i i
~ IND
---
---
Robot assembly
4.0 Electronics wiring
For every robot you choose the way to connect the electronic parts to Raspberry PI, power supply and the motor driver is the same. Following schematics for the wiring of the parts. Please give extra attention specially to the connection with the power supply.
This is a pinout presentation of the Raspberry Pi GPIO pins. On the code use the GPIO number of the pin. Suggested to connect the sensors to same pin with the picture bellow because some of the classes by default uses that pin and don't need further configuration.
SDA,SCL =Accelerometer GIN=General Input ENA,In1,In2,ENB,In3,In4=Motor driver circuit GOUT=General output ODOR=Odometer sensor right ODOL=Odometer sensor left OBSR=IR obstacle sensor right OBSL= IR obstacle sensor left ECHO,TRIG=Ultrasonic sensor RESET,CE,DC,DIN,CLK=Nokia 5110 screen
---
Pi 3 B+
3.3V GPIO02 GPIO03 GPIO04 GND GPIO17 GP1O27 GPIO22 3.3V GPIO10 GPIO09 GPIO11 GND
SCL GIN
ENA In1 In2
ENB In3 In4
GOUT GPIO05 ODOR GPIO06 ODOL GPIO13 OBSR GPIO19 OBSL GPIO26 GND
5v
5v
GND
GPIO14 ECHO GPIO15 TRIG GPIO18 BTN GND
GPIO23 _* GPIO24 * GND
GPIO25 * GPIOO8 * GPIOO7 RESET
GND GPI0O12 CE GND GPIO16 DC GP1I020 DIN GPIO21 CLK
* Free to use
ETHERNET PORT AND USB PORTS DOWN
Follow the schematics for motor driver circuit and the power supply wiring to the Raspberry Pi.
---
L298N
MOTORA Dual H Bridge
MOTOR B
Raspberry Pi pins
12V INPUT USB TO RASPBERRY PI Step down Circuit
@ GND GND @
o oe) ©Y OUTPUT
For the robot should be used a bi-directional logic level converter because most of the electronic parts designed to working with 5V and the Raspberry Pi working with 3V. If you have electronic parts with working voltages on 3V and 5V you can connect them directly to Raspberry Pi but you should power them from a 3V pin.
5V SIDE 3V SIDE 5v 3.3V GND GND DIGITAL OUT GPIOxx OBSL 8 Channel Bi-directional Logic Level Raspberry Pi pins
Electronic parts pins Converter
Schematic for the correct way to connect the 5V electronic parts.
5V electronic part
GND DOUT 5V
5V Raspberry Pi pins
GND
---
Led connection with 100 ohm resistor
GND
GPIOxx
Button connection
GND
GPIOxx
MPU6050 connection
MPU6050
VCC SCL SDAGND
3V SDA GPIO02 SCL GPIO03
---
To configure the sensitivity of a digital sensor. For now the proteas_lib supports only digital sensors, but most of the suggested sensors on Part list have a potentiometer. With the Potentiometer you can configure the sensitivity of the sensor using a small screw driver.
4.1 Two wheels robot
This is a two wheel robot with metal ball caster block. That robot is capable to avoid obstacles, follow line in the floor, computer vision capabilities and measure distance with the inside odometer.
4.2 Four wheels robots
This is a four wheel robot with two external odometers and robotic arm. That robot is capable to avoid obstacles, follow line in the floor, computer vision capabilities, measure distance with the inside odometer and catch light weight things.
---
This is a four wheel robot with four motors. That robot is capable to avoid obstacles and have larger torque.
4.3 Robotic arm
A experimental part. Is a useful robotic arm with capability to catch light weight things, can be combined with the inverse kinematics class.
---
4.4 A why not robot (not tested)
A cute four leg robot have for robotic arms on legs arrangement.
Not tested yet.
---
Classes description
5.0 Library initiation and exit
Use to import the classes for the electronic parts control. from proteas_lib import control
Use to import the classes for the computer vision applications. from proteas_lib import vision
Initiates the control library, Should be used every time after the import of the control library. control.start_lib()
Clean up the GPIO pin parameters, should me used every time in the end of the program.
control.cleanQ)
5.1 motor()
That class used to control dc motor with PWM.
motor_a = control.motor(speed_pin,terma_pin,termb_pin) # User selected pins default frequency 10000 Hz and DC 70%
#or
motor_a = control.motor(speed_pin, terma_pin, termb_pin, freq=10000,dc=70) # User selected pins, frequency and DC
#functions
motor_a.move() # The motor moves forward by default
#or
motor_a.move(direction="reverse") # User selected direction "forward"/"reverse" motor_a.stop() # Stops the rotation of the motor
motor_a.set_speed(speed=50) # Change the motor default speed 0-100% motor_a.control_speed(speed=90) # Change dynamically the motor speed 0-100%
5.2 odometer()
That class used to take measurements from odometer sensors.
---
odometer_1 pin #or odometer_1 sensor disc
control.odometer(pin) # Deafult 20 lines sensor disc,yser selected
control .odometer (pin, sensor_disc=20) # User selected lines for
#functions
odometer_1.get_state() # Returns realtime the state of the sensor, 0/1 or True/False
odometer_1.get_steps() # Return the number of the steps(sensor disc activations) odometer_1.get_revolutions() # Return the number of the revolutions of the wheel odometer_1.get_distance(wheel_diameter=6.6,precision = 2)# Returns the distance traveled the robot in cm with default wheel diameter 6.6 cm and precision 2 for the value of the disatnce
odometer_l.resetQ) # Reset the revolutions counter
5.3 ultrasonic_sensor() That class used to measure distance using a ultrasonic sensor.
ultra_l = control.ultrasonic_sensor() # Default echo pin 14 and trigger pin 15 #or ultra_1 pins #functions
ultra_l.get_distance() # Return distance in cm
control .ultrasonic_sensor(echo_pin=14,trig_pin=15) # User selected
5.4 button()
That class used for buttons with software pull up activated.
button_1() #or button_1() = control.button(pin = 18) # User selected pin
#functions
button_1.get_state() #Return the state of the pin, 0/1 or True/False
control.button() # Default pin 18
5.5 gen_input()
That class used for input eg. noise sensor, digital light sensor or every electronic circuit with digital output. Also you can use that class for the IR obstacle sensors.
noise_1 = control.gen_input() # Default pin 4
#or
noise_1 = control.gen_input(pin=4) # User selected pin
#functions
noise_1.get_state() #Return the state of the pin, 0/1 or True/False
5.6 gen_output()
---
That class used for output eg. led (with proper resistor 330 ohms), relay shield or every electronic circuit with digital input.
led_1 #or
control.gen_output() # Default pin 5 led_1 = control.gen_output(pin=5) # User selected pin #functions
led_1.set_on() #Power on the pin led_1.set_off() #Power off the pin
5.7 accelerometer() That class used to receive measurements of acceleration and gyro from the MPU6050 sensor .
mpu #or
control.accelerometer() # Deafault address 0x68
mpu = control.accelerometer(address=0x68) # User selected address #functions
mpu.get_acceleration() # By default return 3 values x,y,z
#or
mpu.get_acceleration(dimension = "all") # User select "all","x","y","z
mpu.get_gyro() # By default return 3 values x,y,z #or
mpu.get_gyro(dimension = "all") # User select "all","x","y","z
5.8 servo() That class used to control servo motor.
servo_l = control.servo(pin=24) # User selected pin #functions servo_1.set_angle(angle=25) # User selected andgle in degrees
5.9 screen() That class used for Nokia 5110 screen control.
main_screen = control.screen() # Default pins SCLK = 21,DIN = 20,DC = 16,RST a7 ,CS = 12
#or
main_screen = control.screen(SCLK = 21,DIN = 20,DC selected pins
#functions
16,RST =7,CS = 12) # User
main_screen.ip_screen() # Print on the screen the ip of the robot main_screen.print_text(text_list) # Take as input a list of 5 strings eg. text_list=['one','two',..,'five'] and prints every element of the list in a row. The row selected with the index number of the element.
5.10 arm_2dof()
---
A inverse kinematics class to control the the vertical join of the robotic arm.
arm_control = control .arm_2dof(al=100,a2=100) # Default lenght for every part of the arm
#functions
arm_control.calculate_angle(x,y) #Takes as input the desired destination for the arm and return the angles for the joins
5.11 PID()
A PID controller class. Offers high precision control in many components. Before use PID please make a research about the usage and the parameters.
motor_pid = PID(KP=0,KI=0,KD=0)# By default PID is deactivated
# functions
motor_pid.pid_calc(desired_value,actual_value,start_time,end_time) #Return the value for the component
motor_pid.update_pid(KP,KI,KD) # Upates the parameters and reset the PID mesurments
motor_pid.reset_pid() # Reset the PID mesurments
5.12 data_logger() That class used to store multiple measurements.
speed_data = control.data_logger()
#functions
speed_data.store_value(y,x) #Store eg. speed and time
speed_data.get_size() #Return how many rows of data collected speed_data.draw_graph(type = "line")# Draws a graph from the collected data. Default parameter "line" for line graph or "points" for points graph speed_data.clean_data() #Remove all the recorded measurements speed_data.save_image(output="figure.png") #Saves the graph as png speed_data.save_pdf(output="figure.pdf") #Saves the graph as pdf
5.13 timer()
A timer class.
timerl = control.timer()
#functions
timerl.start_timer() # Use it to start the time or reset the timer timerl.elapsed() # Print the elasped time
timer1.get_elapsed() # Return the elasped time
5.14 aruco_find()
That class used to detect aruco artifacts in 6X6 size. That artifacts is special images and looks like with QR-code. The robot easy detect that images using the camera in any angle and light condition. Every artifact has a unique number.
---
aruco = vision.aruco_find() aruco.detect_artifacts (image) aruco. find(ar_id)
final = aruco.mark_frame(frame)
aruco.get_pos() aruco.get_rect()
1,
Pali
ne
reed Be]
4 id Al mA at at
RADARS BERS
---
5.15 camera() That class used initialize the camera and can return images from it.
cam_1 = vision.camera(camera=0)# User selected camera
#functions
frame = cam_l.take_frame() # Return a captured image
cam_l.stop() # Releases the camera, use it in the end of your code
5.16 show_image() That class creates a image preview window or canvas.
canvas = vision.show_image(jupyter=True) # Default parameter for Jupyter slow frame rate. If you use directly on python script set false the parameter and a Opencv image windows would be appear.
#functions
canvas.preview(frame) # Take as input a image
canvas.clear() # Use it only for direct usage of the class from a script
5.17 face_detection() That class can detect faces on a image.
face = vision. face_detection()
#functions
frame = face.detect_face(frame) # Detect the position of the faces on image, can return an image with the faces marked
face.get_faces() # Return the number of the on the image
face.get_pos() # Return the position of the face on the image
face.get_rect() #Return the size of the face
5.18 robot_center()
That class used to return direction to the robot about the center of the target eg. face
dog_1 = vision.robot_follow() #Default frame size width=640
#functions
dog_1.direction(rx) # Take as input the x position from a get_pos() function and return directions 2 for Go Right, 1 for Go Left,-1 for No detection and 0 for Stay
5.19 robot_follow()
That class used to return direction to the robot about the distance from the target eg. face
dog_1 = vision.robot_follow() #Default frame size width=640
#functions
dog_1.direction(rx) # Take as input the x size from a get_rect() function and return directions 1 for Forward, 2 for Back,-1 for No detection and 0 for Stay
---
5.20 line_follower() That class uses the camera to track a black line on the floor.
line_follow = vision.line_follower() # Dedault parameters
width=640, height=480,w=160,h=60 image width,heigh and area of detection on the center of the image
#functions
line_follow.detect_line(frame)# Take as input a image detects and marks the line and return a new image with the line marked
line_follow.get_pos() # Return the center of the line in the image
5.21 buzzer()
That class used to control a buzzer with PWM.
buz_1 = control.buzzer(pin=25) # User selected pin with default frequency 1500Hz and Dc 50%
#or
buz_1 = control.buzzer(pin=25, freq=1500,dc=50) # User selected pin, frequency and DC
#functions
buz_1.beep() # Short tone
buz_1.timer(count=10) # User selected time to delay with one short tone per second
5.22 make _csv()
That function used to save the measurements from the data_logger() class to csv.
control .make_csv(data_list, fi lename="data.csv"
5.23 get_ip() That function returns the ip address of Wi-Fi network.
control .get_ip
---
Robot usage
6.0 Preparation
Step 1 Download the Proteas Rasbian image. Step 2
Follow the the instruction from the official Raspberry Pi page Instructions using the downloaded image from the previous step and burn the image file to 16GB micro-sd card.
Step 3
Insert the micro-sd card in the Raspberry Pi and power it up.
6.1 Access to the robot
Step 1 Scan your for a WIFI network with SSID"Proteas". The key for the network is "gsoc2019proteas" Step 2
Open the browser and type the address 192.168.4.1:8080
Step 3 From here you can choose one of the following options:
e Connect to Jupyter e Handbook
e Settings
e Project Informations
Proteas Robot
ect to Jupyter Notebook to
new project! The defeult password instructions forthe robot Restart or Shutdown ° .
— I
Jupyter
—
Project informations ro ithub page bot forthe project.
---
6.2 Jupyter usage
From the main menu select Jupyter. In the password prompt insert the password "proteas".From here you can create new Jupyter Python 3 Notebooks or you can edit the available notebooks. The available notebooks covers the basic usage of the robot. Also here you can find and ready for class notebooks with experiments in physics, mathematics, and robotics. For more information's about Jupyter please visit the official Jupyter website also search in YouTube for tutorials on Jupyter.
S jupyter uit | | Logout
Files Running Clusters,
Select items to perform actions on them. Upload | New~ [2 Jo ~ mI Namew Last Modified File size } © Courses 6 pépes mp } © Examples 9 uépec Tro c Jupyter Basic robot movement Last Checkpoint: 12/08/2019 (autosaved) & Logout File Edit View insert Cell © Kemel Widgets Help rusted Python 3 O
B + & SH & + WRun BC PM Maxson + &
First we need to import the proteas_lip and tell to Proteas where the motors are connected.
tSlider (value: tSlider (value:
display (ml,m2)
Speed A 50
Speed B 50
Its time to add and some contols for the directions of the motors,
d = widgets. RadioBut’ = widgets. RadioBut display (mld, m2d)
Direction A: @ forward
Direction B: @ forward
Finally we need one more slider to control the total time of the movement
total_t = widgets. intSlider(value=1,min=0,max=60, step=1,description='Totel time:') display (total_t)
Total time: 1
6.3 Documentation
From the main menu select Documentation. Here you can find a pdf with all the instructions of the robot ( Offline copy of the wiki page).
6.4 Settings
You can reboot or shutdown the robot. In future more setting will be added.
---
6.5 Jupyter Courses and Examples
In the main page of the Jupyter Notebook you can find Courses and Examples.
‘jupyter Acceleration and Velocity experiment Last Checkpoint: 13/08/2019 (autosaved) @ Logout Filo Edit View insert Cell Kemel — Widgets. Help Kernel starting, please wait. Trusted | Python 3 @
Blt x & B® &) WRU MC OD Markdown +) @
Acceleration and Velocity experiment
1.0 Theory
1.1 Velocity
The velocity of an object is the rate of change of its position with respect to a frame of reference, and isa function of time. Velocity is equivalent to a specification of an object's speed and direction of motion (¢.g. 60 knvh to the north). Velocity is a fundamental concept in kinematics, the branch of classical mechanics that describes the motion of bodies.
Velocity is a physical vector quantity; both magnitude and direction are needed to define it. The scalar absolute value (magnitude) of velocity is called speed, being a coherent derived unit whose quantity is measured in the SI (metric system) as metres per second (m/s) or as the SI base unit of (m-s-1). For example,
"5 metres per second" is a scalar, whereas "5 metres per second east" is a vector. Ifthere is 2 change in speed, direction or both, then the object has a changing ‘velocity and is said to be undergoing an acceleration.
Average velocity
Velocity is defined as the rate of change of position with respect to time, which may also be referred to as the instantaneous velocity to emphasize the distinction from the average velocity. In some applications the "average velocity” of an object might be needed, that is to say, the constant velocity that would provide the ‘same resultant displacement as a variable velocity in the same time interval, v(t), over some time period At. Average velocity can be calculated as:
Av
At®
---
c Jupyter Acceleration and Velocity experiment Last Checkpoint: 13/08/2019 (autosaved)
File Edit
B + x & B® & Run BC» Markdown
In [1]:
View Insert. Cell ~— Kernel_-~— Widgets.
2.0 Experiment
Help
Trusted
Be [se
| Python 3 O
Now it's time to use the Proteas robot to help us on the experiment. We want to make Proteas to move forward a short distance of 10cm and take mesurments:
using the odometer. After the mesurments we want Proteas to draw two graphs, one with the average velocity and one with the average accelation.
from proteas_lib import control control.start_1ib() velocity logs = control.data_loggez()
acceleration_logs = control.data_loager()
timerl = control.timer()
notor_a = control.motor(17,27,22) notor_b = control.motor(10,11,9) odometer_a = control.odometer (6)
print ("Experiment start!") velocity_logs.clean_data() acceleration_logs.clean_data() timerl.start_timer() edometer_a.reset()
motor_a.move()
notor_b.move ()
previous_distance = 0
previous _v = 0
previous t = 0 velocity logs. store_value (0,0) acceleration_logs.store_value (0,0) while odometer_a.get_distance() < 10:
current_distance = odometer_a.get_distance()
current_t = timerl.get_elapsed() # We
dt = curreat_t - previous t
dx = (current_distance - previous_distance)*0.01 # Convert
v = dx/dt dv =v - previous _v a= dv/dt
velocity logs. store_value(current_t,v) acceleration_logs.store_value(current_t,a)
previous v= v previous distance = current_di:
nce
the
ill store the data on every distance displacement because the sensor fon odometer is very slow for continuous readings if previous_distance != current_distance:
cm tom
---
Expert users
7.1 ssh access The ssh interface is pre-activated on port 22. The username is "pi" and the password is "robot". 7.2 vnc access The vnc server is pre-activated on port 5901. The username is "pi" and the password is "robot".
7.3 samba access
The samba server is pre-activated. You can access to full filesystem of the robot with the ip or "\\proteas_share". The username is "pi" and the password is "robot".
7.4 Jupyter
The Jupyter auto start and use the directory /home/pi/proteas/ . The password is "proteas". Default port 8888
7.5 Node.js
Also a Node.js app auto start, That app offers a control panel for reboot /shutdown , access to a offline user manual and access to Jupyter. Default port 8080
7.6 Wireless access point If you want to modify the access point name or password use ssh to connect to the robot.
sudo nano /etc/hostapd/hostapd. conf
ssid=Proteas wpa_passphrase=proteasgsoc2019
7.7 Manually installation
You can install the robot library to any Raspberry Pi using PYPI but before that you need some extra work. Also for the face detection you should make directory on /home/pi/ext and place inside the haarcascade_frontalface_default.xml file.
python3 -m pip install proteas_lib
Required
1. OpenCV 4.0 with contributors. To install the OpenCV suggested the tutorial from Pyimagesearch but skip the steps for the Python virtual environment.
---
2. Manually installation the library for the the Nokia 5110 screen. Suggested the instructions from Ardafruit.
Not required
1. Jupyter installation for Python 3.
2. Set the Raspberry Pi to work as a wireless access point. Suggested the instructions from Raspberrypi.org.
3. Node.js with pm2 for auto start the app.
7.8 New parts
You can build new parts and to contribute to the project, using that templates.