Home made encoder

General discussion of using Roboclaw motor controllers
Post Reply
jm7757
Posts: 2
Joined: Tue Jul 11, 2017 4:00 am
Home made encoder

Post by jm7757 »

Hello,

Im new with motor controllers. Im building a vehicule which uses 2 DC motors. I have a roboclaw 2*30 A
I use a arduino mega to try to control them.

My questions are very basic, sorry for that :
Now i can control the power of motors with functions forwardM1 etc but i would like to use functions with Speed Distance etc. So i need encoders. and Ion motion. My problem is that when i release the acceleration the motors stop brutally. I want they decelrate slowly.
Yesterday i used a hall sensor which counts the time for a rotation of the wheel in milliseconds using magnet. So i got the angular speed in rad/s in the Arduino. (the period)
I want to send this information through PWM signal to the roboclaw and after to auto tune the motors so that they can use deceleration slowly.

But how do i wire this ? in the documentation user manual p80, i need send +5 GND EN1A EN1B ;
The arduino is powered through roboclaw ; do i need wire again +5 and GND ? ; my "encoder" hall sensor is only 1 wire : the PWM n° X coming from Arduino

could you advice me please ?
Is there other complete documentation about functions i can use in Arduino ? for example, the functions SpeedDistance : what are the arguments and units ?

I dont understand what is EN1A and B for an encoder.
And sorry again i dont know the difference between absolute and quadrature encoders ((

Thanks so much to help a newbie
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Home made encoder

Post by Basicmicro Support »

All the encoder commands require the encoder be attached to the Roboclaw. A single hall sensor will not produce the required quadrature signals required for the Roboclaw to use the encoder commands.

Im not sure I completely understand what you are asking. It sounds like you want to handle the encoder control through the arduino and just send PWM levels to the Roboclaw. You can do that but that has nothing to do with the Roboclaw encoder system and the autotuning function and encoder based commands will not work in that case.

The Users manual documents all the packet serial commands for the Roboclaw. The arduino library commands are equvilent to each of these packet serial commands(eg one for one).
jm7757
Posts: 2
Joined: Tue Jul 11, 2017 4:00 am
Re: Home made encoder

Post by jm7757 »

thanks for answer

sorry i didnt know what is encoder ; now i read some information and i know little about it.

could this kind of sensor work ?

https://fr.aliexpress.com/item/Free-Shi ... 269.hGB3tv

with encoded wheel
https://fr.aliexpress.com/item/10pcs-lo ... 262.hGB3tv

This detector will make a quadature signal that i would send to EN1A ; if i understand correctly

but EN1B is it absolutelly necessary in Ion motion software for auto tuning ? the direction of movement is not such important for me. In backward motion i can simplify my commands and dont need speed or info from encoder.

I dont have physical possibility to install a rotatory encoder

Thanks for advice or link
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Home made encoder

Post by Basicmicro Support »

Quadrature encoders have two sensors. They have to be spaced so that when the wheel spins it produces the appropriate quadrature signal(the spacing is fairly critical). In general I do not recommend trying to make your own quandrature encoder if you dont know anything about it unless you have experience with electronics and mechanics. if you want position control I highly recommend you get an off the shelf quadrature encoder for your motor.

Post Reply