Hi Gert,
I'm using Gertbot to control a DC brushed motor with Quadrature Encoder. It is stated in the Gertbot manual (page 44) that "Just as with the stepper count the three bytes make up a 24 bit signed number in the range of –4194303 to +4194303." But a 24-bit signed number should be in the range of –8388607 and 8388607 right? I have read the value from the encoder and always get value between –8388607 and 8388607, so I'm not sure it's correct or not.

I think I have enabled the encoder but I can't work out how to read them.

You must use the 'quad_read' command. See the example usage in the test_driver.py code.

Where could I download the file "test_driver.py"? I could not find it on Gertbot's website. Is there any C or C++ version of it? Thanks!

The python test code test_driver.py is packed together with the python drivers: https://www.gertbot.com/updates.html
On that same web page you find the 2.6 C drivers which have support for the quadrature encoder. e.g. https://www.gertbot.com/gbdownload/rev2 ... rs_2.6.zip.
The C drivers also have example code in them: test_gb_drivers.c.
I just noticed that I have not uploaded the GUI source code for version 2.6. I will see I will see if I can do that soon as
that has working code for the quadrature encoders in C++. (But it will take a bit more effort for you to find and extract that.)

Post edit: latest BETA code uploaded: https://www.gertbot.com/gbdownload/src/ ... rc_2.8.zip
Beware this is the very latest GUI with support for ramping up and down the speed of the stepper motors. A feature in the Gertbot 2.8 code which has not been released yet as I have not yet written and tested the drivers. (The code on the Gertbot seems to work)

What's exactly the position value?
The position value read from "quad_read" command is said to be in a range of –4194303 to +4194303, but I don't really understand what it is. For example, I'm using a gearbox DC brushed motor with 64 CPR encoder and the gear ratio is 50:1, meaning the resolution is 3200 CPR. As my understanding when I read from the quadrature encoder, the ouput value should be in the range of 0 to 3200 or (-1600 to 1600), but here it returns different values. Could you please explain this to me? Thank you in advance!

Another question is about "quad_goto()" command. I used this command with different duty_cycle values with the same position and I realized that the motor did run faster or slower according to the duty_cycle but it did not move to that same position. As specially when I set duty_cycle equal to 30 or lower, the motor runs like forever. This is very weird.

Hi Gert,
Thank you for your reply!
By the way, when I built the GUI on Raspberry Pi 3 I always encountered this error: "gertbot.h: error: 'usleep' is not declared in this scope ...". So I just added this line " #include <unistd.h> " to the file "gertbot.h" and then remake and it worked. I don't know whether other people get the same problem but it works for me. Hope it help!
I have tried the gertbot_GUI version 2.8 and played around with the quadrature mode. There are some weird things that I noticed:
- If I don't turn on the Min-on and Max-on, the motor does not move to the target position. Either it does not run at all or stops after very short time.
- When Min-on and Max-on are set, everything works fine if the duty cycle is 100.0. However, if I set duty cycle smaller than 100, say 80 or 50, then the motor still moves in the same direction but it does not stop at the target position. It even passes the maximum position that I set before. Same thing happened when I implemented my own program with commands quad_read, quad_limit, etc.

Ok so I should not use it with low speed, but it should work ok for normal speed, right? But the position values that I read from the encoder sometimes fluctuate even when the motor runs at normal speed and in the same direction.

Do you get errors?
The Gertbot increments an error counter when it detects an illegal transition |(e.g. 00 to 11 is illegal)
If so, the most likely cause is that the code changes faster then the 1000 Hz max speed.

Hello Gert,
I have recently bought a Gertbot but it seems not to be working. Despite carefully following instructions of connecting DC motors, I can't control them. Rest of the board, though, seems to be OK - it communicates with GUI, I can use GPIO pins.
I thought it was caused by the version difference between board software (it came to me with revision 2.3 installed), and GUI/python drivers. However, after updating Gertbot to 2.6 it still doesn't work.
I am a newbie in electronics, so I might have made some stupid mistakes.
Thank you in advance for your help, and I apologize for my imperfect english,
Bogdan

