Project 6: Intro to GoPiGo

Documentation (description, images, video, code, etc) due to website by Wed (3/7) at 9pm.

Click here for the full project description.

** Be sure to follow THIS HELP TUTORIAL on updating the GoPiGo software to make the web IDE accessible.



Intro to GoPiGo

Introduction to GoPiGo:

By Matt, Martin and Omar

This week we were finally introduced to the new robot kits that we would be using for the rest of the semester. This week the focus was to simply get to play around with the new kits and become comfortable with the new commands that are available now.

Challenge 1: Default GoGoPi Functionality

With this part of the challenge, all we had to do was use simple Python code to play around with the LEDs by turning them on and off, as well as running the motors available. For this we simply built a car with the new kits.

Our code is very simple. The car will run. While running, the on board LEDs also known as the 'eyes' will light up. After it stops, and ends the program, the LED will turn off. We did not use the motors in the actual raspberry kit, but instead used the servo motors to power the wheels.

This is our code:

Image

Challenge 2: Additional Inputs and Outputs

For the second challenge, the main goal was to develop a system of inputs using sensors that would then read out to a source of output.  This is very similar to the first project of making sure that the car would not hit the wall as it reached it.

This is our code for Challenge 2:

Image

Gallery of Robot Vehicle:

Image Image Image Image

Mar 7 2018 Read →

Introduction to GoPiGo

Shunta Muto
Osvaldo Calzada

Robot construction

Using GoPiGo and Raspberry Pi, we built a circuit that blinks LED and runs the motor for Challenge 1. For Challenge 2, we plugged in button sensor to run the motor when the button is pressed.

Image

Challenge 1

Simple circuit with 220 ohm resistor and LED was built on breadboard. The I/O pin (GPIO 17) and ground pin from GoPiGo were connected to each respective pins on the breadboard. The code makes the LED blink 5 times.

To run the motor, we connected GoPiGo motor to the motor pins on the board.

Image Image

Challenge 2

With GoPiGo motor still connected from Challenge 1, we also connected the button sensor onto analog/digital pin 1. Using the code snippet provided on the IDE, we wrote a code that runs the motor when the button is pressed.

Image

Mar 7 2018 Read →

Introduction to GoPiGo

This project utilized the Dexter Industries GoPiGo base set, a Raspberry Pi 3B, Grove Sensors, and Servo motors - both standard and continuous. The main objective was to gain familiarity with the GoPiGo Raspberry Pi robotic platform through the completion of two challenges and the bonus challenge.

Image

Challenge 1:

To accomplish the challenge of blinking external LEDs and running the GoPiGo motors, we looked at example code stored on the IDE. We found two files (blink_led.py and motor.py) that contained the exact code we needed to accomplish these tasks. In order to make the hardware work properly with the code, we researched GPIO pin numbering. This allowed us to successfully connect the LEDs positive lead to GPIO 17 and its negative lead to ground. The code then instructs the GoPiGo sytem to "open its eyes", run the motors, "close its eyes", and blink the external LED five times. Refer to the code and video below.

#!/usr/bin/python3 import RPi.GPIO as GPIO
import time def main(): print('Test') # Initialize GoPiGo3 object gpg = Device('this') # Run motor and open eyes gpg.open_eyes() gpg.forward() sleep(2) # Stop motor and close eyes gpg.stop() gpg.close_eyes() print("Done") LED_BCM_PIN = 17 #setup output GPIO.setmode(GPIO.BCM) GPIO.setup(LED_BCM_PIN,GPIO.OUT) #Initialize to Off GPIO.output(LED_BCM_PIN,GPIO.LOW) for i in range(5): #Turn on LED GPIO.output(LED_BCM_PIN,GPIO.HIGH) print("LED on") sleep(.1) #Turn off LED GPIO.output(LED_BCM_PIN,GPIO.LOW) print("LED off") sleep(.1) # Clean up pins that were used in this program GPIO.cleanup() print("done") if __name__ == '__main__': main()

Challenge 2:

