Speed sensor

I wanted to use two separate current sensing IC’s one for each motor instead of the one from the elektor design. Günter Gerold connects these to a separate Atmega168 and I connected mine in the same way so that i could also use his Bascom software for this secondary processor.

The elektor design has the ACS755 SCB-100 current sensing IC which is now obsolete. So instead I used ACS758 SCB 100 which is compatible to this one, and i used two of these.
Maybe it would have been better to use ACS758 SCB-50 to get more accuracy but i had two 100 amp units lying around.
The Atmega168 talks to the main processor board via I2C which is the reason that the SCL and SDA connectors have been brought out to the RS232 connector on the main Zzaag microprocessor CPU..
In the picture on the left you can see the additional Atmega168 which is interfacing with both the gearsonsors and the current sensors.
At the top left you can see the connector which attaches to the main microprocessor PCB and the FDTI programming connector.
The connectors at the bottom left are those for the gearsensors themselves.

The software is essentially the same as on the Gerold – Elektronik website except that two LEDs have been added which blink each time an interrupt is received from the geartooth sensors. The LEDs are connected to PB4 and PB5 respectively. This rather simplifies debugging asthe LEDs visualise if the program “sees” the geartooth sensors. The software caters for sensors of the type ATS667 or ATS665 which do not have sense direction but also the ATS657 which has direction sensing onboard. I have experimented with both the ATS667 and the ATS657 with thanks to Allegro who did send me samples.
I finally ended up using the ATS657 because of the direction sensing that this chip has.
The software is written in Bascom but is small enough to be usable in the freeware Bascom compiler. So there was no reason to change this to Arduino and i left it as is.
Below is the circuit diagram of the additional hardware. You can see the gearsensor connections and the current sensing ACS758 SCB-100.
As previously said the software i used for the gearsensor CPU was almost identical to that of Gerold – Elektronik. It is compiled using the freeware bascom compiler. This creates a HEX file which can be loaded into the Atmega168 using avrdude in the same way as programming a new bootloader into an arduino. I use the very nice YCIT GUI which you can download from here. A picture of the settings can be seen on the left. In the three pictures below you can see the geartoothsensor circuit boards. The one on the right is the ATS667 mounted in place on the motor in the same way as on the Gerold – Elektronik website. I used a small piece of board to mount the device on. You can also look at the Gerold – Elektronik website to see how it can be mounted. In the article WheelieGT Elektor also did an article on the subject with very good description as to how to mount etc.
The two pictures below on the left show the ATS657 circuit which is copied from the Elektor Wheelie forum. I simply wired this on a small piece of veroboard and it worked without modification. In order to test this software you can connect the I2C connection to the main Zzaag CPU via the 2 * 5 connector and run the following arduino program on it which visualises the data.

Below is the data from the gearsensor.pde program.
The data is coded as follows:
Byte 1 and 2: Speed left
Byte 3 and 4: Speed right
Byte 5 and 6: Current left
Byte 7 and 8: Current right
Byte 9 Bit 6: left Direction
Byte 9 Bit 7: No Direction Flag left
Byte 9 Bit 3: right Direction
Byte 9 Bit 4: No Direction Flag right
In the screenshot of the output on the right you can see the impact of turning the wheels by hand backwards B and forwards F. The word None means that between turning forward and backwards there was no direction flag set. You can also see in the first four bytes the speed of both wheels.