cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

 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..

0 Likes
Reply
18 Replies
Anonymous
Not applicable

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.

0 Likes
Reply
Anonymous
Not applicable

 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

0 Likes
Reply
Anonymous
Not applicable

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.

0 Likes
Reply
Anonymous
Not applicable

 Can you send me your motor project? So ı can see uart motor example

0 Likes
Reply
Anonymous
Not applicable
        Hi TURASGAS,   
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.   
0 Likes
Reply
Honored Contributor II

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.

0 Likes
Reply
Esteemed Contributor II

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

0 Likes
Reply
Honored Contributor II

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).

0 Likes
Reply
Anonymous
Not applicable

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

0 Likes
Reply
Anonymous
Not applicable
        First of all, Let me know clearly what's you can't.   
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?   
0 Likes
Reply
Anonymous
Not applicable

i can't write programming code. I can drive whit helping herkulex manager kit but I can not do it with PSoC 

0 Likes
Reply
Anonymous
Not applicable
        OK I see, but I must gatta sleep a little, It is sorry, See tomorrow again.   
0 Likes
Reply
Anonymous
Not applicable

 Thanks Psoc73

0 Likes
Reply
Esteemed Contributor

The Herkulex motor uses RS232 TTL, from the datasheet -

   

 

   

0 Likes
Reply
Esteemed Contributor

As you can see, controller side is TTL, PC side full RS232 physical layer -

   

 

   

0 Likes
Reply
Anonymous
Not applicable

@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.

0 Likes
Reply
Anonymous
Not applicable
        Hi, This motor can connect with also TTL UART in next case.   
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 ]   
0 Likes
Reply
Anonymous
Not applicable

 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.

0 Likes
Reply