Raspberry Pi Tutorial 38 - Use an Arduino as a Slave with Python (Nanpy)

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ม.ค. 2025

ความคิดเห็น • 140

  • @maximemanseau7750
    @maximemanseau7750 6 ปีที่แล้ว +1

    Thanks a lot for this video ! Detailed explanations along with visual support, well done.
    I've actually been trying to do serial communication between my arduinos and raspberry pis for days now and this is a lifesaver !

  • @joshuanulton1403
    @joshuanulton1403 8 ปีที่แล้ว

    Sorry I didn't watch the video long enough to get my answer... This can totally be used in a bi-directional manner, can't it!?? This is going to be great! My Pi ports are tied up because the Pi is using a python driven touchscreen GUI, the physical buttons I want to add have some of the same functions that are built into the GUI. This looks like the perfect solution to have the physical world connected into the GUI. I have subscribed, awesome work!

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  8 ปีที่แล้ว

      +Joshua Nulton Yep! I think it's great too which is why I chose to share it. If you're going embedded design you could use the same code with a bare ATMEGA and program it off the Pi's SPI. Smaller footprint, less expensive.

  • @YveDev23
    @YveDev23 9 ปีที่แล้ว +1

    I did enjoy this. thank you for taking the time doing it

  • @wavyrenac
    @wavyrenac 3 ปีที่แล้ว

    For anyone who has the problem with nanpy-firware when the Arduino is not excepting it"ignoring bad library name". I fixed it by removing the dash("-") from the nanpy-firmware because arduino forbits them.Simply go into the sketchbook directory and rename the nanpy-firmware library. That worked for me

  • @Aerox90
    @Aerox90 5 ปีที่แล้ว +2

    Raspberry Pi and Arduino should team up and create Raspuino!

  • @chrxs_383
    @chrxs_383 7 ปีที่แล้ว +7

    Thank you for the tutorial!
    Could you show how to controll a servo instead of a button?
    I would really appreciate that. :)

  • @evil_in_your_closet
    @evil_in_your_closet 8 ปีที่แล้ว

    This is fantastic!
    Might just be what i need for a project i am doing.
    I plan on controlling two Servos using Hardware PWM and i was thinking to use an Arduino Nano to do that for me, as the Pi only has one Hardware PWM capable pin.
    This might be the way to go.
    Thanks for sharing!

  • @ibrahimammar4559
    @ibrahimammar4559 6 ปีที่แล้ว

    Thank you Alexander Baran-Harper
    It is very useful video and very clear to flow,
    thank you very much

  • @Tuftyonthetube
    @Tuftyonthetube 8 ปีที่แล้ว +13

    Hi in the section cp -avr nanpy-firmware/ ~/sketchbook/libraries I'm getting a cannot create directory /home/pi/sketchbook/libraries no such file or directory could you tell me where I have gone wrong thanks

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  8 ปีที่แล้ว +13

      On your pi be sure to install the arduino ide. Then open up the ide on your pis desktop either thru remote login or locally. This will create the folder. You can create the folder yourself otherwise.

    • @WetOlde
      @WetOlde 7 ปีที่แล้ว

      Why is this usefull? Compared to controlling the system from the Raspberry pi directly? :)

    • @michaelspalluzzi3455
      @michaelspalluzzi3455 7 ปีที่แล้ว +5

      pwm can be a bit jittery on the pi and the pi doesnt have many pwm pins (although I believe newer gpio libraries like RPIO improve on these problems using DMA)
      or maybe you want an ardunio to take care of all the sensor reading in a system and a pi to take care of all the controls. especially in CPU hungry applications. never done it myself but i know a lot of people do it to split workload

    • @jeonnora4423
      @jeonnora4423 6 ปีที่แล้ว +1

      The question is how to create this folder on Arduino IDE of Raspberry pi GUI? I am just a newbie so, please help me creating this folder.

    • @jeonnora4423
      @jeonnora4423 6 ปีที่แล้ว

      Sorry to disturb you! I finally created the "libraries" folder in Arduino IDE successfully. Thank you!

  • @jerrygrimes8813
    @jerrygrimes8813 5 ปีที่แล้ว

    This is a great intro. Just getting into this, wanting to control stepper or DC motors, need Arduino to provide more capable IO pins, and analog voltages.

    • @kamalwolly2639
      @kamalwolly2639 5 ปีที่แล้ว

      use h-bridge and external power supply for your motors

  • @kevinvanrensburg
    @kevinvanrensburg 4 ปีที่แล้ว

    Thank you so much. It worked perfectly for me!

  • @agentrfr1
    @agentrfr1 9 ปีที่แล้ว

    Hi Alexander! I just wanted to say I've thoroughly enjoyed your guides - especially you one on the MCP3008 ADC which I've used to build a heliostat that tracks the sun's position by monitoring voltages on differently orientated mini PV panels (I switched relays using logic-level mosfets rather than BJTs - I'm not an elec eng so I found sizing them easier based off of Vgd vs. Rsd curves as I could only source rather beefy 12V relays, maybe other people will too? Approximate Beta values for the BJTs at different currents added ambiguity I wasnt very comfortable with, I found the mosfets far more sensible from a first iteration design point of view).
    Maybe for future projects you could do something more geeky/esoteric like using a Pi as a mobile wifi NAS, a mobile https over wifi based text/binary encryption/decryption mechanism or a car dashcam?
    Keep it up! Can't wait for the next videos!

  • @GoldenHat333
    @GoldenHat333 6 ปีที่แล้ว +9

    İt fails to connect
    I am using a Raspberry pi 3 b

  • @abhishekchopade1996
    @abhishekchopade1996 6 ปีที่แล้ว +1

    What about the Hardware connections..?
    How is the arduino connected to the Pi, normally plugged in to the USB of the Pi or the serial pins(Tx,Rx) of the arduino are hooked up to the Pi's Tx,Rx?

  • @seanlovesjobo
    @seanlovesjobo 8 ปีที่แล้ว +2

    Using python 2. It throws the exception " 'a' is not defined" not really sure what is going on. Is it the try statement? Shouldn't it be " try: except: finally: " ?

    • @mardiidking6348
      @mardiidking6348 7 ปีที่แล้ว

      It also does that using Python 3.5.3, idk how to fix it either.

  • @barnowldroneservices2979
    @barnowldroneservices2979 4 ปีที่แล้ว

    Great video. this is very helpful. thank you

  • @shakyaikesh3512
    @shakyaikesh3512 6 ปีที่แล้ว +1

    How can i communicate with 2 or more arduino... how can i define the com port for the arduino... and can i do this by using etherne port/ cable??

  • @TheMdbProductions
    @TheMdbProductions 4 ปีที่แล้ว

    when i open ide says( The Library "nanpy-firmware" cannot be used. Library names must contain only basic letters and numbers. (ASCII only and no spaces, and it cannot start with a number)
    why this is happening, double copys on the libraries folder??? i continue and check that i have the nanpy on the sketchbook - libraries-nanpy i try to upload it and says that serial port Com 1 not found

  • @johndavismit
    @johndavismit 4 ปีที่แล้ว

    This is awesome, but I run into an issue. I was hoping I could get a little help. After launching the IDE I get an error message that says "The library nanpy-firmware cannot be used. Library names must contain only basic letters and numbers." Any thoughts on what needs to change?

  • @mathieu246
    @mathieu246 8 ปีที่แล้ว

    Hi Alexander Baran-Harper,
    I have a project where I need to control a 200 step motor. However, I seem to have encountered a problem:
    There is a communication delay of roughly 0.01 s between the Pi and the Arduino. This means that each iteration step in Python (to turn the motor by one step) will present this delay resulting in the motor being slow as each command is sent individually.
    Do you think it would be possible to add a "step motor" function to the nanpy firmware to be called upon through Python on the Pi? My idea is to have the iteration loop done directly on the Arduino to prevent this lag.
    Thanks in advance!
    MP
    P.S. I'm sorry if it's not completely clear!

  • @freaker126
    @freaker126 7 ปีที่แล้ว

    is it the same as now firmata? The nanpy i mean? I assumed you can now control the sensor, motor etc. with this. an updated 2018 version would be great with raspbian stretch. can't seem to install it.

  • @sket123flamez7
    @sket123flamez7 3 ปีที่แล้ว

    hi i bought a few Arduinos and they turned out to be fake or cloned with ch340 chip and i cannot do what i wanted i read that i cannot reprogram the ch340 chip to be recognized as a hid joypad is there a way that i can make the rpi and arduino bypass the ch340 chip and get recognised as joypad like the Arduino Leonardo as one thing im trying to make a force feed back simulator steering wheel and because of the ch340 chip cannot be reprogramed to be seen as a hid when plugged in so could i use rpi as hid and use it to controll the firmware on an arduino so use rpi as usb interface and brains use arduino as a slave for pots and motor drivers im a new to rpi and arduino i have rpi zero 2w arduino mega 2560 ch340 chip and uno with ch340 chip i also read that rpi zero can be detected as a hid with a few changes

  • @joshuanulton1403
    @joshuanulton1403 8 ปีที่แล้ว

    Can it just as easily go in the opposite direction, using an Arduino with an array of switches SENDING commands to the Pi? My project Pi only had a couple GPIO ports remaining, so I thought maybe I could use a Tiny85 with a couple shift registers connected to a dozen buttons to act as a switch master.

  • @keegamun1234
    @keegamun1234 5 ปีที่แล้ว

    may i ask, isit the arduino processing the code in this case or isit the rpi running it? because i would like to utilise the arduino processing power heheh. Thanks!

  • @KSU.CS2R
    @KSU.CS2R 9 ปีที่แล้ว +4

    thx for you tutorial it is very helpful i try it with a.analogRead but it does not work can you help me how read an analog input to raspberry using arduino as ADC

  • @nchofontagha1231
    @nchofontagha1231 3 ปีที่แล้ว

    This is awesome. Just what I have been looking for. I am working on a raspberry pi 4. I know it's been over 5 years that this video was uploaded. I got over several bugs but I am stuck on the first try loop. It keeps failing there. So the Arduino API object a is not finally created. Please can someone help me out?

  • @klompjeusa
    @klompjeusa 6 ปีที่แล้ว

    All, I know this is a old post, but I have a question for you all. I did an exact copy of what was explained in the video, and when I run the program, I see that the switch is 0 and LED off. When I push button, I see "Button on (1)" and then program crashes. Any idea what that could be? Any help would be great!!!!!!! Thank you!

  • @keepsecret7624
    @keepsecret7624 8 ปีที่แล้ว +18

    This needs a pdf file!

  • @momoking11
    @momoking11 7 ปีที่แล้ว

    Hi again Mr. Alexander , I would like to ask if this code of mine will work on controlling the dc motors i would also to know if i can also import and use the GPIO of the raspberry pi. thank you.
    from picamera.array import PiRGBArray
    from picamera import PiCamera
    import RPi.GPIO as GPIO
    import time
    import cv2
    import cv2.cv as cv
    import numpy as np
    from nanpy import (Arduino, SerialManager)
    motor1a = 5
    motor1b = 4
    motor1c = 6
    motor2a = 8
    motor2b = 7
    motor2c = 9
    try:
    connection = SerialManager()
    a = ArduinoApi(Connection = connection)
    except:
    print("Failed to connect to Arduino")
    a.pinmode(motor1a, a.OUTPUT)
    a.pinmode(motor1b, a.OUTPUT)
    a.pinmode(motor1c, a.OUTPUT)
    a.pinmode(motor2a, a.OUTPUT)
    a.pinmode(motor2b, a.OUTPUT)
    a.pinmode(motor2c, a.OUTPUT)
    def froward():
    a.digitalWrite(motor1a, a.HIGH)
    a.digitalWrite(motor1b, a.LOW)
    a.digitalWrite(motor2a, a.HIGH)
    a.digitalWrite(motor2b, a.LOW)
    def reverse():
    a.digitalWrite(motor1a, a.LOW)
    a.digitalWrite(motor1b, a.HIGH)
    a.digitalWrite(motor1a, a.LOW)
    a.digitalWrite(motor1b, a.HIGH)
    def rightturn():
    a.digitalWrite(motor1a, a.HLOW)
    a.digitalWrite(motor1b, a.HIGH)
    a.digitalWrite(motor2a, a.HIGH)
    a.digitalWrite(motor2b, a.LOW)
    def leftturn():
    a.digitalWrite(motor1a, a.HIGH)
    a.digitalWrite(motor1b, a.LOW)
    a.digitalWrite(motor2a, a.LOW)
    a.digitalWrite(motor2b, a.HIGH)
    def stop():
    a.digitalWrite(motor1a, a.LOW)
    a.digitalWrite(motor1a, a.LOW)
    a.digitalWrite(motor1a, a.LOW)
    a.digitalWrite(motor1a, a.LOW)

  • @TheKartik1989
    @TheKartik1989 9 ปีที่แล้ว

    Hello,
    I wanted to connect more than 1 sensors to my pi which uses Rx and Tx pins and for that I am thinking of using arduino with pi as arduino can have software serial. Is there any way I can do this using Nanpy?

  • @chakithpatil3478
    @chakithpatil3478 4 ปีที่แล้ว

    you can make vedio on contrloing servo like this please

  • @ssout1246
    @ssout1246 8 ปีที่แล้ว

    This seems like the best way to control hardware with a Raspberry pi. Two things didn't seem to work right. When I tried to create the libraries the message said library names couldn't have dashes so I deleted the dash. Second, when I tried to upload the library to the Arduino I got a compile error. No or missing "SPI.h". Next, I created another sd card from scratch. What should I try next?

  • @dinodanny1
    @dinodanny1 3 ปีที่แล้ว

    it seems that a lot of people are having this issue, and so am I. Is there any way to get this working with 2 or more arduinos?

  • @SubhadipPramanik
    @SubhadipPramanik 7 ปีที่แล้ว

    Hey, isn't your LED supposed to toggle on/off in each second if the button is on?

  • @lodesmets9815
    @lodesmets9815 7 ปีที่แล้ว

    Very good explanation

  • @yuangao9731
    @yuangao9731 8 ปีที่แล้ว

    Sir I have another question....... I download other arduino library..... how I suppoesed to import them? I know how to use the pre-installed library.... how about the new one?

  • @seth1913
    @seth1913 5 ปีที่แล้ว

    Can’t download the Nanpy sketch to the Arduino, please help!

  • @AustinDozier
    @AustinDozier 6 ปีที่แล้ว

    is it possible to programing the Pi to call arduino functions that are already uploaded to arduino board via serial communication.

  • @javalin597
    @javalin597 8 ปีที่แล้ว

    Is there a way to get this library to control multiple Arduinos at once? I haven't been able to get it to work

  • @johnjoyce
    @johnjoyce 6 ปีที่แล้ว

    Really well done. THanks!

  • @henripajuni1714
    @henripajuni1714 7 ปีที่แล้ว

    How can i create a master-slave connection like this, but with an arduino shield connected throw lan cable?

  • @mot6021
    @mot6021 8 ปีที่แล้ว +3

    Thank you for the well made video, too many have no value. Would you consider making one for pyFirmata?

  • @mechadroit
    @mechadroit 8 ปีที่แล้ว

    can you control the i2c bus on the Arduino in the same fashion?

  • @jeffcostello6747
    @jeffcostello6747 6 ปีที่แล้ว

    I've been using this tutorial to control multiple Arduinos using the RPi. However, every time I disconnect/reconnect an Arduino, the device path for the Arduino changes. For my application, it is critical that the program can uniquely identify each Arduino board, perhaps two Arduino Megas, and assign the correct device path when establishing connection. It would be catastrophic if the board IDs were to unknowingly switch.
    I've experimented in the /sys/bus/devices/ folder on my Pi looking for a way to attribute a specific piece of hardware to a particular device path, but had limited success. Is there a simple solution that I'm overlooking?

    • @MuhammadArshad
      @MuhammadArshad 6 ปีที่แล้ว +1

      yes, pyudev is a wrapper for udev which is used to USB devices. You can write a function where when any USB device is connected, its file path is recognised by pyudev and then use that.

  • @SirJackyMan
    @SirJackyMan 8 ปีที่แล้ว +1

    Hi Alex, great video! Just one question, would nanpy work with windows at all? or does it only work with linux and raspberry pi?

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  8 ปีที่แล้ว

      +SirJackyMan I assume it would work on Windows. The nanpy package is a Python package. I assume any machine / OS that can run Python can run the nanpy module. I haven't tried it myself, though.

  • @marcthompson647
    @marcthompson647 7 ปีที่แล้ว

    When ever I try to upload the nappy library to the arduino I get this:
    In file included from MCP41xxxClass.cpp:1:0:
    cfg.h:87:1: error: 'cd' does not name a type
    cd ..

  • @nacanielitabua3143
    @nacanielitabua3143 8 ปีที่แล้ว

    Hi Alexander Baran-Harper,
    My project is making a controller for a robotic arm. I'm proposing that the the feedback signals from the shaft encoders and the limit switches be read by the Raspberry Pi....An inverse/forward kinematics algorithm will be deployed onto the Pi to which appropriate signals will be generated by the raspberry Pi and be sent over to the Arduino board for PWM signal generation that will control my joint motors...My arm consists of 6 motors including the gripper motor.
    I am very much interested in your proposed master-slave protocol. Will the nanpy firmware be compatible with my proposed design???
    THanks,
    WQ

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  8 ปีที่แล้ว +1

      I don't see why not. The Uno has 6 PWM pins, so you should be alright. I haven't experimented with the interrupts on the Uno and nanpy which is something that might be used in a limit switch situation.

  • @cedricdejaegere8687
    @cedricdejaegere8687 4 ปีที่แล้ว

    can you also do this with a lcd display?

  • @NRJSTL2
    @NRJSTL2 8 ปีที่แล้ว +1

    Hi I keep getting and exception when the button goes high. I get the reading correctly and then it goes to the except statement. Would you have any idea why it would does this or do you need more information?

    • @NRJSTL2
      @NRJSTL2 8 ปีที่แล้ว

      I get an exception where it doesn't recognize a.digitalWrite()

    • @ssout1246
      @ssout1246 8 ปีที่แล้ว

      I having the same problem. Did you solve it? I hope.

  • @corrpside20
    @corrpside20 7 ปีที่แล้ว

    Hi do you have any code for running stepper motor / raspberry pi + arduino + easydriver + NEMA17 . Thank you in advance

  • @DanielDuhon
    @DanielDuhon 5 ปีที่แล้ว +3

    What happens when there’s no “sketchbook” folder to move the nanpy-firmware to?

    • @davidledieu2399
      @davidledieu2399 5 ปีที่แล้ว +2

      According to the author 3 years ago "On your pi be sure to install the arduino ide. Then open up the ide on your pis desktop either thru remote login or locally. This will create the folder. You can create the folder yourself otherwise." I just did this and that bit was resolved :-)

  • @jesan06
    @jesan06 7 ปีที่แล้ว

    Can we take the ATMEGA328P chip and use it as slave to?

  • @glanisjoyalmonteiro6650
    @glanisjoyalmonteiro6650 7 ปีที่แล้ว

    how do I use Arduino as an ADC for raspberry pi 3.
    What code should I use

  • @alberttxu
    @alberttxu 8 ปีที่แล้ว

    How can I upload the nanpy firmware to the arduino without a gui?

  • @manishreddysama6555
    @manishreddysama6555 5 ปีที่แล้ว +1

    please explain to me why we need to upload servo.h to Arduino?

    • @kothiquefelixx4772
      @kothiquefelixx4772 5 ปีที่แล้ว

      we don't. it was just an example of how you could modify cfg.h for your needs

  • @amirhosseinhajji
    @amirhosseinhajji 7 ปีที่แล้ว

    I'm trying to read an analog input of arduino in python
    when i write the code " sensorPin=A1" it gives me an error.python does not recognise analog inputs of arduino.why?can somebody help me?

  • @xkernel
    @xkernel 8 ปีที่แล้ว

    I get the following error:
    Traceback (most recent call last):
    File "/home/pi/Desktop/nanpy/blinkLed.py", line 17, in
    a.pinMode(ledPin, a.OUTPUT)
    NameError: name 'a' is not defined
    >>>
    Why is that?

    • @GalaxyRangerX
      @GalaxyRangerX 5 ปีที่แล้ว

      I'm having the same problem. Were you ever able to figure it out?

  • @ahmadkamalmughal6349
    @ahmadkamalmughal6349 7 ปีที่แล้ว

    is it possible to get data (text, audio) on raspberry pi screen from more than one Arduino, (when Arduinos fix at some distance apart)?

  • @sampleemail2600
    @sampleemail2600 8 ปีที่แล้ว

    different or same process for arduino mega? can you make tutorial for nanpy using arduino mega,.. thanks

  • @devendrachaudhary5923
    @devendrachaudhary5923 5 ปีที่แล้ว

    how to do the same process using wireless bluetooth module ???

  • @nacanielitabua3143
    @nacanielitabua3143 8 ปีที่แล้ว

    I also got the missing SPI.h problem when trying to upload the nanpy-firmware??....Any remedies???

  • @werkhaye
    @werkhaye 7 ปีที่แล้ว +1

    Hi I am getting a compiling error when uploading the firmware what can I do to fix it?

    • @wavyrenac
      @wavyrenac 3 ปีที่แล้ว

      did you found the solution i have the sam problem it says "the library nanpy-firmware cannot be used

    • @nchofontagha1231
      @nchofontagha1231 3 ปีที่แล้ว

      @@wavyrenac I renamed the file withou the hyphen or space and it got me going. Did you figure this out?

  • @Alphafee1
    @Alphafee1 8 ปีที่แล้ว

    How do we read analog voltages in nanpy?

  • @yuangao9731
    @yuangao9731 8 ปีที่แล้ว

    Sir, I have a question, so how can you import the servo package for arduino? In arduino IDE I just type #include , how I supposed to do that in python code?

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  8 ปีที่แล้ว

      +高原 Around 3:30 I show you how to get into the configuration file where you can choose which packages you will be uploading to the Arduino. You'll need to ensure you have servo enabled there. Then on your python script you'll want to create a servo instance with
      servo = Servo(9, connection=connection)
      where servo is the name of the instance, connection is your connection, and 9 is the pin you connect to.
      Then to control the servo:
      servo.write(##)
      Where ## is whatever number you want, like 90.

    • @yuangao9731
      @yuangao9731 8 ปีที่แล้ว

      Alexander Baran-Harper Sir, thanks for your reply, I will test it right away. Another question, how did you figure it out? Is there kind of tutorial or manual which has detail explaination of each function in nanpy package? Because I am sure I will run into other question pretty soon. I just can not find it online. And that nanpy package didn't have that.......

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  8 ปีที่แล้ว

      +高原 The nanpy documentation does not include any meaningful instruction or tutorials in my opinion. There are a few examples on the GitHub repo: github.com/nanpy/nanpy/tree/master/nanpy/examples including one for a servo. The general readme says all adjustments should be made in cfg.h. I contacted Andrea, the author, for further clarification.
      I felt there was a lack of setup documentation for beginners (such as myself) and this was the reason for creating this tutorial. I think it's a great package, if only documentation were better.

    • @yuangao9731
      @yuangao9731 8 ปีที่แล้ว

      Alexander Baran-Harper Sir, you really save me this time.... thank you!!!

  • @sshashlan
    @sshashlan 9 ปีที่แล้ว

    can you please make a video on how to use plotly and live graph a temperature sensor or any other data collection source

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  9 ปีที่แล้ว

      Yes. But it will take me some time. I will be doing another series of videos on a project involving a tkinter GUI that plots sensor data for a user with a nanpy backend that polls sensors connected to an atmega328p (arduino). Stay tuned bud!

    • @sshashlan
      @sshashlan 9 ปีที่แล้ว

      +Alexander Baran-Harper that sounds great, but I was referring to the raspberry pi.
      love your work in general keep it up
      cheers

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  9 ปีที่แล้ว

      +Shaker Al Hashlan Right, and I was referring to the raspberry pi. Plotly is a library that that can be imported into Python. Python runs on any computer, including the pi. My project I was describing would use matlibplot (part of plotly) in a GUI running on the pi, with data being fed to the pi from a sensor. A bigger picture than just focusing on plotly.
      It'll take time, but I can make it happen. Unfortunately I can't do this full time just yet!

  • @robodev6033
    @robodev6033 6 ปีที่แล้ว

    Hello how about analog input does it the same as arduino

  • @teomilos
    @teomilos 7 ปีที่แล้ว

    how come when I type cd Desktop/, I get Arduino.desktop nanpy as a response whilst your terminal responds with mega DS18b20 NRF24L01 playground

  • @tommyarno9935
    @tommyarno9935 6 ปีที่แล้ว

    so how can this be used to control a servo?

  • @vishalanime
    @vishalanime 8 ปีที่แล้ว

    can you write a code for controlling stepper motors ?

  • @momoking11
    @momoking11 7 ปีที่แล้ว

    can i mix the code of arduino and python, like if i have my camera detects object the motors that is on arduino will run?

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  7 ปีที่แล้ว

      Of course. The code I wrote is all Python as it is. There isn't any C needed (provided the functionality you need is in the library).

    • @momoking11
      @momoking11 7 ปีที่แล้ว

      +Alexander Baran-Harper than you very much on the reply, I'm having my thesis now and i got a problem with the motor driver that we bought, its not working on pi so we decided to run it on arduino

  • @mihnearomanovschi1444
    @mihnearomanovschi1444 7 ปีที่แล้ว

    Hi! When I try to upload the Nanpy sketch/library I get an error Serial was not declared in this scope

    • @mihnearomanovschi1444
      @mihnearomanovschi1444 7 ปีที่แล้ว

      nothing works... i am broken. i feel my life energy leaving me

    • @mihnearomanovschi1444
      @mihnearomanovschi1444 7 ปีที่แล้ว

      omg, i dont know what i did but i did it. thx for the tutorial thou, pretty good if you ask me

  • @r.i.s.hbeatz7969
    @r.i.s.hbeatz7969 5 ปีที่แล้ว

    at 6:17 when I typed ls right after desktop) and nthng showed up

  • @jeonnora4423
    @jeonnora4423 6 ปีที่แล้ว

    I have already passed the installation steps. However, I am having problems in running the program in Python3. I got this error:
    AttributeError: 'ArduinoApi' object has no attribute 'digitlWrite'
    Please help me!

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  6 ปีที่แล้ว

      It's right there in the error code: no attribute 'digitlWrite'
      digitalWrite, not digitlWrite.

  • @danielderese3170
    @danielderese3170 3 ปีที่แล้ว

    Thank you very much!!!

  • @Skewghf78
    @Skewghf78 7 ปีที่แล้ว

    I doubt this will work with an additional board

  • @sapargeldirsarsa9163
    @sapargeldirsarsa9163 4 ปีที่แล้ว

    thank you for video.

  • @mateoslab
    @mateoslab 6 ปีที่แล้ว

    but the gpio pins are not connected to anything

  • @taditarun2448
    @taditarun2448 7 ปีที่แล้ว

    can i do this in ubuntu , just like downloading nanpy and arduino ide in ubuntu and similar process

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  7 ปีที่แล้ว

      Yes. There shouldn't be a problem there - I have done it myself. Although many of my tutorials feature the Raspberry Pi, most concepts can apply to any Linux computer.

    • @taditarun2448
      @taditarun2448 7 ปีที่แล้ว

      i have tried in ubuntu but there is no path sketchbook in the arduino folder. so where i have to copy the nanpy

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  7 ปีที่แล้ว

      Usually the folder is created when you open up the Arduino IDE and save a sketch. You can copy the files to wherever you keep your Arduino user libraries.

  • @nacanielitabua3143
    @nacanielitabua3143 8 ปีที่แล้ว

    got error as:
    File"buttonLED.py", line 13
    print("Failed to connect ot arduino")
    ^
    SyntaxError: invalid character in identifier

    • @NorzoTech
      @NorzoTech 5 ปีที่แล้ว

      that's weird

  • @nielsvanb
    @nielsvanb 7 ปีที่แล้ว +7

    you really don't need the LED, the ardiono has an internal LED on port 13

    • @witChaos
      @witChaos 4 ปีที่แล้ว +3

      It just seems better for the video

  • @nazardudyk4784
    @nazardudyk4784 4 ปีที่แล้ว

    Excellent.

  • @wrenstewart4265
    @wrenstewart4265 5 ปีที่แล้ว +4

    "a" is not defined and it fried my resistor

  • @edgargranados7704
    @edgargranados7704 6 ปีที่แล้ว

    my buttonstate keeps fluctuating between 1 and 0

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  6 ปีที่แล้ว

      Check your circuit. Are you polling the pin the button is connected to? If so, ensure your pull down resistor is connected properly.

  • @ryanelliott5976
    @ryanelliott5976 3 ปีที่แล้ว

    Looking at code without semicolons is nerve wracking.

  • @Duncan_1971
    @Duncan_1971 7 ปีที่แล้ว

    Not sure if it was relevant when published but why not just make the PI and the Arduino into MQTT brokers & publish messages from the PI to the Arduino (and back) ?
    PI:
    learn.adafruit.com/diy-esp8266-home-security-with-lua-and-mqtt/configuring-mqtt-on-the-raspberry-pi
    ARDUINO:
    pubsubclient.knolleary.net/

  • @jeetenderkakkar7570
    @jeetenderkakkar7570 3 ปีที่แล้ว

    10 downloadd

  • @electronictechnology1102
    @electronictechnology1102 6 ปีที่แล้ว

    Nic

  • @das250250
    @das250250 7 ปีที่แล้ว

    I cannot believe people still work on computers in such a long winded install setup process.. You can't suggest to me this is the fastest way to setup a system environment

  • @joelrobert4539
    @joelrobert4539 4 ปีที่แล้ว

    Yes I'm Ironman

  • @jeetenderkakkar7570
    @jeetenderkakkar7570 3 ปีที่แล้ว

    Chgv

  • @jdwebdesign6625
    @jdwebdesign6625 6 ปีที่แล้ว

    Hi Alaxander, your tutorial was verry helpful! however i'm trying to convert my own arduino code, but it isn't working as it is supposed to. Is there any possible way you could help me rewrite the arduino code into python? if nessesairy for a small payment? if you are interessted please contact me at my e-mail adres: info@jd-webdesign.nl. it is about a RFID (MFRC522) module wich has to work with 4 readers who are switching a relay if you place the correct cards on the correct readers. thank you in advance!

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  6 ปีที่แล้ว

      I don't have the bandwidth to help re-write code at this time. However a potential approach to your problem that may lessen the scope of your work is to setup communication between the Arduino and pi and maintain the core functionality of the Arduino code. That is: any reading the Arduino device does is simply transmitted to the pi through serial communication or something like that. It may be simpler than trying to port the code when you're working with custom libraries.

    • @jdwebdesign6625
      @jdwebdesign6625 6 ปีที่แล้ว

      Thank you for your reply. i must say, i have tried to do this over serial communication. This worked fine. my problem was that i need to run another script on my RPi when the right combinations of cards is placed on the readers. It has to run the second script automatically. and since it isn't possible to send commands to your pi over serial i don't know how to do this else than using the nanpy module. do you have any suggestions?

    • @alexanderbaran-harper4748
      @alexanderbaran-harper4748  6 ปีที่แล้ว

      @@jdwebdesign6625 I am unsure what the issue is here. If you have a python script running that is interpreting feedback from the Arduino, why not just employ that script as a module to feed into a master script that then makes decisions based on card reading? The Arduino could be configured to just send readings to the Pi, and the Pi interprets those readings to make decisions. Would that work?
      Unsure of your application, but an example that comes to mind would be if the card combo 6,7,8,9,10 is dropped, Arduino feeds "6,7,8,9,10" to the Pi, the Pi then interprets that and compares it against a dictionary of combinations, determines you have a "run" and then flashes the word "run" on the screen. To achieve that, the Arduino is simply sending the readings to the Pi. The Pi receives the readings, interprets, and enacts action based off it.

  • @jeetenderkakkar7570
    @jeetenderkakkar7570 3 ปีที่แล้ว

    Policee

  • @wouldbabyhitlerkillyou4217
    @wouldbabyhitlerkillyou4217 6 ปีที่แล้ว

    pointless

  • @putraadriansyah8082
    @putraadriansyah8082 4 ปีที่แล้ว

    I have a raspberry pi, but can i use PC/laptop VGA I²C DDC port to do this? I want to connect arduino with PC directly without rs232, using the computer's I²C bus

  • @pundrikpatel2781
    @pundrikpatel2781 6 ปีที่แล้ว

    how this communication done with c code??

  • @loganbyrne3054
    @loganbyrne3054 6 ปีที่แล้ว +1

    will this work on the RaspPi model 3 B?

    • @ar_xiv
      @ar_xiv 6 ปีที่แล้ว

      yes

  • @twotapsx
    @twotapsx 6 ปีที่แล้ว

    Hi, what if I wanna use mac instead of raspberry. I actually installed everything like in the video, everythin was correct
    but then when I write the program and run it it says:
    NameError: name 'a' is not defined
    and idk what to do, any help?