Author: Jordi Guerrero.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
The Beaglebone Black board is known to be very fragile. I take no responsibility for any damages. Take all the precautions and always double-check the wiring through all the steps.
To protect your BBB I recommend:
Beaglebone GPIO:
Goals:
I use the TI eQEP Linux kernel module from Nathiel Lewis (http://nathanielrlewis.com/?p=87) which is included in BeagleBoard.org Debian image for BBB since 2014-May-14.
Note: I don't recommended updating your BBB if it is not necessary.
To know your Beaglebone version connect to BeagleBone Black over USB.
~ $ ssh root@192.168.7.2
or just type the command:
# cat /etc/issue
It shows a message:
Debian GNU/Linux 7
BeagleBoard.org BeagleBone Debian Image 2014-04-23
Also We can know our Linux distribution with the command: cat /etc/issue
In this example you have to update the BB Debian Image.
Beaglebone Black: http://beagleboard.org/latest-images
Beaglebone Green: http://www.seeed.cc/beaglebone_green/
$ xz -d <debian-image>.img.xz
copy the image to tour sdcard
$ sudo dd if=<debian-image>.img of=/dev/<sdcard-disk>
TRICK: If you want to monitor the progress of dd use:
# pv <debian-image>.img | dd of=/dev/<sdcard-disk>
~ $ ssh root@192.168.7.2
Debian GNU/Linux 7
BeagleBoard.org Debian Image 2015-11-12
Now we need Internet connection to download a git project. We have two options:
1.- Edit /etc/network/internet in your BBB:
1.1- WiFi Example with DHCP
allow-hotplug wlan0 # this line allows BBB to connect automatically your wifi connection
iface wlan0 inet dhcp
wpa-ssid "essid" ##Change essid with your essid
wpa-psk "password" ##Change password with your wifi password
1.2- WiFi Example with static IP
# WiFi Example
allow-hotplug wlan0
iface wlan0 inet static
wpa-ssid "essid" ##Change essid with your essid
wpa-psk "password" ##Change password with your wifi password
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1
2.- Plug your USB wifi Dongle
3.- Reboot the BBB.
We need to download a git project. One option is sharing Internet over USB connection. I just follow the next guide:
1.- Disablinng HDMI case. It's not necessary on Beaglebone Green.
First, we have to disable the HDMI cape. In /boot/uEnv.txt remove the # in line:
##Disable HDMI (v3.8.x)
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
Be careful, don't disable the eMMc or HDMI/eMMC cape!
Reboot the BBB. It took me a couple of reboots to make the ssh connection work again (I don't know why...).
Test that you have the HDMI cape disabled:
~# cat /sys/devices/bone_capemgr*/slots
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
If HDMI capes are without L (P-O--), you have successfully disabled HDMI cape.
ASSEMBLING MOTORS AND ENCODERS
This is the most difficult task because the difficulty in soldering the encoder to the motors.
First read the Pololu manual for this encoder:
https://www.pololu.com/product/2598
I used this images as a reference:
Steps:
Fit the nut in its hole. Use a metal screw and a screwdriver to fully screwed in.
Attach the bearing balls.
Use 4 nuts, 4 nylon spacers and 4 screw(M3) to join the two frames.
Connect the battery holders in series and test the polarity with a multimeter. Solder two pin headers. I attached holders with Kapton tape.
Use a spacer to hold the battery.
Cut the breadboard in three and attach it to the BBB case:
Attach the breadboard parts to the BBB case ot the top. Make sure that Power, Reset and User buttons remain accessible.
I'm working in a shied to avoid wire work. Link. It's working but not fully tested, I take no responsibility for any damages.
encoder_left_GND -- GND
encoder_left_OUTB -- 100 Ohms -- BBB_P8-35
encoder_left_OUTA -- 100 Ohms -- BBB_P8-33
encoder_left_VCC -- BBB_P9-3 (3V3)
encoder_left_M2 -- driver_BO1
encoder_left_M1 -- driver_BO2
encoder_right_GND -- GND
encoder_right_OUTB -- 100 Ohms Resitor -- BBB_P8-42
encoder_right_OUTA -- 100 Ohms Resitor -- BBB_P8-41
encoder_right_VCC -- BBB_P9-4 (3V3)
encoder_right_M2 -- driver_AO2
encoder_right_M1 -- driver_AO1
driver_GND -- GND
driver_VCC -- Switch_1 (7.2-7.5V)
driver_VIN -- regulator_VOUT (5V)
driver_BIN2-EN -- BBB_P9-14
driver_BIN1-PH -- BBB_P9-12
driver_AIN2-EN -- BBB_P9-16
driver_AIN1-PH -- BBB_P9-23
driver_MODE --- 22k Ohms Resitor --- driver_VCC
Regulator_VOUT (5V) -- driver_VIN
Regulator_GND -- GND
Regulator_VIN (7.2-7.5V) -- Switch_1
Switch_1 -- driver_VCC
Switch_2 -- Battery(6xAA)_VCC (7.2-7.5V)
Battery_GND -- GND
Battery(6xAA)_VCC (7.2-7.5V) -- Switch_2
BBB_P8-1 -- GND
BBB_P9-1 -- GND
In the next photographies you can see all the wiring done also the wiring of IR sensor (sorry, at this moment I don't have any photography without IR wires). I used a color code to help to clarify the cable work. In the first photograpy there is a mistake, I connected right encoder to P8_11 and P8_12, but it should be to P8_41(grey), P8_42(white).
Wire colors:
Black: GND || Red: 7.2V || Orange: 5V || Yellow: 3V3
Encoder_OUTB: White || Encoder_OUTA: Grey || encoder_M2: Blue || encoder_M1: Green
Driver_IN2-EN: Violet || Driver_IN1-PH: Dark green
I made lots of GND's connections instead of a ground plane... maybe too many :)
Note: I didn't find any Pololu component in fritzing. Therefore I used an ADXL345 instead of the desired Pololu Driver.
LEFT ENCODER
GPIOs:
P8-33
P8-35
# echo bone_eqep2 > /sys/devices/bone_capemgr.9/slots
# cat /sys/devices/ocp.3/48304000.epwmss/48304180.eqep/position
RIGHT ENCODER
GPIOs:
P8-41
P8-42
# echo bone_eqep1 > /sys/devices/bone_capemgr.9/slots
# cat /sys/devices/ocp.3/48302000.epwmss/48302180.eqep/position
Just in case that you have problems with eqep1 or eqep2 use eqep0.
EQEP 0
GPIOs:
P9_42
P9_27
~# echo bone_eqep0 > /sys/devices/bone_capemgr.9/slots
~# cat /sys/devices/ocp.3/48300000.epwmss/48300180.eqep/position
Make sure that:
~# cd fresonbot-HEAD-cf5faee/bashScripts/
~fresonbot-HEAD-cf5faee/bashScripts# ./test_encoders.sh
TESTING MOTORS
I programed in python a test code for motors. test_motors.py move the robot, forward, backward, turn left and finally turn right.
~# cd fresonbot-HEAD-cf5faee/
~fresonbot-HEAD-cf5faee/# python test_motors.py
If the robot turns crazy, use stop.py:
~fresonbot-HEAD-cf5faee/# python stop.py
I recommended to read the datasheet of the Sharp IR sensor. Link.
There are two important notes:
[...]
[...]
The first note is the reason why I put the IR sensors in vertical orientation. Also I use a 10 µF capacitor across power and ground close to the sensor.
I use Beaglebone analog input to read IR sensors. The BeagleBone Black hardware has six analog-to-digital converter (ADC) modules associated with six analog input pins. You can use these pins to measure positive voltages in the range 0 V (GND_ADC) - 1.8 V (VDD_ADC).
Caution: Never connect a voltage greater than 1.8 across the ADC pins. Voltages greater than 1.8 V can damage the board.
We have to reduce output IR sensor voltage. The easy way is to use a voltage divider.
Although in Control of mobile robots use 10kΩ and 22kΩ to voltage divider, I found a link that recommend 1kΩ and 470Ω to avoid lots of noise. I made my test to confirm this isue:
With 10kΩ-22kΩ
With 1kΩ-470Ω
I'm working in a shied to avoid wire work. Link. It's working but not fully tested, I take no responsibility for any damages.
Make sure that your voltage divider is connected properly, otherwise you could broke your beaglebone.
Ra Rb
Vin(5V)--[== 1K ==]--+--[== 470 ==]----+
| |
| |
| |
Vout(BBB_AINX) Gnd
Compact wiring:
#
# _2_
# 3/ \1
# | |
# | |
# 4| |0
#
IRsensor_Right_back_Yellow ---- BBB_AIN0
IRsensor_Right_front_Yellow ___ BBB_AIN1
IRsensor_Front_Yellow ---- BBB_AIN2
IRsensor_Left_front_Yellow ---- BBB_AIN3
IRsensor_Left_back_Yellow ---- BBB_AIN4
TESTING IR SENSORS:
First enable the ADC ports:
~# echo cape-bone-iio > /sys/devices/bone_capemgr.*/slots
Read the IRSensor, use AIN0, AIN1, AIN2, AIN3, or AIN4:
~# cat /sys/devices/ocp.3/helper.12/AIN0
~# cd fresonbot-HEAD-cf5faee/
~fresonbot-HEAD-cf5faee# python test_IR.py
Please feel free to leave any comments. Any improvement would of course be very welcome!
eqep:
Beaglebone GPIO:
Pololu Driver:
Pololu Encoder:
Pololu Regulator:
IR sensor datasheet:
IR Sensor voltage divider:
#fresonbot is work in progress in #socninja
https://t.co/Pf16TNa3bt https://t.co/VoP28RVaui
3 years, 9 months ago
#fresonbot is work in progress in #socninja
https://t.co/Pf16TNa3bt https://t.co/VoP28RVaui
3 years, 9 months ago
Using the cheap RTK8723bu Wifi/BT dongle with Raspberry Pi 2 #socninja https://t.co/l6F1Vq5i9b
3 years, 9 months ago
@ivaniclixx Optimized packages for Raspbian on Raspberry Pi 2 Model B: OpenCV (git) and libjpeg-turbo https://t.co/k1SvHIhLPr #socninja
3 years, 11 months ago
Youtube flash under FreeBSD 10 https://t.co/3bp3hivWui #socninja
4 years ago
Comments
Comments are manually approved. Just be a bit patient :-)
There are currently no comments
New Comment