The lag in response is because I'm slowly punching in the commands on my webserver (located in Canada) while the robot fetches them (from Japan). I used an indirect method with AJAX and storing the next command on a web server. There are many ways to feed the robot commands like making a list of them or communicating directly with the robot with UDP or TCP/IP. Control 4 license hack code#If you have two motors on one motor bridge, here is sample code for how you can move forward. Control 4 license hack serial#import time import serial #initialize the serial connection #for windows (change COM6 to match the USB device) #ser = serial.Serial("COM6", 2400) #for linux (change /dev/ttyUSB0 to match the USB device) ser = serial.Serial("/dev/ttyUSB0", 2400) ser.open() #open the connection #Make sure RTS and DTR are off ser.setRTS(False) ser.setDTR(False) print("initialization finished") #main loop c = 1 while c: ser.setRTS(False) ser.setDTR(True) time.sleep(2) ser.setRTS(True) ser.setDTR(False) time.sleep(2) In Linux, it will be something like /dev/ttyUSB0. If you’re in Windows, it will be COM6 or something like that. After plugging in your USB device, you have to look in your device manager to see what the connection is called. Here is the basic code to test if everything is working. My program connected to the internet to get commands, but you could also use UDP, TCP/IP, or store the commands in an array. Control 4 license hack how to#Just Google for how to control a serial port in your preferred language. I used Python, but it is possible to write it in almost any language. You could also just get another USB-to-Serial cable and set up another motor bridge for better forward control and power. With only one motor bridge, to go forward the robot must ‘waddle’ with each motor being turned on for a few ms before the other is turned on. You don’t need the switch I’ve put into the circuit, but sometimes the serial pins are set to high when the USB turns on which will make your motor(s) rev before your program can start up and turn them off. You can see my 100Ω resistor cluster in the photo. That is a lot of resistors, but at about $0.02 each, that beats buying an extra 2w resistor. Since resistors in parallel divide their resistance, 20 resistors at 100Ω = 5Ω (as would 10 resistors at 50Ω). However if you bought 1/4 watt resistors in bulk (like I did) you can can put enough in parallel to divide that wattage since eight 1/4 watt resistors can take 2w. The resistor would need to be 2 - 5Ω with high wattage (2w or more). There are two ways to fix this: get higher voltage motors or put in a resistor to limit the current. The only problem is that TA7291P needs 4.5v to operate, but the motors are 3v. Since this part will not get hot when operating the circuit, you can insulate it using a glue gun if need be. Solder one to the Transmit Data pin (TD) if you want to play around with that too. Solder a wire to the DTR, RTS and ground pins. I could clip off the ends and slide a wire inside them which held it in place as I soldered. I was lucky that the pins on the serial plug were hollow. On the serial plug, there is a guard around the pins which you might want to remove to make it easier to solder the pins, but you don’t need to. If you do that, binary ‘0’ is a high voltage on RS-232 and binary ‘1’ is low. The data transmit pin is possible to use, but would require an IC to decode it (like a shift register), or a transistor to amplify the weak current it sends. Instead of sending any messages, we’ll just be using those 5v logic pins. The way a serial connector works is by sending 5v logic signals to say it’s ready to send or receive a message, along with that message itself. There are nine pins, but you only need three. The first thing to do is hack the USB-Serial adapter.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |