OpenServo.com Forum Index OpenServo.com
Discussion of the OpenServo project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Encoder feedback
Goto page 1, 2  Next
 
Post new topic   Reply to topic    OpenServo.com Forum Index -> Software
View previous topic :: View next topic  
Author Message
cweeks



Joined: 21 Jun 2007
Posts: 9

PostPosted: Sat Nov 03, 2007 4:13 pm    Post subject: Encoder feedback Reply with quote

Hi all,

I have read on this forum that some code has been started with optical encoder feedback in mind and I am interested in it's current status.

I have a project that would really benefit from an optical encoder for feedback rather than a pot. It's a piston ballast tank on a model sub, basically it's a linear servo that will use a lead screw and have a travel of about 200mm. A 10th of a turn resolution on the screw would be enough, 20th of a turn resolution would be amazing, and flat out RPM will need to be around 600RPM.

Using a 2mm lead screw 10th of a turn accuracy gives a .2mm resolution on the piston and a traverse time of 10 seconds.

I think I talked to Ginge a little while ago about this, but other projects got in the way and I never bothered him to get the code. But this project is back on the burner again so here I am open handed Wink

Any help appreciated.

Cheers, Cam.
Back to top
View user's profile Send private message
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1029
Location: Manchester, UK

PostPosted: Sat Nov 03, 2007 6:20 pm    Post subject: Reply with quote

Hi Cam,

cweeks wrote:

I think I talked to Ginge a little while ago about this, but other projects got in the way and I never bothered him to get the code. But this project is back on the burner again so here I am open handed Wink


I understand completely. I have been busy with the new V3 branch as of late so I have not really had time to continue the work on the encoder support. I would love to get back to the encoder functionality, but at the moment I am without any version 3 hardware.
Why not use a version 2 hardware you might ask? The version hardware was clocked at 8MHZ, and this low speed was the reason that I never completed the functionality of the encoder tracking. The V2 is just not fast enough to track the pulses in real time, leading to lost pulses and nasty things happening.
The newer V3 uses a faster 20MHZ xtal, so is more than adequate for the tracking the pulses.

As soon as I get some new hardware, I can pick up development and start looking back at the work I have previously done. It won't be a massive port to get everything working again, but it will require that I make a Frankensteins monster of an OpenServo to accommodate the encoder tracking.

Just out of curiosity do you know what sort of encoder are you going to use?

Cheers,

Barry
_________________
http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
cweeks



Joined: 21 Jun 2007
Posts: 9

PostPosted: Sun Nov 04, 2007 6:01 pm    Post subject: Reply with quote

Dummy post so I can post some urls
Back to top
View user's profile Send private message
cweeks



Joined: 21 Jun 2007
Posts: 9

PostPosted: Sun Nov 04, 2007 8:49 pm    Post subject: Reply with quote

No the board isn't letting me post urls, guess I have to wait two days after my second post ?
Back to top
View user's profile Send private message
cweeks



Joined: 21 Jun 2007
Posts: 9

PostPosted: Sun Nov 04, 2007 8:51 pm    Post subject: Reply with quote

Thats good news, thanks for taking the time to explain the situation, looks like I will have to get myself some V3 hardware to. I notice at http://pendragonrobotics.com/OpenServov3.html that they aren't currently available, is there another source, or am I making it myself ?

Ultimately I will probably need to remake the board with more current
ability as the piston tank will need a fairly beefy motor, 380 or 540 sized, but for testing the normal servo board would be a starting point, then again it depends how you connect the quadrature encoder, and how much butchering the standard board needs, or not.

Haven't decided on an encoder yet, was going to have a flick through the Farnell catalouge, maybe etch or print a disc, or possibly use something like is shown here:

http://www.portlandrobotics.org/index.php?id=77

Does the v3 hardware use the same programmer ? Ive got a OSIF V1.0 USB board.

And finally this is a commercial piston tank:

http://www.engel-modellbau.de/catalog/product_info.php?cPath=2_29&products_id=506&osCsid=a8533928c175a910c9e99d6f2945a462

Thanks again, Cam.
Back to top
View user's profile Send private message
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1029
Location: Manchester, UK

PostPosted: Sun Nov 04, 2007 9:28 pm    Post subject: Reply with quote

Hi Cam,

I believe that we are waiting for some more orders to get the v3 manufactured. I am going to place an order this week for 50 for the OpenServo webshop, and jay informs me that they will be ready within a couple of weeks after that.

I think you are correct that you will need to remake the board to suit your needs. It would certainly be worth doing, and something we can all help you with. I will get the finer details hammered out (MCU connections etc) and then we can go from there.

The homebrew encoder you linked to is the system I was using for the v2 hacks I was playing around with. I think I will revisit this hacked up servo for the encoder testing.

As for your OSIF question... yes, the v3 it uses the same programmer. You will need a generic AVR programmer to get the bootloader into the OpenServo, but from there you can upload the firmware and control the V3. If you have an AVR programmer, you can upgrad your firmware to the new OSIF v2 branch, which has faster comms and AVR flashing capability.

Cheers,

Barry
_________________
http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1029
Location: Manchester, UK

PostPosted: Mon Nov 05, 2007 12:47 am    Post subject: Reply with quote

Hi Cam,

I went ahead and made the modifications to the fried v3 I have to see how much work is needed to make play nicely, and it is fairly insignificant.

