servo driving
servo driving
Hello,
I am connecting a 360 degree servo on the eb-006 programming board and the servo board. I make a simple flowcode routine that enables the servo component, then it takes a value form a keypad, multiplies it by 15 and then sends it to the servo via the command ''set position''.
Now , the thing is that when I power up the board the servo keeps rotating to the right. At my routine I have an if statement that will only send the value to the servo only if the keypad value is lee than 255.
So why the servo moves?
After when I press num 6 on keypad(6*15), servo seems to freeze and if I keep sending the byte 90 then the routine crashes and I need to reset the board.
When I press 1 or 2 or3 (all * 15) the the servo changes direction and has a littlt variation at the speed.
My concern is, how can I correctly drive the servo via flowcode? How can I make it to be still, no power on it, how can I make it to move at a predesired angular speed or how to set it to advance at a predefined angle and stop?
Note: when I use the same routine but instead of using the ''set position'' parameter in the macro to use the ''auto move'' or ''move to position'', then the servo just keeps on rotaing by it self.
I will attach the fcf file, maby you can test it with your boards and see if you get different outputs.
Thank you in advance,
Best Regards,
Andreas Achilleos
I am connecting a 360 degree servo on the eb-006 programming board and the servo board. I make a simple flowcode routine that enables the servo component, then it takes a value form a keypad, multiplies it by 15 and then sends it to the servo via the command ''set position''.
Now , the thing is that when I power up the board the servo keeps rotating to the right. At my routine I have an if statement that will only send the value to the servo only if the keypad value is lee than 255.
So why the servo moves?
After when I press num 6 on keypad(6*15), servo seems to freeze and if I keep sending the byte 90 then the routine crashes and I need to reset the board.
When I press 1 or 2 or3 (all * 15) the the servo changes direction and has a littlt variation at the speed.
My concern is, how can I correctly drive the servo via flowcode? How can I make it to be still, no power on it, how can I make it to move at a predesired angular speed or how to set it to advance at a predefined angle and stop?
Note: when I use the same routine but instead of using the ''set position'' parameter in the macro to use the ''auto move'' or ''move to position'', then the servo just keeps on rotaing by it self.
I will attach the fcf file, maby you can test it with your boards and see if you get different outputs.
Thank you in advance,
Best Regards,
Andreas Achilleos
- Attachments
-
- Flowcode1.fcf
- (8.5 KiB) Downloaded 362 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: servo driving
Hi Andreas,
I can't test with a real servo, as not got, but thinking of getting a couple.
I looks like you have not set the configuration of the target device up.
I have also changed servo connections from port A to port B
See if this one works any better.
Regards
Martin
I can't test with a real servo, as not got, but thinking of getting a couple.
I looks like you have not set the configuration of the target device up.
I have also changed servo connections from port A to port B
See if this one works any better.
Regards
Martin
- Attachments
-
- Flowcode1_Modified.fcf
- (9 KiB) Downloaded 353 times
Martin
Re: servo driving
Hello Medelec,
I got your program. Thank you for that. I downloaded the routine on my PIC but the lcd and servo board were on the same port B. Of course I changed lcd port to A.
Do you thing that when I powered up the board with to peripherals on the same port caused any problems?
Nevertheless I corrected the routine and sent it again to the PIC but I thing that it does not respond correctly. The servo just rotates in one direction with a full speed lets say. Then when I press 1 is the same, rotates anticlockwise. When I press 2 or 3 then nothing happens, 4 rotates with less speed, 5 even less speed, 6 moves slow, 7 it is just like being still, 8 rotates on the opposite side clockwise, 9 speeds up, 10 more speed, 11 more and zero anticlockwise full speed.
Do you have any clue?
The main job of a servo is to rotate at a specific predetermined angular speed or it can just go and stop at any position we like?
Thank you in advance,
Best Regards.
I got your program. Thank you for that. I downloaded the routine on my PIC but the lcd and servo board were on the same port B. Of course I changed lcd port to A.
Do you thing that when I powered up the board with to peripherals on the same port caused any problems?
Nevertheless I corrected the routine and sent it again to the PIC but I thing that it does not respond correctly. The servo just rotates in one direction with a full speed lets say. Then when I press 1 is the same, rotates anticlockwise. When I press 2 or 3 then nothing happens, 4 rotates with less speed, 5 even less speed, 6 moves slow, 7 it is just like being still, 8 rotates on the opposite side clockwise, 9 speeds up, 10 more speed, 11 more and zero anticlockwise full speed.
Do you have any clue?
The main job of a servo is to rotate at a specific predetermined angular speed or it can just go and stop at any position we like?
Thank you in advance,
Best Regards.
Re: servo driving
Hello,
Check the modified fcf file. I did some modifications in order for the servo to rotate only when I press the keypad and not continuously. The problem is that I cannot make it to rotate at the opposite side but this is not crusial, the most important thing is to make the servo to move to a specified angle and freeze there!
Best Regards.
Check the modified fcf file. I did some modifications in order for the servo to rotate only when I press the keypad and not continuously. The problem is that I cannot make it to rotate at the opposite side but this is not crusial, the most important thing is to make the servo to move to a specified angle and freeze there!
Best Regards.
- Attachments
-
- Flowcode1_Modified2.fcf
- (9.5 KiB) Downloaded 354 times
Re: servo driving
Just a note, i fI make at the calculation icon: keypad=keypad*20 then up to keypad value less than 120 the servo rotates anticlockwise and for keypad value above 120 rotates clockwise and at both situations the servo rotates at different speeds accordingly to keypad value.
The point is to set it to one position and stay there.
The strange is that at simulation it works differently!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
The point is to set it to one position and stay there.
The strange is that at simulation it works differently!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: servo driving
That's odd the servo should have been on port A. Sorry about that. Not a clue how servo got assigned to portBachillis1 wrote:Hello Medelec,
I got your program. Thank you for that. I downloaded the routine on my PIC but the lcd and servo board were on the same port B.