This challenge tasked us with connecting Grove Sensors and Servo motors to the system. We decided to make a robot whose motors oscillate 180 degrees when a button is pressed, but stops when the button is not pressed. We were able to find example code for the use of the Grove Sensor pushbutton. It contained an if statement whose output was dependent on the pushbutton's state. We also found example code for running the Servo motors through the GoPiGo system. Our final Challenge 2 code combines these two examples by having the oscillation instructions for the Servo placed within the true condition of the if statement. Refer below for the code and video of the robot.

#!/usr/bin/python3
def main(): # Initialize objects gpg = Device("this") button = gpg.init_button_sensor("AD2") angle_servo = gpg.init_servo("SERVO1") cont_servo = gpg.init_servo("SERVO2") angle = 0 while True: if button.is_button_pressed(): # Switch between extreme values if angle == 0: cont_servo.rotate_servo(0) angle = 180 else: cont_servo.rotate_servo(180) angle = 0 angle_servo.rotate_servo(angle) sleep(1) else: cont_servo.rotate_servo(90) angle_servo.rotate_servo(90) print("Done") if __name__ == '__main__': main()

BonusChallenge:

This challenge involves interaction between the GoPiGo Raspberry Pi and LEGO MINDSTORM EV3 systems, conveniently an integral part of our term project. We started this challenge by achieving physical interaction. Specifically, this meant lighting an LED with the GoPiGo and reading the light intensity with the LEGO color sensor. When the light intensity is read as greater than 4, a large motor is driven by the EV3. Otherwise, the motor does not move. Therefore, the motion of the motor can be controlled by whether or not the sensor is held close to the LED. See code and video below.

#!/usr/bin/python3 def main(): ev3 = Device('this') color_sensor=ev3.ColorSensor('in1') color_sensor.mode = 'COL-REFLECT' motor = ev3.LargeMotor('outA') while True: rcolor = color_sensor.reflected_light_intensity if rcolor>4: motor.run_forever(speed_sp=200) else: motor.stop(stop_action="hold")
if __name__ == '__main__': main()

Additionally, we were able to connect the devices virtually using the "Device" command. This required wireless communication between the two platforms. Our goal was to run code on the GoPiGo system that, based on the state of a pushbutton, instructs the EV3 to either move or stop a motor. This accomplishes the same task as the above without requiring any physical interaction between the devices. One issue with this method is that it adds a small amount of delay between the input and output, likely due to a slow network. See code and video below.

#!/usr/bin/python3 def main(): gpg = Device("this") button = gpg.init_button_sensor("AD2") ev3 = Device('172.16.216.92') motor = ev3.LargeMotor('outA') while True: if button.is_button_pressed(): motor.run_forever(speed_sp=200) else: motor.stop(stop_action="hold") if __name__ == '__main__': main()

Mar 6 2018 Read →

Challenge 1

The purpose of Challenge 1 was to demonstrate that we are able to perform some basic functionalities with the new technology, GoPiGo.  In our demonstration of the lights, the eyes of GPG blink three times then the front LEDs alternate between right and left for one second each.  The left LED is slightly hidden by the hardware attached to our car.  In terms of the motors, the car demonstrates forward motion by running both motors at the same speed as well as showing control of individual motors.  The code for Challenge 1 can be found below.

Challenge 2

The purpose of Challenge 2 was to demonstrate the usage of a sensor and create a response using an actuator.  We decided to demonstrate proportional control using the GoPiGo in a similar manor to Project 1 earlier in the semester.  The ultrasonic sensor was used to detect the wall and slow down as the car got closer to the wall and stop when it was at the desired distance, in this case any distance in between 13.8 to 14.2 cm from the wall. Anything closer than this and the car will back up. The difference in motor powers in the code is due to the fact that our car naturally drifts to the right. The inclusion of the 2.032 in the first if statement line is due to the fact that the sensor would sometimes read this distance when very far away from the wall (this is presumably some sensor error), so we added the value to the code to allow for smooth motion

Code

Challenge 1

Image

Challenge 2

Image

Mar 6 2018 Read →

Description

Challenge 1

The GoPiGo functionality behaved just as expected. We were able to make the blue "eye" LEDs and the two red LEDs at the top of the Raspberry Pi blink on and off on command, and we were able to make the two motors run on command as well.

Challenge 2

