Control Arduino with Python using Firmata / PyFirmata

Поділитися
Вставка

КОМЕНТАРІ • 75

  • @i-negm
    @i-negm 2 роки тому +12

    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.

  • @techuntech
    @techuntech 2 роки тому +8

    Awesome stuff. Thank you. people like you help us get more closer in building things our own and pursuing our passion.

  • @thebravo299
    @thebravo299 2 роки тому +2

    Nice video. well structured, informative and not rushed. just got yourself a new sub!

  • @iKostanCom
    @iKostanCom 3 роки тому +4

    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.

  • @EcoHamletsUK
    @EcoHamletsUK 3 роки тому +4

    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.

    • @kevinmcaleer28
      @kevinmcaleer28  3 роки тому +2

      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...

    • @EcoHamletsUK
      @EcoHamletsUK 3 роки тому +2

      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!

  • @Lord-Black__
    @Lord-Black__ 2 роки тому +1

    Thanks a lot I have been looking for that explanation!!

  • @dreamwork69
    @dreamwork69 Рік тому

    We need a whole series for this 🙏🙏🙏

  • @GraveyardghouI
    @GraveyardghouI Рік тому +1

    Thank you for this great video.

  • @kuwornueyramdela2304
    @kuwornueyramdela2304 2 роки тому +2

    thanks so much kevin

  • @NicholasWong-vv1nn
    @NicholasWong-vv1nn 2 дні тому

    I'm wondering how to use adafruit I2C sensors like the TSL2591 with Firmata. Would I need to recreate the circuitpython library in firmata?

  • @XPowerfullXPlayerX
    @XPowerfullXPlayerX 2 роки тому +1

    Hey this is very useful content , good work

  • @user-cl7nj9ob5m
    @user-cl7nj9ob5m Рік тому +2

    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 :)

    • @kevinmcaleer28
      @kevinmcaleer28  Рік тому

      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

  • @omarsalah6777
    @omarsalah6777 2 роки тому +2

    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)

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому +1

      Yes, definitely - basically any board that be programmed via the Arduino IDE can take the Firmata code

  • @BUILDwithMAULIK
    @BUILDwithMAULIK 2 роки тому +2

    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.

  • @user-yr1yq5mq6h
    @user-yr1yq5mq6h 6 місяців тому +1

    Thank you for this video. Will it work for Python 3.12?

  • @TheCeremoniesOfIsrael
    @TheCeremoniesOfIsrael Рік тому

    OMG u know a lot how I wished I had a raspberry pi and an Arduino mega

  • @mohamedjbaili701
    @mohamedjbaili701 11 місяців тому

    I can't save the program in Arduino board like Arduino IDE . The project doesn't work without pc

  • @yefriencarnacion8717
    @yefriencarnacion8717 2 роки тому +1

    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?

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому +1

      Yes or a Mac or raspberry pi (something that can run full Python)

  • @michaeljwosniak7241
    @michaeljwosniak7241 2 роки тому +2

    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)

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому +1

      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.

    • @michaeljwosniak7241
      @michaeljwosniak7241 2 роки тому

      @@kevinmcaleer28 thanks alot sir. my hope was that it could be controlled as unit once the pyfirmata code was uploaded.

  • @xianguihuang5477
    @xianguihuang5477 2 роки тому +1

    Hi, Kevin, would you mind explaining how Visual Studio where you write python codes connects to Arduino?

  • @jackthorat4933
    @jackthorat4933 2 роки тому

    How to use resetFunc() from Arduino IDE in python to reset the arduino without actually pressing the physical button

  • @JesusGonzalez-rd6qn
    @JesusGonzalez-rd6qn Рік тому

    Quick question, how do you import an arduino library in out python sketch using PyFirmata?

  • @MartinoDesign99
    @MartinoDesign99 2 роки тому +1

    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
      @kevinmcaleer28  2 роки тому

      Thanks Marrino! Its as simple as calling the pin!

    • @MartinoDesign99
      @MartinoDesign99 2 роки тому

      @@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.

  • @beyyhenn1233
    @beyyhenn1233 3 роки тому +2

    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 .

    • @kevinmcaleer28
      @kevinmcaleer28  3 роки тому +2

      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

    • @beyyhenn1233
      @beyyhenn1233 3 роки тому

      @@kevinmcaleer28 is it possible to connect Bluetooth with arduino controller apps in arduino sir ?

    • @mariafernandagarciapineda8334
      @mariafernandagarciapineda8334 2 роки тому

      Hello, were you able to make the connection? If yes, can you help me?

  • @Ordinary._.Original
    @Ordinary._.Original Рік тому

    hi, can you help me i have problem using pyfirmata and hdc1080 with arduino ... i tryed many code but no one works

  • @amirphilip2234
    @amirphilip2234 6 місяців тому

    I'm using Python but facing problem with firmata version

  • @GRSG_tech
    @GRSG_tech Рік тому

    I have a Question
    arduino vs rasberry pi
    which is better ???

  • @hinasahamedmohamedsaleem500

    How to get input from dht11 sensor to python using pyfirmata

  • @michaeljwosniak7241
    @michaeljwosniak7241 2 роки тому

    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.

  • @nadiasafafajriani1839
    @nadiasafafajriani1839 Рік тому

    hi, could you hellp me please.
    i've been trying for 3 days to fix the problem with pyfirmata. however it always appear ModuleNotFoundError : No module named 'pyfirmata' whenever i run on spyder IDE or command prompt.
    i already pip3 install pyfirmata and it's succesfully installed. please help, im dying

  • @taranagnew436
    @taranagnew436 2 роки тому +1

    Can you get pyfirmata on visual studio code?

  • @havtje50
    @havtje50 2 роки тому +1

    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?

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому +1

      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

  • @mortezazamani3570
    @mortezazamani3570 2 роки тому

    that was helpful

  • @have_fun1107
    @have_fun1107 4 місяці тому

    best

  • @alphonsenyandwi9075
    @alphonsenyandwi9075 Рік тому

    good,

  • @ramazancalk1218
    @ramazancalk1218 2 роки тому

    how do i control arduino stepper motor using python

  • @adhithanp930
    @adhithanp930 2 роки тому +1

    Bro can u do a video on vl53l0x sensor using Arduino in python

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому

      I've done one of these already: ua-cam.com/video/YBu6GKnN4lk/v-deo.html

  • @waleedaiad3411
    @waleedaiad3411 2 роки тому +1

    How can i use hc-12 with arduino using python language?

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому

      You can treat it as a UART or Serial device, and then send data to it as you would normally

    • @waleedaiad3411
      @waleedaiad3411 2 роки тому +1

      @@kevinmcaleer28 can i call you for more information please

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому

      @@waleedaiad3411 ​ The best way to get help is to join our discord group - action.smarsfan.com/join-discord

  • @frames123
    @frames123 2 роки тому +1

    how can we use arduino libraries with it?

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому

      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?

    • @frames123
      @frames123 2 роки тому

      @@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

  • @royhopkins974
    @royhopkins974 2 роки тому +1

    Can it work with ESP32?

    • @kevinmcaleer28
      @kevinmcaleer28  2 роки тому

      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

  • @richardgao456
    @richardgao456 2 роки тому

    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?

    • @markspence1494
      @markspence1494 2 роки тому +1

      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.

  • @kaboom1208
    @kaboom1208 2 роки тому

    Hi, I'm watching from Bangladesh.
    Please help me,
    how can I connect with Bluetooth and run the pyfirmata code ?
    Btw nice video 😊

  • @antalervin19-
    @antalervin19- 2 роки тому

    Can you help me I have some errors

  • @superpayaseria
    @superpayaseria 4 місяці тому

    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.

    • @kevinmcaleer28
      @kevinmcaleer28  4 місяці тому

      Have you installed the pyfirmata library first with ‘pip install pyfirmata’ ?

  • @whiskynguyen6059
    @whiskynguyen6059 8 днів тому

    4:40

  • @YtAtif
    @YtAtif Рік тому

    Hi

  • @rverm1000
    @rverm1000 Рік тому

    you can cut out the first 9 minutes. get to the point fast