venkyskar
Posts: 18
Joined: Mon Mar 28, 2016 10:56 am

Accelerometer Controlled Robot

Mon Mar 28, 2016 11:08 am

Hi guys i am a newbie to python programming i am building a accelerometer controlled robot using Raspberry pi i have this following program please help me with the changes in the program and i need a quick reply i have to submit my project in my college so please help........................ :roll: :shock:
following is the link of a selfbalance robot i used this for interfacing of MPU6050 and DC motors now i want to change the program according to my application

http://www.instructables.com/id/Buildin ... /?ALLSTEPS

mattmiller
Posts: 2247
Joined: Thu Feb 05, 2015 11:25 pm

Re: Accelerometer Controlled Robot

Mon Mar 28, 2016 2:22 pm

How far have you got so far?

People don't mind helping someone out but usually we are not keen to do someone's whole college project for them.

If you have specfic questions then ask them :)

Matthew

venkyskar
Posts: 18
Joined: Mon Mar 28, 2016 10:56 am

Re: Accelerometer Controlled Robot

Mon Mar 28, 2016 2:42 pm

i have built the bot interfaced all the components i can understand the college part but presently i want to knw the changes in the main program to b done if you follow the link go for the post mysegway.c its the main program please tell me the changes to be done in that so that i get the functionality as :
if the accelerometer is bent forward it should go frwd
if the accelerometer is bent backward it should come backward and so on..

venkyskar
Posts: 18
Joined: Mon Mar 28, 2016 10:56 am

Re: Accelerometer Controlled Robot

Mon Mar 28, 2016 2:48 pm

one more thing i am not new to programing but i am new to python's such type of programs
i have designed a program but i am not sure it will run i have followed the same logic of what we do if we interface accelerometer to arduino. If the program is correct then how to execute it on Rpi.


import RPi.GPIO as GPIO
import adx1345
import subprocess
GPIO.setwarnings(False)
accel = adxl345.ADXL345()
axes = accel.getAxes(True)

def setup():
GPIO.setmode(GPIO.BCM)
GPIO.setup(A1,GPIO.IN)
GPIO.setup(A2,GPIO.IN)
GPIO.setup(10,GPIO.OUT)
GPIO.setup(11,GPIO.OUT)
GPIO.setup(12,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
Serial.begin(9600)
print"start"

def loop():

while(1):
X = axes['x']
Y = axes['y']
Z = axes['z']

if X>330 and X<343 and Y>390 and Y<410:

print"forward"
GPIO.output(10,GPIO.HIGH)
GPIO.output(11,GPIO.LOW)
GPIO.output(12,GPIO.HIGH)
GPIO.output(13,GPIO.LOW)


elif X>260 and X<280 and Y>340 and Y<360:

print"left"
GPIO.output(10,GPIO.HIGH)
GPIO.output(11,GPIO.LOW)
GPIO.output(12,GPIO.LOW)
GPIO.output(13,GPIO.HIGH)

elif X>390 and X<410 and Y>340 and Y<360:

print"right"
GPIO.output(10,GPIO.LOW)
GPIO.output(11,GPIO.HIGH)
GPIO.output(12,GPIO.HIGH)
GPIO.output(13,GPIO.LOW)

elif X>335 and X<360 and Y>270 and Y<290:

print"back"
GPIO.output(10,GPIO.LOW)
GPIO.output(11,GPIO.HIGH)
GPIO.output(12,GPIO.LOW)
GPIO.output(13,GPIO.HIGH)

elif X>330 and X<350 and Y>325 and Y<355:

print"stop"
GPIO.output(10,GPIO.HIGH)
GPIO.output(11,GPIO.HIGH)
GPIO.output(12,GPIO.HIGH)
GPIO.output(13,GPIO.HIGH)

venkyskar
Posts: 18
Joined: Mon Mar 28, 2016 10:56 am

Re: Accelerometer Controlled Robot

Wed Apr 13, 2016 4:12 pm

Is there anyone here who can help me out with the movements pls

Djuka
Posts: 13
Joined: Tue Mar 24, 2015 7:48 pm

Re: Accelerometer Controlled Robot

Fri Apr 15, 2016 2:54 pm

Hello !

https://www.youtube.com/channel/UCqyYnY ... b6Ni3YLuKg

Beside this link you can find two wideo examples illustrating how to use Raspberry for
robot control, for industrial robot arms. In this case IGUS Robolink D is driven by Rasp 2.
For motion controls we used M524T stepper driver. Complete control logic, end-user
applications and visual debuuger is produce by domain-specific modeling tools,
MetaEdit Modeler (MetaCase) and DVMEx IDE (Djukic Software GmbH).

venkyskar
Posts: 18
Joined: Mon Mar 28, 2016 10:56 am

Re: Accelerometer Controlled Robot

Fri Apr 15, 2016 6:16 pm

thnx buddy but i am a newbie next point i am just developing a accelerometer controlled robot using Rpi so i think those things might not work for me

User avatar
B.Goode
Posts: 10913
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Accelerometer Controlled Robot

Fri Apr 15, 2016 8:17 pm

venkyskar wrote:If the program is correct then how to execute it on Rpi.
Since Python is an interpreted scripting language, finding out if it is correct and then executing it are done by the same command:

Code: Select all

python my_script_name_here.py

Return to “General discussion”