So, first off, this board I am using is the BeagleBone AI-64. It is a 64-bit SoC w/ two Cortex-A72 microprocessors. It is actually a very fast board in my opinion on booting and basic computing. There are many different functionalities of this specific board that I could go into but will not right now. If you want to view more ideas from this SBC, please visit beagleboard.org .
Just look up BBAI-64 or go to their forums to inquire about the R5 cores or PRUs outside of the fast, main microprocessors.
oh! The forums they provide are located online at forum.beagleboard.org .
Okay...
So, we have a board, a daughter card called a Cape, and a 12v battery. We have a DC to DC converter that steps down the 12v of the battery to put in 5v at a specific amperage into the Servo Cape so that the PCA9685 onboard the Servo Cape can function and provide appropriate signaling to the Servo Motor(s) in question...
There are basically three files:
1. a file
2. b file
c. the file to run for usage on the BBAI-64
1. is a PCA9685 file that calls the smbus2 pure Python3 lib. to chat directly to the chip onboard the ServoCape.
2. is a file that will wrap around the smbus2 file of the PCA9685 file so that we can have some "bearings" on what to call and when... And of course, things can be changed. This is not set in stone! Enjoy!
3. is our file we will use to call the Flask application for the usage of html pages to control the Servo Motor(s).
Moving on now outside of explanations.
I will show off the files later so that you can use a servo on your BBAI-64 w/ the Servo Cape and the PCA9685!
For now, let us take down some ideas...
- Go to the forum.beagleboard.org site online and find the sections for your SBC to install the latest image from beagleboard.org .
- Use etcher to install the image to SD Card. If you are still on the forum.beagleboard.org site, use the search tool. Search for ideas about the BBAI-64 while your image is installing to SD Card via etcher.
- This way, you will have some knowledge on what to expect outside of this short instance of ideas.
- Now...we should put the SD Card in the SBC. Put the USB-C cable in the USB-C cable port on the BBAI-64. Put an Ethernet cable in the port for the Ethernet, and finally plug in Servo Cape and USB Fan to cool the board while processing.
- The Screw Terminal on the Servo Cape handles 5v maximum. Only use an appropriate DC-to-DC converter, and in this case a 12v to 5v converter b/c of my use of a 12v battery, in the case of the Servo Cape. Remember that the screw terminal on the Servo Cape has a maximum of 5v input to it.
- You can plug in a Servo, three pin servo, and try S1 from reading the silkscreen.
- In hindsight, you will have five wires to the Servo Cape, GND PWR from the converter, and GND PWR SIG from the servo motor(s). Make sure your battery if you are using one does not exceed the amperage of the battery. In other words, if your battery is 12v @ 7A, make sure your DC-to-DC converter can withstand such a reduction in voltage and allow for that amperage.
- Now, that we are connected before applying power to the SBC (BBAI-64), put the connected USB-C to USB-3.0 into your host (development computer). This will power the board.
- If you are using a battery, plug in the Red (Positive) cable first when connecting. Then, plug in the Black (Negative) cable to the battery.
- We are fully powered at this point and we can now review some source to handle the servo(s) in question.
Okay...so. Our lesson is over, the source is below but one final couple of steps may need to be made depending on your set up.
/boot/firmware/extlinux is a file on this board. In that file is another file called extlinux.conf and it should look similar to the below text to associate the Servo Cape DTS w/ the BBAI-64:
label Linux microSD
kernel /Image
append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0 quiet
fdtdir /
fdtoverlays /overlays/BBORG_SERVO-00A2.dtbo
initrd /initrd.img
If you are putting in more than one overlay, always use /overlays/YOUR_DTS in this file called /extlinux.conf
It will be associated w/ the fdtoverlays line in extlinux.conf.
Okay. So, now go to this site online:
https://github.com/silver2row/ServoCape
git clone https://github.com/silver2row/ServoCape
cd ServoCape
nano pwmsOne.py
alter the source to make it so it works:
servos = ServoCtrl("/dev/i2c-5", 0x7f, 50) # CORRECT
and...
# servos.enablePWMs(True) # CORRECT
and...
Go to /home/debian/.local/lib/python3.9/site-packages/smbus2/
Look through smbus2.py until you come across the class header:
class SMBus(object):
A little further down is where we need to alter the source of smbus2.py here:
if isinstance(bus, int):
filepath = "/dev/i2c-5".format(bus)
This if statement should like exactly like the above text. We are formatting bus 2 which is allocated or symlinked to /dev/i2c-5.
W/ a little hacking and work, the Servo Cape should be fully ready and working. If you have any questions or answers or ideas, please do reply and I will be prompted to answer!
Seth
P.S. Thank you Ben and thank you lorforlinux for each of you putting up w/ me and my hooligan ideas!
I forgot to mention one thing:
1. You may need to alter w/ chown a couple of files to change groups to handle the non root usage of specific files w/in this ecosystem.
2. Video w/ odd and peculiar me!
If and when you build, I would like to see your progress.
So, post the ideas you build in the comments...
The only homework for you or anyone who wants this licensed set of instructions is to add the HTML page in a /templates/ directory file called whatever is in the pwmsOne.py file. You can always change the name too!
Anyway, use HTML and radio buttons to make the servo function to your liking:
Oooh yea!
Comments