To test this setup I ran the K8055 demo. By moving the DA1 slider up and down I could change the speed of the motor. By selecting different combinations of Outputs 1 and Output 2 I could change the direction of the motor. There are k8055 commands that can be used in your own software running on the PC that will write or read the same data as in the k8055 demo.
In my larger and now defunct k8055 robot base (failed motor) I wired up my own h-bridge but now I am using a smaller robot base using two motors from a robot vacuum cleaner the L289 should do the job. The BASIC code I wrote for the old robot base should work on this smaller robot base.
Tomorrow I will wire up the second motor and place them and the circuits back into the robot base. The wireless keyboard you see in front of the laptop is used to send commands to the robot's laptop brain. I will give some demo code written in BASIC (although it can also be written in C++). This means you don't have to plug an Arduino into the PC every time you want to change the code. All you have to do is write and/or run whatever robot program you want on the laptop making use of all the developmental software a laptop provides. You can also use the PC for speech, speech recognition, playing sounds, internet connection and so on and make use of the inbuilt webcam to give the robot vision. The laptop screen can have a robot face for showing emotions.
Looks like the birth of a baby Arlo. A computer screen face will make the face part of it really easy. Looks like you are well on your way to having a fully functional robot in the very near future. Cool.
I have always considered a pc as giving you the best bang for your buck when it comes to a robot brain. The problem I had was they took away the parallel ports replacing them with USB ports and created a complex multitasking operating system making the pc impossible for me to use as a robot controller with my limited self taught knowledge. The K8055 changed all that but by then I had other things taking up most of my life so it was a halfhearted effort to build the first k8055 robot base when I lucked upon some powerful geared motors. All was going fine until one of the motors failed. Now some years later I am giving it another go with a weaker robot base that is sufficient to test some ideas and even perhaps do some interesting stuff.
As for the robot face and speech that is last on my list I was just pointing out how easy and cheap that would be no special extra hardware to purchase. My first interest is just getting the robot base to map and navigate a house. Also the K8055 is just a stop gap until I have my own Arduino based intelligent USB interface between the laptop and the sensors and motors. Also I have been experimenting with the RPi and its high level software access to its GPIO pins as a possible addition in future designs.
But for now all I want is to get an easy to program working robot base up and running as a platform for testing coding ideas and different types of sensors.
'' create a function pointer, arguments must be the same '' as in the original function Dim OpenDevice As Function (Byval CardAddress As Long) As Long Dim CloseDevice As Sub Dim SetAllDigital As Sub Dim ClearAllDigital As Sub Dim SetDigitalChannel As Sub (Byval As Integer) Dim ClearDigitalChannel as sub (Byval as integer) Dim WriteAllDigital As Sub(Byval As Integer) Dim ReadAnalogChannel as Function(Byval CardAdress As Integer) As Integer Dim ReadAllAnalog As Sub(Byval As Integer Ptr, Byval As Integer Ptr) Dim OutputAnalogChannel As Sub (Byval As Integer, Byval As Integer) Dim OutputAllAnalog As Sub (Byval As Integer, Byval As Integer) Dim ClearAnalogChannel As Sub (Byval As Integer) Dim SetAllAnalog As Sub () Dim ClearAllAnalog As Sub () Dim SetAnalogChannel As Sub (Byval As Integer) Dim ReadDigitalChannel As Function (Byval As Integer) As Integer Dim ReadAllDigital As Function () As Integer Dim ReadCounter As Function (Byval As Integer) As Integer Dim ResetCounter As Sub (Byval As Integer) Dim SetCounterDebounceTime As Sub (Byval As Integer, Byval As Integer) Dim hndl As Any Ptr hndl=DyLibLoad("k8055d.dll") '' find the procedure address (case matters!) OpenDevice = DyLibSymbol( hndl, "OpenDevice" ) CloseDevice = DyLibSymbol( hndl, "CloseDevice" ) SetAllDigital = DyLibSymbol( hndl, "SetAllDigital" ) ClearAllDigital = DyLibSymbol( hndl, "ClearAllDigital" ) SetDigitalChannel = DyLibSymbol(hndl, "SetDigitalChannel") ClearDigitalChannel = DyLibSymbol(hndl, "ClearDigitalChannel") WriteAllDigital = DyLibSymbol( hndl,"WriteAllDigital") ReadAnalogChannel = DyLibSymbol( hndl,"ReadAnalogChannel") ReadAllAnalog = DyLibSymbol( hndl, "ReadAllAnalog") OutputAnalogChannel = DyLibSymbol( hndl,"OutputAnalogChannel") OutputAllAnalog = DyLibSymbol( hndl,"") ClearAnalogChannel = DyLibSymbol( hndl, "ClearAnalogChannel") SetAllAnalog = DyLibSymbol( hndl, "SetAllAnalog") ClearAllAnalog = DyLibSymbol( hndl,"ClearAllAnalog") SetAnalogChannel = DyLibSymbol( hndl,"SetAnalogChannel") ReadDigitalChannel = DyLibSymbol( hndl, "ReadDigitalChannel") ReadAllDigital = DyLibSymbol( hndl,"ReadAllDigital") ReadCounter = DyLibSymbol( hndl,"ReadCounter") ResetCounter = DyLibSymbol( hndl, "ResetCounter") SetCounterDebounceTime = DyLibSymbol( hndl, "SetCounterDebounceTime") screenres 640,480,32 'open a 640x480 window with 32 bit colors '' then call it.. Print "opening" OpenDevice(0) Print "opened" Print Sleep 1000 ClearAllDigital() 'clear all digital outputs print "All Clear" do if multikey(&H2C) then 'forward direction of motor1 [Z] key SetDigitalChannel(1) ClearDigitalChannel(2) OutputAnalogChannel(1,192) 'start motor1 elseif multikey(&H2E) then 'reverse direction of motor1 [C] key SetDigitalChannel(2) ClearDigitalChannel(1) OutputAnalogChannel(1,192) 'start motor1 else OutputAnalogChannel(1,255) 'stop motor1 end if if multikey(&H33) then 'forward direction of motor2 [,] key SetDigitalChannel(3) ClearDigitalChannel(4) OutputAnalogChannel(3,192) 'start motor2 elseif multikey(&H35) then 'reverse direction of motor1 [?] key SetDigitalChannel(4) ClearDigitalChannel(3) OutputAnalogChannel(3,192) 'start motor2 else OutputAnalogChannel(3,255) 'stop motor2 end if sleep 2 loop until multikey(&H01) ClearAllDigital() 'TURN OFF MOTORS OutputAnalogChannel(1,255) OutputAnalogChannel(3,255) 'now shut down the device Print "closing" CloseDevice () Print "closed" DyLibFree hndl
So I have wired up the second motor and tested it with a little program shown in the previous post that allows you to drive around using keys [Z] and [C] together as a toggle switch for one motor and keys [,] and [?] as another toggle switch for the other motor to drive the robot base around like a tank.
The program was written in FreeBASIC although it can be written in other languages as well that can make use the k8055.dll that comes as part of the K8055 board to send and receive messages with a PC.
The PWM signals are inverted thus 255 means STOP while 0 is full speed ahead.