Hi, I have an udoo x86 Ultra card where I installed Ubuntu. I installed python and managed to create a program to display the video from my stereo card. However despite my many researches and my grove kit I still do not know how to make a program that controls my servo motor. Thank you in advance for your advice.
The grove kit, servos and I2C bricks are controlled from the Arduino part. For more info see the documentation: https://www.udoo.org/docs-x86/Hardware_&_Accessories/Bricks_snap_in_sensors.html
So it was enough for me to program my servomotors in the same way that they are programmed on arduino, using the same libraries.
In fact despite my research and my attempts I still have not managed to run a single servomotor. Do you have a tutorial to manage them in python? Thank you
Here is a nice example: https://behindthesciences.com/electronics/python-gui-for-controlling-an-arduino-with-a-servo/
I have tried many ways the code in python. The command window opens but nothing works. Yet I read a lot of pages about Udoo to find a solution.
This is nothing special Udoo stuff. This is exactly the same as a PC (or Raspberry Pi) communicate with an Arduino. The only thing you have to know is the name of the serial port on Linux side that is communicating with the Arduino 101 (Curie). You have to be sure that only 1 program is communicating. So not also have Arduino serial monitor and your python program open. If python has no response you have to debug python an so better use a python oriented page instead of Udoo.
Thank you but my servomotor is connected to pin 9, pin RND and pin 5V. How do I translate that so that it can work under linux? Should not you install a driver?
The Udoo X86 is a computer and an Arduino on 1 board. They communicate with a fixed USB connection. It is like a raspberry pi and an Arduino. So your servo you have to connect with the Arduino part and program it with the Arduino IDE you have to install on the Linux side of the Udoo. Then you use python to send commands through serial (eg rotate 90 degrees) to the Arduino. It will rotate the servo. The last link I gave you was an example how to do this but an an raspberry/Arduino combination. So you have to adapt it a little to use it on your Udoo. Most likely you only have to change the serial port address in your python program.
I am completely lost on this subject. I did not think it was so difficult to program that. If I ever do that I'll make a video that I post on my YouTube channel to show others how to do it.
So I can not program this in python outside the arduino IDE? Because I program in python exclusively in console mode.
https://arduino.stackexchange.com/questions/105/programming-an-arduino-using-python-rather-than-c-c Another approach (two computer approach: PC + MCU) is to get Arduino to run firmata, i.e., make itself as a slave being indirectly controlled by the PC (the UDOO x86), then get the PC (running Python and others) to "drive" the slave. Remember that Arduino, after all, is just running on a tiny MCU (microcontroller) with a rich I/O capability but not a lot of brain; while a PC (UDOO x86's main Intel CPU) is a rather powerful computer with a lot of programming language to support but just a limited I/O capability. UDOO x86 board is a happy marriage between the two and why not take advantage of both.
Ok thank you for your advice, but I am talented only in web and database. In the programmable cards the only thing I know how to do is the installation of linux and python programming with some notions of electronics.
I tried to make a simple code to light a led with firmata, but I did not manage to light it import pyfirmata board = pyfirmata.Arduino('/dev/ttyACM0') board.digital[7].write(1) board.pass_time(1) board.digital[7].write(0) board.pass_time(1) board.digital[7].write(1) board.pass_time(1) board.exit()
Is your Arduino side working at all. Can you compile and send the Arduino Blink sketch example to the Arduino with the Arduino IDE? This should result in a blinking green led on your Udoo X86. After that send the firmata sketch to your arduino and try again to communicate with Python (pyfirmata)
I have to use the arduino IDE? I used it a long time ago when I only worked on arduino with the language c
Arduino IDE saves a lot of work on I/O development, especially for folks not seasoned in MCU part of the world. So, go for the IDE, it's very easy. In Arduino code, include the necessary firmata code such that it can be controlled by the x86 side of the board.
With the IDE, if I program in language C on my arduino through UDOO (/ ttyACM1), everything is fine But if I program on my UDOO (/ ttyACM0), that's it: avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00