- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have herkulex motor(http://www.sgbotic.com/products/datasheets/robotics/herkulexeng.pdf)
I want to drive with psoc. There are 4 inputs on servo motor. 1-vcc 2-gnd 3- rx 4-tx . Can I drive the motor using uart in psoc. How should be uart parameters and code? Should I use half duplex full duplex uart? There is arduino library for motor. Can i import in psoc. There are several explanations in servo manual and I'm confused. How to write code for driving simply motor? Thanks..
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can't say about the above said motor but I Have driven a high toruqe DC motor using UART in PSoC and it worked quite well.
Just connect the motor RX-TX pins to the PSoC UART TX-RX pins respectively.
Check your motor datasheet for appropriate code to be sent via the PSoC uart block.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I made the connection for uart but i have problem driving motor. I'm looking datasheet but how can drive it, I don't know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For my motor, there were commands to start/stop the motor .
For instance, to start the motor at 50 RPM speed, I had to send "S50"....& to stop the motor I had to send S0 via UART.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you send me your motor project? So ı can see uart motor example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some precautions have to do.
Please refer page 17, 18
It is say.
1) Do not connect the servo directly to the PC without using
the Motion Controller or Signal Converter.
Even though both PC and the servo uses serial protocol (TXD, RXD ) they are
not directly compatible due to electrical difference. :
So you have to interface with proper RS232 voltage level(12V), Not by TTL level.
2) Servos must be cross connected to the PC or Motion Controller. Examples of cross
connection would be Servo TXD to PC or Motion Controlller RXD, Servo RXD to PC or
Motion Controller TXD. :
So you have to use a cross cable.
3) Interface parameters are correct?
8bit / 1 stop bit/ parity none/ flow control none
Have you a PC Manager Kit?
If you have that do check interfacing by PC before psoc.
Can you check the interface by LED, something , before motor control.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should try first to connect to the motor via your PC, and uye a terminal program to control it. Realterm would make a nice client, since it can take hex values to send.
When you can drive the motor, and know how it needs to be operated, you can start writing a program on the PSoC for it.
Working with the UART is simple. Configure it as full-duplex, with the proper baud rate for your motor. Create a byte (uint8_t) array for your command, fill this array according to the protocol definition of the motor, and then hand it over to the UART.
On UART receive, take the received data and write it into another array. From there you can process the ACK responses.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Additionally I would suggest to measure the voltages at the herculex rs232 pins: I suppose they MIGHT be ttl/cmos-levels (5V) and not RS232 levels (+-12v) as they come from your PC.
When you use a Cypress PSoC3 Kit (-030) you have a serial interface on board that can be jumpered to use any of the forementioned levels, have a look into the schematic.
Programming is not easiy, but programming a device is not more difficult than programming, so concentrate on programming in C, set up your schematic and configure the UART as required in the herculex datasheet and start with reading out the status informations of the herculex.
Happy coding
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The schematic on page 51 of the data sheet shows the interface. There is a MAX3232 driving the PC side, so it using standard RS232 levels (+-12V). So use either a real serial port, or a real USB-RS232 cable (not a serial-TTL to USB converter).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Psoc73,hli,bob;
I edited helper herkulex.h file but I looked uart examples I didn't solve component, so I don't write a code. Example Herkulex datasheet that
ID(253),r(LED Control, Address(0x35) request green led on.
For psoc; UART_PutChar(),UART_PutArray(uint8_t address) like. When I examined herkulex datasheet, I didn't find driving motor address map. I guess I need an example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Either you can't interface with the motor?
or you can't write the programming code?
And can you do check the interface with motor by PC Manager Kit?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i can't write programming code. I can drive whit helping herkulex manager kit but I can not do it with PSoC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Psoc73
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Herkulex motor uses RS232 TTL, from the datasheet -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As you can see, controller side is TTL, PC side full RS232 physical layer -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@TURASGAS.. you said you have problem with programming.....in such cases we mostly have to send certain commands for the motor to work as per our need, and that can be done by simple TX APIs as described in the UART block!!!!!
Page 18 clearly suggests that you have to send a packet in a specified format.
Try this....to send the TWO BYTES OF HEADER...
main()
{
uint16 h = 255; // 0xFF
UART_1_PutChar(h); // first byte of header
UART_1_PutChar(h); // second byte of header
}
Accordingly you can send the rest of the packet contents.
------------------------------------------------------------
Also keep in mind the voltage-level settings as prescribed by others.....Luckily, my motor was TTL compatible...so I could directly connect my motor pins to my PSoC.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set and fix the PSoC nearby motor Or just only use for TEST mode.
It might not be Multi-Drop mode however.
This is show an example connect by TTL mode.
[ http://mbed.org/cookbook/HerkuleX ]
There are so many features and many parameters.
To control this motor, you would like to be use control library.
like this [ http://robottini.altervista.org/dongbu-herkulex-arduino-library-2 ]
If no library for the PSoC, you have to make it.
This is a sample code for basic command.
[ http://www.generalfiles.org/download/gs63e412bah32i0/HerkuleX.zip.html ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Goose, Psoc73
http://robottini.altervista.org/dongbu-herkulex-arduino-library-2 . Before I looked at this site. I need to occur header file for be working this codes. I try to occur header file but get some error or there are some tricks for creating a header file.