Skip to content

Latest commit

 

History

History
84 lines (60 loc) · 2.71 KB

README.md

File metadata and controls

84 lines (60 loc) · 2.71 KB

Arm control with OpenCv,Mediapipe and Firebase

It is the robot arm control project of our Computer Vision works with Opencv. In this project, a Firebase-based robot project was realized by using Opencv and Mediapipe artificial intelligence libraries. Below I tried to explain the details of the project step by step.

Arm control with OpenCv,Mediapipe and Firebase

First, we will download the libraries we will use.

import mediapipe as mp
import cv2
import numpy as np
import pyrebase
import time

The code block we linked to Firebase

# içerikler - contants
ml = 150
max_x, max_y = 300 + ml, 50
curr_tool = "Arac Sec"
time_init = True
rad = 40
var_inits = False
thick = 2
prevx, prevy = 0, 0

firebaseConfig = {
  "apiKey": "AIzaSyB_S2tR_2YsRrM-KQUHsS_Uj_q1kmGBetM",
  "authDomain": "armrobot-98491.firebaseapp.com",
  "databaseURL": "https://armrobot-98491-default-rtdb.firebaseio.com/",
  "projectId": "armrobot-98491",
  "storageBucket": "armrobot-98491.appspot.com",
  "messagingSenderId": "755214414021",
  "appId": "1:755214414021:web:8807c50e5d8b4c22bec0ac",
  "measurementId": "G-YMMDCZZQ68"
};

firebase = pyrebase.initialize_app(firebaseConfig)

db = firebase.database()
size = 4

After registering Firebase from Google, create your project file and paste the drawn part in our code.

image

NOTE

The code block I have shown below will not be in firebase. Don't forget to add it. Don't forget to add it to the code block by typing its own link in your Firebase account where I have shown in the picture.

"databaseURL": "https://armrobot-98491-default-rtdb.firebaseio.com/",

image

NOTE2

Also, do not forget to name users2 and string as a variable for the firebase base you will create.

image

NOTE3

Do not forget to apply the changes you will make on the Firebase base in the raspberrypi_code part.

Raspberrypi_code.py file should be run inside Raspberry Pi development board. The other main.py should be run on computer.

Raspberry pi connection pins of robotic arm

GPIO.setup(11, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(40, GPIO.OUT)
GPIO.setup(15, GPIO.OUT)

image

Wiring of the servo motors of the robotic arm on the breadboard

image