The encoder support relies on using an external interrupt pin for tracking one channel (channel A) of the quadrature input, and another pin for tracking the second phase (B). The current incarnation of the v3 hardware ties up both of the interrupt lines for use as the bridge driver hardware (Enable A and Enable B) which means we have to cut one of those traces and reroute it to another pin. This is very tricky because of the current size of the PCB, meaning it is easy to destroy the board.

The good news is that I have working encoder tracking working, at least in the most simplistic form. At the moment the pot is read for the initial position, and then the encoder is used to calculate the position and velocity from that point.

There are a few things that are going to make this a tricky feature for people to use in their own hardware, such as your ballast driver, as the encoder will have to be calibrated for the number of pulses per full range output.

Another thing that is going to be tricky is hardware without the dead reckoning potentiometer to get a position on startup. Unless the hardware always starts in a known good position, there is only one other way of telling the OpenServo where the servo horn currently is, which would be to turn the motor until it hits its endpoint. At this point you can detect the current draw to determine if it is at the end of its travel, or use a switch to detect the home position. This could be potentially dangerous depending on the application.
I am assuming your hardware won't have the potentiometer to get this initial input, so I am unsure as to how we should go about handling this potentially dangerous situation. Thoughts?

Barry
_________________
http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
cweeks



Joined: 21 Jun 2007
Posts: 9

PostPosted: Mon Nov 05, 2007 7:14 pm    Post subject: Reply with quote

Hi Barry,

In my enthusiasm I hadn't stopped to consider the finer points, i.e. the starting position. I see a couple of ways to get the starting position.

1) I could add a pot to the design, linear ones are out as I can't find a one with 200mm stroke, if I could there would be no need for the encoder, it would probably work fine as the only feedback source. I could use a multi turn pot driven by a gearwheel off the lead screw but this seems like an ugly solution, it will be bulky and tricky to implement, I'll have to machine the gearwheel etc.

2) An end stop switch would be fine for my particular need, as you say just run the servo up to the stop on start up. It wouldn't cause me any concern. I guess for you guys using them in robotic creations you have far greater concerns about un-coordinated movements towards end points. Maybe implementing both alternatives in the code would cover everyones needs ?

I don't mind having a bash at the PCB design, It will only be single sided through hole as thats all I can manufacture at home, but it might work as a starting point should another want to make it smaller. I can program AVR's to so that's no problem. So I can get started can you confirm you have used pins 1 (EN_A) and 32 (EN_B) for the quadrature inputs ? And what pins have you connected EN_A and EN_B to instead ?

Cam.
Back to top
View user's profile Send private message
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1029
Location: Manchester, UK

PostPosted: Mon Nov 05, 2007 8:24 pm    Post subject: Reply with quote

Hi Cam,

It isn't really important which pins you use for the encoder as long as one channel has a connection to the interrupt pin. For simplicity I remapped ENA to pin 30 (PD0/RXD) you could use pin 12 (PB0) for the locater switch. If you wanted to keep the serial lines free for future use, you can use PD5 and PD6 for the encoder channel B and the switch. It is very simple to remap these in firmware, so the choice is yours.

To summarise:
Encoder channel A - pin 32 (PD2)
Encoder channel B - pin 31 (PD1)

Barry
_________________
http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
cweeks



Joined: 21 Jun 2007
Posts: 9

PostPosted: Tue Nov 06, 2007 1:51 am    Post subject: Reply with quote

OK, got ya. After I have done a little research into finding none SMT alternatives to some of the IC's used in the current design, and I have designed my PCB I will let you know.

Cam.
Back to top
View user's profile Send private message
cweeks



Joined: 21 Jun 2007
Posts: 9

PostPosted: Sat Nov 17, 2007 5:47 pm    Post subject: Reply with quote

OK I'm struggling to find an none smt alternative to the SN74CBT1G125, would a 4066 with a diode to protect it's input from the negative going spike be acceptable. The 4066 has a higher Rds but it's still orders of magnitude lower than the impedance offered by the voltage divider, what you guys reckon ?
Back to top
View user's profile Send private message
ginge
Site Admin


Joined: 14 Jan 2006
Posts: 1029
Location: Manchester, UK

PostPosted: Sat Nov 17, 2007 5:51 pm    Post subject: Reply with quote

I just got some of these Hamamatsu p5587 photoreflectors

http://www.active-robots.com/products/sensors/sensors-hamamatsu.shtml

It has all of the bits in it to directly interface with the AVR. I will hook it up and let you know how it goes.

Barry
_________________
http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
cweeks



Joined: 21 Jun 2007
Posts: 9

PostPosted: Mon Nov 19, 2007 10:10 am    Post subject: Reply with quote

They look ideal, little, cheap and easy to interface. Will get myself some, cheers for the tip off.

Cam.
Back to top
View user's profile Send private message
subculture



Joined: 13 Aug 2006
Posts: 15

PostPosted: Mon Dec 24, 2007 1:04 pm    Post subject: Reply with quote

There are commercial controllers available for piston based submarine dive tanks.

They use hall effect sensors instead of optical sensors.

Markus Rieger sells a board which can control motors upto 30A, and Christian Feldman makes a smaller board for up to 5A motors.

Andy
Back to top
View user's profile Send private message
cweeks



Joined: 21 Jun 2007
Posts: 9

PostPosted: Mon Dec 24, 2007 9:41 pm    Post subject: Reply with quote

Thanks for the info, do you have links for them ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenServo.com Forum Index -> Software All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group