I am trying to look into servos more deeply.
I found this so far:
"A servo motor only has 3 wires, usually red, black and white. Red and black are +ve and ground connections, and white
is the drive connection. Usually a pulse width of 1 mS will make the servo motor to drive from one far end, and 2 mS
to the other end (180 degree). A 1.5 mS will be for middle position. However, bear in mind that every servo motor is different. You have to adjust the pulse
width accordingly."
But since yours is 360 deg not sure if works the same?
Have you got a link to the data sheet of your servo, as it would be easier to derive a flowchart (with servo connected to correct port

Then flowchart maybe created so if you enter a degrees value on the keypad, servo should then rotate to that position and stop. That's the least I can do for posting a flowchart that I had a muppet moment with.
I'm wondering if a pulse of less then 1 ms will make servo move slower?
Martin
Re: servo driving
First of all, Thank you Medelec for your eforts and replies.
Second I could not really answer the above questions of yours as E-BLOCKS and FLOWCODE seems to me that have a mind of their own!!!!!! (sorry Matrix)
What I mean : I download a routine to my e-blocks and for the first and 100th test I get a kind of a result. Then the 101st I try the same routine I get a different output. Then maybe I download a different routine to test other stuff but after if I download to the PIC the routine I was testing before and got a result of A then I get B!!!!
SO my question to my self is that what was the correct program output? The first time that the servo had variable speed or the second time that the servo had the same speed?
That is a puzzle.
Some times I download a routine on a PIC and have a specific output and it happens to lock the e-blocks in my locker and leave it there for a month or so and then I power up the boards and nothing works or even the routine works but with other output!!!!!!!
I tried hundred of routines with different kinds of e-block boards, servo board, rfid board mmc board and I NEVER manage to get the same results after a long series of tries!
I know that the above are not the ones that Medelec would like to hear from me as answer to the post but I had to get then out.
Second I could not really answer the above questions of yours as E-BLOCKS and FLOWCODE seems to me that have a mind of their own!!!!!! (sorry Matrix)

What I mean : I download a routine to my e-blocks and for the first and 100th test I get a kind of a result. Then the 101st I try the same routine I get a different output. Then maybe I download a different routine to test other stuff but after if I download to the PIC the routine I was testing before and got a result of A then I get B!!!!
When I try a routine with flowcode servo component and have a macro that gets the keypad number, multiplies it by 15 and then send the value to the servo; then yes, depending the key pressed the servo was responding with different speeds. BUT, at some point I tested a different routine and when I tried to test that routine again then the servo was responding with the same speed at all key strokes.I'm wondering if a pulse of less then 1 ms will make servo move slower?
SO my question to my self is that what was the correct program output? The first time that the servo had variable speed or the second time that the servo had the same speed?
That is a puzzle.
Some times I download a routine on a PIC and have a specific output and it happens to lock the e-blocks in my locker and leave it there for a month or so and then I power up the boards and nothing works or even the routine works but with other output!!!!!!!
I tried hundred of routines with different kinds of e-block boards, servo board, rfid board mmc board and I NEVER manage to get the same results after a long series of tries!
I know that the above are not the ones that Medelec would like to hear from me as answer to the post but I had to get then out.
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: servo driving
Hi Andreas,
Some of the things you have said in this post worry me and I have not heard of such problems before. We use Flowcode and E-blocks extensively here and do not experience the problems you are reporting. Also, I have not had similar feedback from other customers.
What makes it more strange for me is that you have been using Flowcode (and possibly E-blocks) for quite a while now. Have you always had these problems, or is it just recently? We're keen to sort these issues out, so if you can find some simple steps to show the problem(s) then we'll try to replicate the issues here and hopefully solve them for you.
Some of the things you have said in this post worry me and I have not heard of such problems before. We use Flowcode and E-blocks extensively here and do not experience the problems you are reporting. Also, I have not had similar feedback from other customers.
What makes it more strange for me is that you have been using Flowcode (and possibly E-blocks) for quite a while now. Have you always had these problems, or is it just recently? We're keen to sort these issues out, so if you can find some simple steps to show the problem(s) then we'll try to replicate the issues here and hopefully solve them for you.
Re: servo driving
Hello Steve,
OK, first of all I wouldn't want to say that nothing works with e-blocks!
Yes I am using e-blocks for years now( not full time but some hours per day).
I have had a lot of issues especially with ECIO and RFID. I have bought 4 ECIO's and two ECIO boards. One time the ECIO got burnt, the other time the ECIO just stopped responding, the other time the other ECIO just didn't want to be programmed!!! Also the first ECIO board was not acting as normal, sometimes it could not power up, sometimes one LED was lighted up and sometimes both of them(I know that the lighting of the LEDs depends by whether you choose USB or Board power up of the ECIO) but I am speeking for a situation that all the parameters are the same and the output at different tries is different.
Also the RFID was a BIG disappointment because the range of which it could detect the RFID was only half or one centimeter!!! I think it suppose to have a bigger range? I have a post somewhere about all those including the RFID. Also I tell the RFID board to switch on Mifare detection card and it only detects the I-code and when I tell it to detect the I-code it detects both of them!! Or something like that, I have it on an earlier post that specific issue.
I think I had some issues with the Relay board. I dowloaded the test routine and did not worked at all, but this was months ago. I will test again if you want.
Concerning the servo board how the macro works? When I say to send the byte 200, what actually happens? It manipulates the PWM?
The big issue I have though is to send the same routine and not to get the same result, sometimes without changing the routine, I leave the e-blocks to ''rest'' for month and then when I power up and sent the same routine or continue with the already downloaded, then the routine works!!!!!
.> I was reading before another post that was saying about the regulator being hot and it came to me that I got the same problem. Maybe sometimes that is the root of my problem? Regulator being hot it does not let the PIC behave as it should be? But even still I leave the board to cool down and the problem is stiil there!
Best Regards,
Andreas Achilleos
OK, first of all I wouldn't want to say that nothing works with e-blocks!

Yes I am using e-blocks for years now( not full time but some hours per day).
I have had a lot of issues especially with ECIO and RFID. I have bought 4 ECIO's and two ECIO boards. One time the ECIO got burnt, the other time the ECIO just stopped responding, the other time the other ECIO just didn't want to be programmed!!! Also the first ECIO board was not acting as normal, sometimes it could not power up, sometimes one LED was lighted up and sometimes both of them(I know that the lighting of the LEDs depends by whether you choose USB or Board power up of the ECIO) but I am speeking for a situation that all the parameters are the same and the output at different tries is different.
Also the RFID was a BIG disappointment because the range of which it could detect the RFID was only half or one centimeter!!! I think it suppose to have a bigger range? I have a post somewhere about all those including the RFID. Also I tell the RFID board to switch on Mifare detection card and it only detects the I-code and when I tell it to detect the I-code it detects both of them!! Or something like that, I have it on an earlier post that specific issue.
I think I had some issues with the Relay board. I dowloaded the test routine and did not worked at all, but this was months ago. I will test again if you want.
Concerning the servo board how the macro works? When I say to send the byte 200, what actually happens? It manipulates the PWM?
The big issue I have though is to send the same routine and not to get the same result, sometimes without changing the routine, I leave the e-blocks to ''rest'' for month and then when I power up and sent the same routine or continue with the already downloaded, then the routine works!!!!!
.> I was reading before another post that was saying about the regulator being hot and it came to me that I got the same problem. Maybe sometimes that is the root of my problem? Regulator being hot it does not let the PIC behave as it should be? But even still I leave the board to cool down and the problem is stiil there!
Best Regards,
Andreas Achilleos
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: servo driving
This post is getting a little off-topic, so can I suggest you start new topics for each of these particular issues you wish to take further.
[1] ECIO has only one LED, so I'm confused. Plus the pins on it are unprotected and it needs to be handled like a standard chip - could that be the cause?
[2] The RFID range can be extended by using a ferrite block if required. We were supplied with some faulty RFID modules once, but these would work with only I-CODE cards. Apart from this, we have never had the problems you have described. Plus, it is impossible to put the module in a mode where it can accept both MIFARE and I-CODE at the same time.
[3] The relay board is very simple to work with. I don't know what the problem could be.
[4] Your servo problems are being handled elsewhere. But perhaps you are trying to use the servo component with the wrong type of servo. Our component is designed to work with "R/C servos". The R/C servos that are modified for constant rotation are compatible with the component, but they are used slightly differently. A value of around 128 should cause the motor to stop. Values either side will cause rotation in one direction or the other, with some degree of speed control (not perfect). Direct position/distance control is not possible.
[5] A regulator could get too hot if there are a lot of current-hungry peripherals attached to your board. An a hot regulator could cause your program to become unpredictable. There is an issue with some earlier versions of the HP488 and EB006 which have been dealt with elsewhere in this forum.
[1] ECIO has only one LED, so I'm confused. Plus the pins on it are unprotected and it needs to be handled like a standard chip - could that be the cause?
[2] The RFID range can be extended by using a ferrite block if required. We were supplied with some faulty RFID modules once, but these would work with only I-CODE cards. Apart from this, we have never had the problems you have described. Plus, it is impossible to put the module in a mode where it can accept both MIFARE and I-CODE at the same time.
[3] The relay board is very simple to work with. I don't know what the problem could be.
[4] Your servo problems are being handled elsewhere. But perhaps you are trying to use the servo component with the wrong type of servo. Our component is designed to work with "R/C servos". The R/C servos that are modified for constant rotation are compatible with the component, but they are used slightly differently. A value of around 128 should cause the motor to stop. Values either side will cause rotation in one direction or the other, with some degree of speed control (not perfect). Direct position/distance control is not possible.
[5] A regulator could get too hot if there are a lot of current-hungry peripherals attached to your board. An a hot regulator could cause your program to become unpredictable. There is an issue with some earlier versions of the HP488 and EB006 which have been dealt with elsewhere in this forum.