Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

Automation, sensing and robotics • Re: Programming a shipmodel and transmitter continued 2.0

$
0
0
Hello Ame,
Well, that is interesting. I thought that the coils can only be active for a certain percentage, not hold at any given point. That sure would make my life a lot easier because the way I layed out the engine room the NEMA steppers are hugely in the way for the drive shaft. That could be solved be making a different gear for the stepper, up to a 1:2 gear ratio making a 1,8 degree NEMA almost as accurate as the current steppers, but that would still mean lots more work to do and still a challenge in this smaller part of the hull.
If you are worried about external forces pushing back you could use a worm gear. This has the advantage of high torque, and can hold position without power.

You also don't even need a stepper. You can use a DC motor. You have basically designed a servo. The output is reported by a sensor, not by the number of steps.

Having said that, you have something now. It might be adequate, and it might not be necessary to change it.
Since I had the first attempt sail with the steering controlled by a standard servo I'm not worried about the external forces, a worm gear will slow the rotation down considerably which will cause issues for the maneuverability.
That's not why I suggested it. You said "I thought that the coils can only be active for a certain percentage, not hold at any given point". The coils can be active all the time, and hold a position. But they will use power. I suggested a worm drive because when you remove power it will retain its position.

Yes, it's slower, but the real ship doesn't do things very quickly.

Funny that you mentions not needing a stepper, just before reading your post, the same thought came up in my head as well. I will be investigating this option. Now thinking about it I will drop the steppers for the crane control in favor of reduction motors. I already have some 30-50 off those laying around connected to the PWM modules. It might also be easier for steering the azimuths as well, at least I don't need to deal with if/elif statements to control the direction anymore, since negative values are rejected by stepper motors whilst motors are controlled with a value between -1 and 1, and accepting values with at least 5 decimals (I tried).
I suggest you ignore everything else except propulsion and steering.

Also, this statement is nonsense: "I don't need to deal with if/elif statements to control the direction anymore, since negative values are rejected by stepper motors whilst motors are controlled with a value between -1 and 1, and accepting values with at least 5 decimals (I tried)". It's clear you don't understand the chain of events between a command being received and action being caused. Since you are fully in control of the software the motors will do what you program then to do.

I will try to make a working code with the AS5600 as feedback, if that's easy enough I will convert to using reduction motors. The added benefit is that, using 100RPM motors, the azimuths can pretty much keep up with the rotation of the joystick, something that will be impossible with steppers. I can always come back to my current setup anyways. Though it is true that what I have now will probably work fine, I'd rather miss my aim of sailing on juli 13 if that means that I don't need to modify the propulsion afterwards.
Your program should literally be:

Get desired angle from controller.
Read current angle from azimuth sensor
Calculate direction of step to change current angle to desired angle
Take one step in that direction
Repeat

Statistics: Posted by ame — Wed May 14, 2025 9:29 pm



Viewing all articles
Browse latest Browse all 8082

Trending Articles