Brilliant. I think Firmata may be what I've been looking for to control model railway layouts, with a Pi to control everything, and several Arduinos connected by USB or Bluetooth to drive servos, stepper motors and motor drivers. It would save a lot of work writing individual sketches for each Arduino. Even better, it looks like I could use Node-RED instead of writing any Python code, at least to get it all working, then write a really flashy Python program later if I want to. Node-RED could work for robots too.
Yes! Exactly, you can plug the firmata sensor readings and motor control into Node-Red to provide a dashboard UI and controls! You've got me thinking...
I was writing a touch screen controlled Python program to run on the Pi, that would probably have used I2C to communication with the Arduinos, each of which would have different devices attached. And that was my second or third attempt to build a system that worked! This seems a much simpler process that can be developed in stages, and got working very quickly: 1) Firmata on each Arduino 2) Plug devices into Arduinos 3) Set up Node-RED on Pi connected to network, with simple flows and a dashboard 4) Run dashboard on a phone or PC 5) Build the railway layout, install the servos, steppers and motor drivers, then connect everything with USB cables Then maybe one day, possibly, or maybe not: 6) Spend hours/days doing clever stuff with Python to create an all singing and dancing control system, or build a good olde fashioned control panel with lots of knobs and switches! Or both! And this could all be added to the existing Node-RED/Firmata system. Steps 1 to 4 should only take an hour or two, and I've spent many times more than that getting nowhere so far!
00:00 - Intro 00:40 - Session Goals 01:29 - Hardware Setup 01:45 - What is Firmata 03:19 - How it works 04:58 - Python PyFirmata Library 05:52 - Channel Announcements: Like, Comment and Subscribe 06:41 - Channel Announcements: New Video Every Sunday 06:49 - What we can do with Firmata? 07:44 - Why do we use Firmata? 08:45 - How to install Firmata on Arduino 09:25 - Upload Firmata Standard on Arduino 09:35 - Change to Bluetooth Serial Port (Remote Update) 10:29 - Demo Time 15:02 - Demo Time - Visual Studio Python Code (blink example) I will continue the rest of the chapters if I watched the remaining of the video.
very informative turorial. Can we use pyfirmata to control the robot without it being plugged into the computer (from battery power)? since the code is working form the PC directly and not uploaded on the Arduino itself.
If you disconnect the Arduino from the device, the code does not work with another power source I have to plug it into the computer What is the solution to permanently store the code on the Arduino like the Arduino IDE? I thank you very much for this excellent explanation :)
Hello Mr McAleer. I'm really interested in this topic. could you tell me, does the Arduino have to stay connected to the PC for the pyfirmata code to work? or can the system operate just fine without being continually connected? (of course, after the code is uploaded)
The Arduino acts as a middleman when using Pyfirmata - so if you disconnect it from the PC it will do nothing. It needs the PC to run the code and the Arduino listens for commands, gets or sets data from its inputs & outputs and returns that to the PC.
Great video, thank you! I am new to Arduinos / programming and I have a cheap "kickstarter" robot that has an Arduino with a custom shield to control the 4 axis'. Is there any extra coding that needs to be added for the Arduino to pass through the shield to control the motors or is it as simple as calling the PIN that they are connected to?
@@kevinmcaleer28 Thank you for the fast response. I am having trouble making it my robot arm move. The shield appears to look just like the one you are using in the video, however I am connected to servo motors. Do you mind send me a quick code snippet to make the servo motor on pin 13 move. Thank you again.
One more thing sir Kevin. I am trying to build a RFID-enabled automated retrieval/storage and inventory system using Arduino boards. For my prototype, do you believe pyfirmata will be able to retrieve rfid data serially, put it in a pandas dataframe and finally with the help of a wxpython GUI bind pyfirmata events(or the GUI can control pyfirmata)? I hope you understand what I'm trying to ask since I really would love your insight.
Sir , if i want to use bluetooth module (HC-05) , instead of USB cable what should do (in Windows) ? . I am new to arduino and i wanted to try something new by not using C++ for arduino .
You'll need to change the serial connection settings in the sketch and add a bluetooth module to pins 2 & 3 (RX & TX). Then connect to the bluetooth device from windows and it will show up as a com port. You can then connect to that com port from Python to control it
Good video, I do have a question. Lets say i want to build a program that shows the "Hello World" message on my pc screen when i click on a button on the arduino. Can i do this with just python and an arduino or do i still need another device?
Hi ChillaxingMuzic, Yes you can totally do this with just an Arduino and python on a PC. The PC Python script would have a loop to check the status of any messages from the Arduino, the Arduino would send a message to the PC over serial if the button was pressed
Tried using firmata with a motor driver. For some reason can't find it to work, even though it works in the arduino programming language (digital writing to pins works in arduino but not in python. The flashing pin code works in python though). Any advice?
no matter how many times I push the run button in visual studio it say's firmata not installed while it accepts the command just fine in pycharm. Have 0 clue what the problem is. Also I need a coder to help me build the terminator anyone interested in a serious humanoid robot project?? Hit me up please.
You can't use arduino libraries with firmata, the Arduino acts as a dumb terminal between its pins and the python computer its connected to. You can use python libraries to control it instead. Was there something specific you were thinking of?
@@kevinmcaleer28 Yes, i am thinking of text to speech with arduino and as python is so limitless we can do anything and exactly as you mentioned it is like ading GPIO support for arduino, thank you for your help
Awesome stuff. Thank you. people like you help us get more closer in building things our own and pursuing our passion.
Thank you
That is very interesting. I did not hear about Firmata and it looks like an easy way to communicate between any Pi device to Arduino. Thanks.
Brilliant. I think Firmata may be what I've been looking for to control model railway layouts, with a Pi to control everything, and several Arduinos connected by USB or Bluetooth to drive servos, stepper motors and motor drivers. It would save a lot of work writing individual sketches for each Arduino. Even better, it looks like I could use Node-RED instead of writing any Python code, at least to get it all working, then write a really flashy Python program later if I want to. Node-RED could work for robots too.
Yes! Exactly, you can plug the firmata sensor readings and motor control into Node-Red to provide a dashboard UI and controls! You've got me thinking...
I was writing a touch screen controlled Python program to run on the Pi, that would probably have used I2C to communication with the Arduinos, each of which would have different devices attached. And that was my second or third attempt to build a system that worked! This seems a much simpler process that can be developed in stages, and got working very quickly:
1) Firmata on each Arduino
2) Plug devices into Arduinos
3) Set up Node-RED on Pi connected to network, with simple flows and a dashboard
4) Run dashboard on a phone or PC
5) Build the railway layout, install the servos, steppers and motor drivers, then connect everything with USB cables
Then maybe one day, possibly, or maybe not:
6) Spend hours/days doing clever stuff with Python to create an all singing and dancing control system, or build a good olde fashioned control panel with lots of knobs and switches! Or both! And this could all be added to the existing Node-RED/Firmata system.
Steps 1 to 4 should only take an hour or two, and I've spent many times more than that getting nowhere so far!
We need a whole series for this 🙏🙏🙏
Nice video. well structured, informative and not rushed. just got yourself a new sub!
Thanks a lot I have been looking for that explanation!!
00:00 - Intro
00:40 - Session Goals
01:29 - Hardware Setup
01:45 - What is Firmata
03:19 - How it works
04:58 - Python PyFirmata Library
05:52 - Channel Announcements: Like, Comment and Subscribe
06:41 - Channel Announcements: New Video Every Sunday
06:49 - What we can do with Firmata?
07:44 - Why do we use Firmata?
08:45 - How to install Firmata on Arduino
09:25 - Upload Firmata Standard on Arduino
09:35 - Change to Bluetooth Serial Port (Remote Update)
10:29 - Demo Time
15:02 - Demo Time - Visual Studio Python Code (blink example)
I will continue the rest of the chapters if I watched the remaining of the video.
very informative turorial. Can we use pyfirmata to control the robot without it being plugged into the computer (from battery power)?
since the code is working form the PC directly and not uploaded on the Arduino itself.
You can use Bluetooth to connect both
I'm wondering how to use adafruit I2C sensors like the TSL2591 with Firmata. Would I need to recreate the circuitpython library in firmata?
Thank you for this great video.
thanks so much kevin
OMG u know a lot how I wished I had a raspberry pi and an Arduino mega
awesome tutorial sir , couldn't be better.
i was wondering if this was applicable to other types of arduinos (other than the mega and uno)
Yes, definitely - basically any board that be programmed via the Arduino IDE can take the Firmata code
If you disconnect the Arduino from the device, the code does not work with another power source
I have to plug it into the computer
What is the solution to permanently store the code on the Arduino like the Arduino IDE?
I thank you very much for this excellent explanation :)
The Python code cannot run on the Arduino as its only an 8bit processor. You therefore cannot permanently store or run the Python code on the Arduino
Thank you for this video. Will it work for Python 3.12?
Yeah, should do! Have you tried it?
Hello Mr McAleer. I'm really interested in this topic. could you tell me, does the Arduino have to stay connected to the PC for the pyfirmata code to work? or can the system operate just fine without being continually connected? (of course, after the code is uploaded)
The Arduino acts as a middleman when using Pyfirmata - so if you disconnect it from the PC it will do nothing. It needs the PC to run the code and the Arduino listens for commands, gets or sets data from its inputs & outputs and returns that to the PC.
@@kevinmcaleer28 thanks alot sir. my hope was that it could be controlled as unit once the pyfirmata code was uploaded.
Hey this is very useful content , good work
Thank you so much for the tutorial , i loved it! So... to work arduino with python the arduino need to be connected with a pc right?
Yes or a Mac or raspberry pi (something that can run full Python)
Hi, Kevin, would you mind explaining how Visual Studio where you write python codes connects to Arduino?
Sure - what do you want to know?
Great video, thank you! I am new to Arduinos / programming and I have a cheap "kickstarter" robot that has an Arduino with a custom shield to control the 4 axis'. Is there any extra coding that needs to be added for the Arduino to pass through the shield to control the motors or is it as simple as calling the PIN that they are connected to?
Thanks Marrino! Its as simple as calling the pin!
@@kevinmcaleer28 Thank you for the fast response. I am having trouble making it my robot arm move. The shield appears to look just like the one you are using in the video, however I am connected to servo motors. Do you mind send me a quick code snippet to make the servo motor on pin 13 move. Thank you again.
Quick question, how do you import an arduino library in out python sketch using PyFirmata?
I can't save the program in Arduino board like Arduino IDE . The project doesn't work without pc
One more thing sir Kevin. I am trying to build a RFID-enabled automated retrieval/storage and inventory system using Arduino boards. For my prototype, do you believe pyfirmata will be able to retrieve rfid data serially, put it in a pandas dataframe and finally with the help of a wxpython GUI bind pyfirmata events(or the GUI can control pyfirmata)? I hope you understand what I'm trying to ask since I really would love your insight.
hi, can you help me i have problem using pyfirmata and hdc1080 with arduino ... i tryed many code but no one works
Sir , if i want to use bluetooth module (HC-05) , instead of USB cable what should do (in Windows) ? . I am new to arduino and i wanted to try something new by not using C++ for arduino .
You'll need to change the serial connection settings in the sketch and add a bluetooth module to pins 2 & 3 (RX & TX). Then connect to the bluetooth device from windows and it will show up as a com port. You can then connect to that com port from Python to control it
@@kevinmcaleer28 is it possible to connect Bluetooth with arduino controller apps in arduino sir ?
Hello, were you able to make the connection? If yes, can you help me?
Good video, I do have a question. Lets say i want to build a program that shows the "Hello World" message on my pc screen when i click on a button on the arduino. Can i do this with just python and an arduino or do i still need another device?
Hi ChillaxingMuzic, Yes you can totally do this with just an Arduino and python on a PC. The PC Python script would have a loop to check the status of any messages from the Arduino, the Arduino would send a message to the PC over serial if the button was pressed
How to use resetFunc() from Arduino IDE in python to reset the arduino without actually pressing the physical button
I have a Question
arduino vs rasberry pi
which is better ???
I'm using Python but facing problem with firmata version
Bro can u do a video on vl53l0x sensor using Arduino in python
I've done one of these already: ua-cam.com/video/YBu6GKnN4lk/v-deo.html
Hi, I'm watching from Bangladesh.
Please help me,
how can I connect with Bluetooth and run the pyfirmata code ?
Btw nice video 😊
How to get input from dht11 sensor to python using pyfirmata
Tried using firmata with a motor driver. For some reason can't find it to work, even though it works in the arduino programming language (digital writing to pins works in arduino but not in python. The flashing pin code works in python though). Any advice?
Had the same issue. Make sure you are importing the correct board. I was using a Mega and asking for pins that were there. DUH!!! I homered it.
Can you get pyfirmata on visual studio code?
Pretty sure you can yes
that was helpful
how do i control arduino stepper motor using python
best
no matter how many times I push the run button in visual studio it say's firmata not installed while it accepts the command just fine in pycharm. Have 0 clue what the problem is. Also I need a coder to help me build the terminator anyone interested in a serious humanoid robot project?? Hit me up please.
Have you installed the pyfirmata library first with ‘pip install pyfirmata’ ?
how can we use arduino libraries with it?
You can't use arduino libraries with firmata, the Arduino acts as a dumb terminal between its pins and the python computer its connected to. You can use python libraries to control it instead. Was there something specific you were thinking of?
@@kevinmcaleer28 Yes, i am thinking of text to speech with arduino and as python is so limitless we can do anything and exactly as you mentioned it is like ading GPIO support for arduino, thank you for your help
good,
Can it work with ESP32?
The esp32 can run micropython, but I’m sure the pyfirmata will work on esp32 via the arduino ide If you select the esp32 board in board manager
Can you help me I have some errors
Hi
4:40
you can cut out the first 9 minutes. get to the point fast
Nice
How can i use hc-12 with arduino using python language?
You can treat it as a UART or Serial device, and then send data to it as you would normally
@@kevinmcaleer28 can i call you for more information please
@@waleedaiad3411 The best way to get help is to join our discord group - action.smarsfan.com/join-discord