NXT motor: use as an encoder with removed motor?
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT motor: use as an encoder with removed motor?
According to the RCX rotation sensor schematic, it should be very possible to make it work with the NXT motor port. However, you would need to do some hacking with some pretty tiny parts.
Another option that is related to this concept, is the idea of using a mechanical encoder (probably very low resolution).
Another option that is related to this concept, is the idea of using a mechanical encoder (probably very low resolution).
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT motor: use as an encoder with removed motor?
Just so I understand properly, you have gotten the NXT to run the tetrix controller, but you are not able to read the encoder values back?
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXT motor: use as an encoder with removed motor?
you mean what I can do with the Tetrix controller?
with the Hitechnic Tetrix controller (attached to a NXT sensor port)
- I can start and stop 2 Tetrix motors in power percentage mode
- I can read a Tetrix encoder value when the motors are stopped and no I2C calls are done since a few seconds.
- I can not read Tetrix encoder values when the motors are running, in this case the system hangs completely after a few seconds (NXT blocks and has to be rebooted, batteries have to be removed intermediately )
with the Hitechnic Tetrix controller (attached to a NXT sensor port)
- I can start and stop 2 Tetrix motors in power percentage mode
- I can read a Tetrix encoder value when the motors are stopped and no I2C calls are done since a few seconds.
- I can not read Tetrix encoder values when the motors are running, in this case the system hangs completely after a few seconds (NXT blocks and has to be rebooted, batteries have to be removed intermediately )
Re: NXT motor: use as an encoder with removed motor?
That sounds more like a software problem than a controller issue.doc-helmut wrote: - I can not read Tetrix encoder values when the motors are running, in this case the system hangs completely after a few seconds (NXT blocks and has to be rebooted, batteries have to be removed intermediately )
- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT motor: use as an encoder with removed motor?
I have to agree with Xander, it is almost definitely a timing issue. IIRC, the manual refers to a few second period that is a timeout. It is a safety feature that keeps the motors from running forever if the NXT stops sending commands (as if the NXT program stopped when the motors were running).
Did you try adding wait functions to the program? Are you waiting until the bus is free before attempting to read or write?
Did you try adding wait functions to the program? Are you waiting until the bus is free before attempting to read or write?
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXT motor: use as an encoder with removed motor?
I think it's a firmware issue because I have tried a lot of waits() up to 100ms and even more between each of the I2C commands - no way reading the encoders while the motors are commanded to run and stop intermediately. And of course (!!) I waited till i2cbus=ready or =no error before sending a new command!!
edit: to be more precisely: From the start the encoder values actually CAN be read while simultaneously commanding the motors, even rather quickly with only 5msec Wait() in between - but after 5-10 sec the whole program hangs up, freezes and must be rebootet. Or from time to time (randomly) the motors just keep on going although they should have stopped already long - or the are keeping idle although they already should have been running already long. And after a while the program freezes anyway. It has nothing to do at all with safety-timeouts: All is fine with the motors if I don't read their encoders intermediately/simoultaneously.
We've been discussing this issue already lots of times and no other commands than those (actually very simple and clear ones) that I already got are available. Nevertheless they apply 100% to the I2C commands table published by Hitechnic.
I sacrificed ths issue meanwhile and it's not the issue of this topic . (You're definetly not forbidden to read about it at the related threads and discuss it THERE - suggestions appreciated! The complete Tetrix test code is already published in the other threads!)
But getting a NXT encoder running without motor at the motor ports (either a NXT motor without motor, or a RCX rotation sensor) - or both a NXT motor and a Tetrix motor with an op amp altogether - is on-topic and I'll be glad to read some solutions HERE.
Thanks for contributing!
;)
edit: to be more precisely: From the start the encoder values actually CAN be read while simultaneously commanding the motors, even rather quickly with only 5msec Wait() in between - but after 5-10 sec the whole program hangs up, freezes and must be rebootet. Or from time to time (randomly) the motors just keep on going although they should have stopped already long - or the are keeping idle although they already should have been running already long. And after a while the program freezes anyway. It has nothing to do at all with safety-timeouts: All is fine with the motors if I don't read their encoders intermediately/simoultaneously.
We've been discussing this issue already lots of times and no other commands than those (actually very simple and clear ones) that I already got are available. Nevertheless they apply 100% to the I2C commands table published by Hitechnic.
I sacrificed ths issue meanwhile and it's not the issue of this topic . (You're definetly not forbidden to read about it at the related threads and discuss it THERE - suggestions appreciated! The complete Tetrix test code is already published in the other threads!)
But getting a NXT encoder running without motor at the motor ports (either a NXT motor without motor, or a RCX rotation sensor) - or both a NXT motor and a Tetrix motor with an op amp altogether - is on-topic and I'll be glad to read some solutions HERE.
Thanks for contributing!
;)
Re: NXT motor: use as an encoder with removed motor?
I have used an external encoder that works off the Lego Motor Port. Check out https://sites.google.com/site/encodernxt/ for a write up I did some time ago.
It is a regular encoder manufactured by CUI that just happens to match up almost perfectly with Lego technic beams and axles. The best part is it has much higher resolution (up to 4096 counts per rev) vs. the Lego 360 counts per rev. In fact (or someone correct me if I'm mistaken), any 5V TTL encoder would work connected on the Lego Motor Port.
As an aside -- The encoder counting is done via interrupt routines on the NXT brick, that is why it can handle higher resolution encoders -- but there is some physical limit (encoder counts per second) that will cause a loss of encoder counts AND / OR cause the program execution time to increase and I have no idea what that limit is!
-Charlie H.
It is a regular encoder manufactured by CUI that just happens to match up almost perfectly with Lego technic beams and axles. The best part is it has much higher resolution (up to 4096 counts per rev) vs. the Lego 360 counts per rev. In fact (or someone correct me if I'm mistaken), any 5V TTL encoder would work connected on the Lego Motor Port.
As an aside -- The encoder counting is done via interrupt routines on the NXT brick, that is why it can handle higher resolution encoders -- but there is some physical limit (encoder counts per second) that will cause a loss of encoder counts AND / OR cause the program execution time to increase and I have no idea what that limit is!
-Charlie H.
Re: NXT motor: use as an encoder with removed motor?
A very interesting device you found, and not too expensive. One little down side is that it is 1mm too thick for LEGO...cghaning wrote:It is a regular encoder manufactured by CUI that just happens to match up almost perfectly with Lego technic beams and axles.
Any should work indeed.In fact (or someone correct me if I'm mistaken), any 5V TTL encoder would work connected on the Lego Motor Port.
Philo
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXT motor: use as an encoder with removed motor?
Here are a couple pictures you may find useful:
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXT motor: use as an encoder with removed motor?
thank you, I know these pictures, and of course I would attach the Lego "motors" as encoders (without motors ) exactly this way. But with motors still in the housings the friction is too strong.
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests