Using Arduino UNO & Servo Motor Developed with React Javascript
For Linux/Mac Users:
chmod +x start.sh
./start.sh
For Windows Users: IMPORTANT: MAKE SURE TO UNBLOCK THE POWERSHELL SCRIPT FROM THE FILE PROPERTIES
Powershell.exe -ExecutionPolicy RemoteSigned -File .\start.ps1
Database implementation to store latest movement and a database logger to store all movements using mysql
Storing latest movement and all movements in a database is a good way to keep track of the movements of the robot arm. Whenever there was any maintenance or bug fix, the database can be used to keep track of the changes
- Using
express
server &johnny-five
to control the robot arm johnny-five
is a library for controlling the robot arm
- Using
react
to render the UI react-speech-recognition
is a library for speech recognition
NOTE: We need Arduino UNO and Arduino IDE to achieve this
We will download Firmata and Arduino IDE and for the Arduino to run with the johnny-five
library, we need to deploy firmata
to the Arduino.
-
Open
Arduino IDE
-
Create example Sketch from Files > Examples > StandardFirmataPlus
-
Upload the sketch to the Arduino
for more troubleshooting instructions, please refer to
this
I used a Servo and Connected it to pin 8
with 5V
of Power and GND
.
Make sure you did the Important Notice
$ cd server
/server █
$ yarn
[1/4] installing dependencies...
[2/4] ...
[3/4] ...
[4/4] ...
$ yarn start
Listening on port 4000
$ cd client
/client █
$ yarn
[1/4] installing dependencies...
[2/4] ...
[3/4] ...
[4/4] ...
$ yarn start
Compiled successfully !
- Open
Visual Studio Code
or any other text editor. - Start using two terminals (
server
&client
) - Install Dependencies using
yarn
on both terminals - Plug up your Arduino you should receive the following output:
#Timestamp# #Status# #Port#
1660235534040 Available /dev/tty.usbserial-110
1660235534043 Connected /dev/tty.usbserial-110
- Start up the project using
yarn start
on the server terminal andyarn start
on the client terminal - Open
http://localhost:3000
in the browser if didn't opened automatically - Test server connection by opening
http://localhost:4000/
in the browser and receiveI am alive
response - You're good to go!
If you have a problem with node/npm/yarn, try to identify the problem and fix it.
Common Problems:
- Versioning Problems, keep everything up to date, download the latest version of Node.js LTS and Yarn
- What is
yarn
? yarn is a package manager for the JavaScript programming language. It is a tool for managing dependencies. to Downloadyarn
runnpm i -g yarn
and you're good to go. - Arduino Problems? Which problem? did you upload the Firmata sketch to the Arduino? If you did, try to upload the sketch again. If you still have problems, try to reset the Arduino. Press and hold the button for maybe 11 seconds or so. if the problem persist check the ports and make sure you have the correct Arduino connected. and to the same port as identified or for MacBook/Linux Users in the terminal, run
ls /dev/tty.*
to see which port is connected. for Windows Users, rundevmgmt.msc
and selectSerial Ports
to see which port is connected. Try to remove the port fromjohnny-five Board
and then try to reconnect. Make sure to connect USB2.0 with a USB2.0 Serial. - Everything is working except the Servo is not moving! What is wrong? check the
Servo
pin number in thejohnny-five Servo
and make sure it is correct.