So that's the 'stupid mistake' I was talking about. I was trying to use 6v power supply, since it is my motors' maximum voltage.
Thank you for clarification!
May I ask, is there any way to use my motors with Gertbot?
Thanks for help,
Bogdan

What would also be possible is to use a higher voltage (8V) and then make sure you do not exceed a
certain mark space ratio (75%).
It is a bit more dangerous, but technically perfectly safe, (I know that sounds contrasting).
The reason why it is safe, is that the Gertbot duty cycle is done in hardware. So no matter
what happens in the SW it will NOT suddenly be stuck permanently high.
The reason why it is dangerous: you must make sure you do not accidentally program
a duty cycle above 75%. Your average power (heat produced) will be the same as for 6V.

Additionally you can reduce the current by using a high switch frequency as the motor will start behaving more
like an inductor (coil).

When I implemented my own code, the same problem happened. If I call the quad_read without calling quad_limit before it then the motor does not run. Is there any problem with the driver files also?
By the way, I found the reason for all the problems which I mentioned in previous posts. It is I set the duty cycle too high so the motor runs too fast compare to the reading speed of the encoder. This can be checked by running the GUI and enter the quadrature mode, then run the motor and come back to quad mode and click read continuously. If the error is non-zero then the motor is running too fast (this is already mentioned in the Manual but without the new version of the GUI, I cannot check it). Thank you very much for the new version 2.8 and all of your support!

I am really struggling with my gertbot - it seems no matter what I do I always end up finding no boards when I run the gertbot gui. I *think* I have /dev/ttyAMA0 correctly configured - if I connect pins 8 and 10 with a wire I can use minicom and see things echoed - is that enough to be confident the serial connection is OK? I have a pi 3 (with enable_uart=1, and dtoverlay=pi3-miniuart-bt in the /boot/config.txt file)and am running the latest raspian. I do still have wifi, could that be something to do with it? My gertbot has a red flashing light which is on for a second, off for a second - I assume that is the heartbeat? The voltage across the board is 12.4V, so I think I ought to have power. Can anyone suggest anything else I could try as I have pretty much run out of ideas. I was hoping to use the board for our piwars entry and so I need to get things going asap! I'm in Cambridge, if there are any pi wizards nearby I'd be very happy to show you what I have.

Dear teapot418
You are not the only one struggling with the UART on the Pi3.
Shows again how one bad design decision can cause so much havoc!

I also have lost track of what is going on.
You are right in that if wifi still works you have something wrong.
The gertbot really needs the actual mini-uart to work.

I think there is a UART bit-bang driver which works with minicom but not with the
gertbot as the gertbot driver makes a lot of changes to the TTY settings (echo, cbreak, delay etc.)

I am booting up a Pi3 with gertbot as we speak and have another check of all the things I have done.
(Of course for me it works)

Have booted am looking at my config.txt.
It seems something has changed so I have to update the gertbot web page how to get the uart working.
I have:
dtoverlay=pi3-disable-bt
enable_uart=1
core_freq=250
Nothing else related to the uart.

I have just updated the gertbot/pi3.html webpage with these new instructions.Please let me know if it has solved your problems!!

thank you for responding so quickly - I'm afraid the config options you suggested have not helped in my case. I too have lost track of what I have tried - I probably haven't helped by putting an SD card that was originally set up using a pi2 into my pi3. I will start again with a completely fresh NOOBS install of stretch, see whether that helps. That will have to wait for another day, but I will be sure to let you know how I get on.

In the latest image (stretch) the qt4 libraries are no longer present.
This gives the following error message: error while loading shared libraries: libQtGui.so.4: cannot open
shared object file: No such file or directory
I have placed copies of the missing the qt4 libraries on my website with instructions on how to download and install them:https://www.gertbot.com/updates.html

It worked for me but let me know if you have problems as I have been on this for some hours
and I might have missed a step somewhere.

I also tried getting the Pi3-UART working from a new (stretch) image.
Again the gertbot website https://www.gertbot.com/pi3.html has the instructions which worked for me.