Page 1 of 1

Help with home position

Posted: Sat Feb 27, 2021 8:30 am
by Cittadini
Dear Sirs

I want to use the Roboclaw Solo driver with a home position made with a magnetic swicth .
I can configure all (S2 for encoder enable / disable , and S3 for home position )
So I need that S3 ( home position ) only works when I power up the driver ( one time )
How I can configure it ?

The problem is that every time my motor rotates ,magnetic swicth made stop my motor ....
For me home position is only to use as a reset for the first time I power up the system


Thanks in advance

Re: Help with home position

Posted: Fri Mar 19, 2021 12:20 pm
by Basicmicro Support
Unfortunately we do not offer a mode like you describe.

Re: Help with home position

Posted: Sat Mar 20, 2021 9:02 am
by felix
WARNING : I never used a roboclaw Solo, and I haven't checked the voltage levels for the switch pin : you might need to use a level shifter or a voltage divider in order to avaoid to destroy you board

One hack could be to transform the switch into a "virtual switch" that is only active once after startup : that way, when you pass it a second time, there will be no signal sent to the roboclaw, and therefore it will not act (nb : I don't know if the roboclaw "know" the position of the switch and will still stop).

The easiest way to do that is probably with an arduino (lets suppose the switch provides 5V when activated, 0V when not activated).
Connect the switch to a digital input pin, and the S3 pin to a digital output pin

Then in the setup, you can have a code like this :

Code: Select all

while (digitalRead(switch)==0)   //wait for initial home
{
digital_write(out,LOW)
}

digital_write(out,HIGH)   //switch just got activated for the first time
while(digitalRead(switch)==1)
{
//do nothing
}

digital_write(out,LOW)


and an empty loop
Note that you can also replace the second while by a fixed delay


If you prefer, it should also be possible to get the same feature without a microcontroler, using some digital integrated circuits (latches, logic gates, ...) : It would require a bit more thinking, let me know if you want to go in that direction