-
Wiring pictures
07/24/2017 at 08:22 • 0 comments -
Python script
07/24/2017 at 07:22 • 0 commentsThe Python script is really simple and the only module you need to install is the Blynk library and ServoBlaster needs to be install in the same directory.
Pin V0 and V1 control the movement of the left motor and pin V2 and V3 control the movement of the right motor. The slider on pin V4 controls the servo in the neck.
The slider in the Blynk app should be setup so it writes on an interval while sliding and not just on release. I set it up to write every 100ms for a smooth movement.
Installing ServoBlaster
- git clone https://github.com/richardghirst/PiBits.git
- cd /PitBits/ServoBlaster/user
- sudo make servod
- sudo make install
Python script
import BlynkLib import RPi.GPIO as GPIO import os import time os.system("./servod --p1pins=12,16,18") GPIO.setmode(GPIO.BCM) GPIO.setup(20, GPIO.OUT) GPIO.setup(21, GPIO.OUT) GPIO.setup(19, GPIO.OUT) GPIO.setup(26, GPIO.OUT) GPIO.output(20, GPIO.LOW) GPIO.output(21, GPIO.LOW) GPIO.output(19, GPIO.LOW) GPIO.output(26, GPIO.LOW) BLYNK_AUTH = '' blynk = BlynkLib.Blynk(BLYNK_AUTH) @blynk.VIRTUAL_WRITE(0) def my_write_handler(value): if int(value) == 1: GPIO.output(19, GPIO.HIGH) print("press") else: GPIO.output(19, GPIO.LOW) @blynk.VIRTUAL_WRITE(1) def my_write_handler(value): if int(value) == 1: GPIO.output(26, GPIO.HIGH) else: GPIO.output(26, GPIO.LOW) @blynk.VIRTUAL_WRITE(2) def my_write_handler(value): if int(value) == 1: GPIO.output(20, GPIO.HIGH) print("press") else: GPIO.output(20, GPIO.LOW) @blynk.VIRTUAL_WRITE(3) def my_write_handler(value): if int(value) == 1: GPIO.output(21, GPIO.HIGH) else: GPIO.output(21, GPIO.LOW) @blynk.VIRTUAL_WRITE(4) def my_write_handler(value): os.system("echo 2=%d > /dev/servoblaster" % (int(value))) blynk.run()
-
Power consumption
07/22/2017 at 15:07 • 0 commentsI've measured the power consumption to know if the boot problems I was having had anything to do with the power consumption.
The problem I'm having happens only on power on so I started measuring the current on boot, the current starts at around 100 mA and has a peak at around 360 mA. This is far below the max output of the power bank at 1000 mA.
For comparison I also measured the current draw when it is idle and powering motors. In the idle state the current stays around 330 mA. When the motors start there is little peak and then it goes to about 600 mA.
If you compare the current draw you would expect that the boot wouldn't draw too much current. It could be that there is a really quick peak current that my multimeter is too slow to pick up and sends the electronics in some sort of reboot cycle, but that is just a guess.
-
Arms and power problems
07/21/2017 at 20:08 • 0 commentsThe first arm is printed and attached and the second side/arm is currently being printed. The sides have mounts for the servos and the arms are directly connected to the servos.
Power problems?
When I connect everything up it won't power up this is probably because it draws too much current. I will be measuring the current it draws but for now I will just leave one servo disconnected. The battery pack that I use has a capacity 4400mAh and can deliver 1000 mA.