Test the Hardware
Motors
Before testing your assembled electronics plug in the 12V DC power supply or the Li-Po battery, otherwise the motors won't run. We will now test each component individually. ssh into the BeagleBone blue board and run
ost@bblue:$ sudo gpioset -c gpiochip3 MOT_STBY=1
Open two other shells and run
ost@bblue:$ sudo gpioset -c gpiochip1 MDIR_1A=1
and
ost@bblue:$ sudo gpioset -c gpiochip3 MDIR_1B=0
Changing the polarity of MDIR_1A and MDIR_1B will change the direction. In a forth shell, configure the pwm signal as follows:
ost@bblue:$ echo 0 | sudo tee /sys/class/pwm/pwmchip2/export ost@bblue:$ echo 1000000 | sudo tee /sys/class/pwm/pwmchip2/pwm0/period ost@bblue:$ echo 500000 | sudo tee /sys/class/pwm/pwmchip2/pwm0/duty_cycle ost@bblue:$ echo 1 | sudo tee /sys/class/pwm/pwmchip2/pwm0/enable
Check the second motor with
ost@bblue:$ sudo gpioset -c gpiochip0 MDIR_2A=1
and
ost@bblue:$ sudo gpioset -c gpiochip3 MDIR_2B=0
Changing the polarity of MDIR_2A and MDIR_2B will change the direction. In a forth shell, configure the pwm signal as follows:
ost@bblue:$ echo 1 | sudo tee /sys/class/pwm/pwmchip2/export ost@bblue:$ echo 1000000 | sudo tee /sys/class/pwm/pwmchip2/pwm1/period ost@bblue:$ echo 500000 | sudo tee /sys/class/pwm/pwmchip2/pwm1/duty_cycle ost@bblue:$ echo 1 | sudo tee /sys/class/pwm/pwmchip2/pwm1/enable
Check the third motor with
ost@bblue:$ sudo gpioset -c gpiochip1 MDIR_3A=1
and
ost@bblue:$ sudo gpioset -c gpiochip1 MDIR_3B=0
Changing the polarity of MDIR_3A and MDIR_3B will change the direction. In a forth shell, configure the pwm signal as follows:
ost@bblue:$ echo 0 | sudo tee /sys/class/pwm/pwmchip4/export ost@bblue:$ echo 1000000 | sudo tee /sys/class/pwm/pwmchip4/pwm0/period ost@bblue:$ echo 500000 | sudo tee /sys/class/pwm/pwmchip4/pwm0/duty_cycle ost@bblue:$ echo 1 | sudo tee /sys/class/pwm/pwmchip4/pwm0/enable
Encoders
Enable the counters with:
ost@bblue:$ echo 1 | sudo tee /sys/bus/counter/devices/counter1/count0/enable ost@bblue:$ echo 1 | sudo tee /sys/bus/counter/devices/counter2/count0/enable ost@bblue:$ echo 1 | sudo tee /sys/bus/counter/devices/counter3/count0/enable
Then watch the counters with
ost@bblue:$ watch -n 0.5 cat /sys/bus/counter/devices/counter1/count0/count ost@bblue:$ watch -n 0.5 cat /sys/bus/counter/devices/counter2/count0/count ost@bblue:$ watch -n 0.5 cat /sys/bus/counter/devices/counter3/count0/count
If you move the axis you should see counter values changing.
LEDs and buttons
Next we want to check if all leds and buttons work as desired. The blue led should light up on pin GPIO3_2 with
ost@bblue:$ sudo gpioset -c gpiochip2 GPIO3_2=1
Do the same with the red led on pin GPIO1_17
ost@bblue:$ sudo gpioset -c gpiochip0 GPIO1_17=1
And the green led on pin GPIO3_20
ost@bblue:$ sudo gpioset -c gpiochip2 GPIO3_20=1
Read the state of the blue button with
ost@bblue:$ sudo gpioget -c gpiochip2 GPIO3_1
When the button is pressed it will return “1”=active, “1”=inactive otherwise. Do the same with the red button
ost@bblue:$ sudo gpioget -c gpiochip0 GPIO1_25
And the green button
ost@bblue:$ sudo gpioget -c gpiochip2 GPIO3_17
Mouse
Connect the mouse and check under /dev/input which event is associated to the mouse. You can list the devices with 'ls' before and after you plug the mouse. The device associated to the mouse should be event1. If the event is available, you can type following on the terminal:
sudo cat /dev/input/event0
If you move the mouse you should see some characters on the screen. This shows that the mouse inputs are received by the BBBlue.
Adjust Hardware Configuration File
Check the direction of the encoders. Lower your TCP and run watch your encoder values.When raising the TCP the encoder values should be positive. Change each negative encoder in the HwConfigBBBlue.json from
"scale": [ { "id" : "gear",
"minIn": 0, "maxIn": 1,
"minOut": 0, "maxOut": 76 },
{ "id" : "enc",
"minIn": 0, "maxIn": 6.283185307179586476925286766559,
"minOut": 0, "maxOut": 4096},
{ "id" : "fqd",
"minIn": 0, "maxIn": 1,
"minOut": 0, "maxOut": 4}
],
to (changed sign in id:enc)
"scale": [ { "id" : "gear",
"minIn": 0, "maxIn": 1,
"minOut": 0, "maxOut": 76 },
{ "id" : "enc",
"minIn": 0, "maxIn": -6.283185307179586476925286766559,
"minOut": 0, "maxOut": 4096},
{ "id" : "fqd",
"minIn": 0, "maxIn": 1,
"minOut": 0, "maxOut": 4}
],
Check the encoder and gear values and adjust them if necessary. You can change HwConfigBBBlue.json on the host before deploying to the target or on the target directly. After that you can run the Delta application.
Next: Deploy to the Target
