Today was a great day, just a simple motor test but I'm very happy, all 4 channels are working fine and it's nice to have a laptop making something move.
Used nScope to generate pwm and to check the encoders and the current sense output.
Each channel will need :
- 1 interrupt pin (mixed encoders)
- 1 analog input pin (motor current)
- 1 pwm out pin (motor speed)
- 1 output pin (direction)
That's 16 pins for the motor driver only, and I have other sensors (distance, compass...) and motors (pan/tilt,...) to connect. So the motor driver need it's own µcontroller with a serial interface connected to the Photon, using only two pins.I've found Marco Forgione, position PID controller project will be a great starting point. He has the 2 channels version of the chassis, so I'll have to synchronize the two motors for each side. The nice feature here is to send a command like "Forward 10cm" over serial and have the dedicated µC handle the rest.
Using two more pins for powering the driver board logic side and the driver power side trough relays, an Atmega328 will have no pins unused !
That will be a mess of cables too, I'll try to put a first layer on the chassis with the batteries, driver board and the motor controller.