We connected a light sensor to the front of the GoPiGo cart (which we outfitted with a solid base and made to look like an actual car) and replaced the Dexter motors with the servo motors contained in the ME84 toolbox. We successfully were able to dispplay a connection between the light sensor and the motors. When the sensor picked up light, the car would move backwards. When the sensor did not pick up light, the car would move in a circle.

Pictures

Challenge 1

Image

GoPiGo assembly

Image

Motors connected to GoPiGo

Challenge 2

Image

Car assemly

Image

Close up of GoPiGo connected to plastic base

Image

Light Sensor

Image

Close up of wheels connected to plastic base using x-beams

Videos

Challenge 1

Challenge 2

Code

Challenge 1

Image

Challenge 2

Image

Mar 6 2018 Read →

Mar 5 2018 Read →

Project 6

Overview: The goal of this project was to gain a familiarity with the new kits and using the GoPiGo, kits, and sensors. Our group was successful in this project, through both creating the robot base and controlling a continuous servo with a ultrasonic sensor.

Challenge 1 Video:

Challenge 2 Video:

Construction: The main body of the robot was constructed to match base layer used in the GoPiGo3 kit, which allowed for maximum adaptability for future projects as well as a simple design to work with for the challenges in this project. A ultrasonic sensor and continuous servo were mounted on the front of the robot to be used to create a simple sensing setup. While building the robot, one of the continuous servos appears to not be working.

Robot Top Views:

Image Image

Robot Front Views:

Image Image

Challenge One:

This program was designed to turn on the  eyes of the Gopigobot, flash the left and right LED lights at the back of the Pi and activate the motors, driving forward then adjusting the individual speeds to accomplish a turn. The Eyes are illuminated for the full duration of the code being active.

Challenge Two:

We were successful in combining a sensor and an actuator by controlling a continuous servo with an ultrasonic sensor. The code runs so that if an object gets within a certain range (6 inches, arbitrarily) of the sensor, this would spin the servo until the object was moved out of that range, and then the servo would stop.

Challenge 1 Code:

Image

Challenge 2 Code:

Image

Mar 4 2018 Read →

Project 6: Andrew, Annalisa, James, Sahana

Description:

Challenge 1: Turning on and off an LED: We used blink_LED.py and the circuit shown in the photo below. The tutorial found at this link: https://thepihut.com/blogs/raspberry-pi-tutorials/27968772-turning-on-an-led-with-your-raspberry-pis-gpio-pins helped us figure out how to set up the circuit and which ports to plug the voltage and ground into.

Challenge 2: We used motor.py and modified it to run when the button was pressed. A simple if statement was added. (See code and video)

Code:

blink_led.py

button.py

motor.py

Mar 4 2018 Read →

For our first demonstration of the Raspberry Pi along with the GoPiGo board, we built a few example setups. To begin with, the Raspberry Pi board needed to be setup by updating the firmware and attaching it to the GoPiGo board. Once that setup was complete the motors were attached to the board and mounted with wheels. The first demonstration piece of code, shown below and demonstrated in the video, controls the wheels and LEDs on the robot. First, the LEDs which make up the GoPiGo's eyes illuminate for two seconds. Next, the eyes shut and the right motor begins to spin while the right red LED turns on. The motor stops spinning when the LED turns off, and then the left motor and LED receive turn on. After another two seconds, the code prints "Done" and the program completes.

Image

To further demonstrate our control of the robot, we next attached more sensors that we could manipulate. We connected a pushbutton to the Analog/Digital 2 pin, and programmed this button to enable or disable the motors. The photoresistor was then wired to the Analog/Digital 1 pin and the output of the sensor used to proportionately actuate both motors. The two wheels spin faster when the sensor is exposed to light, and they slow down as the photoresistor is covered. The motor speeds are printed by the code, which is shown below. Demonstration of this operation is also shown in the video below.

Image

Mar 4 2018 Read →

Challenge 1:

This robot demonstrates the motors and built in LEDs of the GoPiGo3.

The LEDs light up and turn off in a sequence. Then the motors start to move. The program also has the power of each motor change to demonstrate changing the speed of the motor and turning. The LED of the eyes stay on for the whole program.

Dec 31 1969 Read →