2019-11-04

2019-10-27 OrangeBot Test Four Motors

>>>OrangeBot - Pi Wars 2020 Page<<<

>>>Prototype Board and Test Four Motors<<<

 



1Electronics

Previously an AT4809 with a VNH7040 combo has been tested in Option 1 configuration with the IG32-05 motors. Option 1 entails providing PWM on the VNH7040 PWM pin and using INA/SEL0 and INB for direction control and brake.

Illustration 1: Test AT4809 + VNH7040
Design is to be scaled up to four independent motors to prove the feasibility of “OrangeBot” design.


2VNH7040 Option 2 Configuration

Option 2 configuration consists in wiring the microcontroller PWM signal to INB in theory giving the remaining signals a more defined meaning like direction and enable.
This configuration has been tested to no avail. OPTION1 configuration is the way to go.





3AT4809 Pin Allocation

The first task is to allocate the pin function for the AT4809 microcontroller.
This has been an highly iterative process, involving preliminary PCB layout and allocation of resources of the microcontroller.
After much thinking, this is the version 4 of the allocation table for the pins.

Illustration 2: Pin Allocation Table V4


3.1VNH7040 PWM

The most obvious problem is the generation of four 20KHz PWM signals.
There are two options:
  1. Use the only timer type A TCA0 as six channel 8bit PWM generator
  2. Use all four timers type B TCB0 to TCB3 as 8bit PWM generator
Initially option 1 was chosen. Now because of other constraint, option 2 has been chosen. Relevant contiguous pins have been allocated to the VNH7040 PWM pin.

3.2VNH7040 SENSE

Four ADC pins have been dedicated to the four driver sense pin.
A pull down resistor will be required.
TODO: Test sense functionality.

3.3Encoder

Initially the hope was to use the four CCL LUTs combined with four timers type B to decode in hardware four quadrature encoders.
This is not possible because timers type B cannot be made to count external events.
As fall back, all encoder pins have been wired to the same port and an interrupt will be used to update all encoder counters on any edge event on any of the pins. There will be a limit on the frequency of the encoder channels that can be decoded.

3.4Servo

Current idea is to use a dual 5V3A buck generator and have four servo channels on the board. The timer type A can be used to generate the servo PPM modulated signals, so it has tentatively been assigned there. This can change.

3.5I/O

Remaining pins are generic software controlled I/Os and have been grouped in fast switching and slow switching. slow switching signals are wired to the pin banks that share the supply of the ADC as to limit noise injected somewhat.


4Prototype Board

To scale up the design to four motors, wirings have been moved to a prototyping board for reliability.

Illustration 3: Prototype Board Architecture
The architecture calls for a central board to host the AT4809 evaluation board with its onboard programmer disabled and an external connector for the UPDI programmer, Four evaluation boards for VNH7040 motor controller and connectors for four motors, four quadrature encoders and 5V power.
5V is provided by a separate evaluation board for the TPS55386 dual buck regulator which powers the AT4809, the encoders and the Raspberry Pi.


4.1Layout

All components fit a standard prototype board. Basic safety features have been included.

Illustration 4: Prototype Board Layout



Features:
  1. XT60 power connector from battery/power supply
  2. Power connector to dual buck regulator TPS55386 5V3A
  3. 5V power switch to microcontroller and encoders
  4. 10A fuses and power switches to the motor drivers
  5. AT4809 Curiosity Nano evaluation board
  6. UPDI programmer connector
  7. Power connectors to four DC motors. Connector to four quadrature encoders.
  8. Four VNH7040 motor drivers
  9. Dedicated power wires VNH7040 motors and supply


4.2Power Test

Power up the board one piece at a time and debug all wiring issues. Test the UPDI programming of the AT4809 and the signals to the VNH7040 bridges.

Illustration 5: Power Tests
A number of LEDs have been used to check power status of the various voltage rails.



4.3Individual Motor Test

Program the microcontroller to test each motor channel individually with a ramp in both directions.

Illustration 6: Individual Motor Channel Test
As part of the MVP strategy, sense and encoder channels are not wired yet, as each hardware and software feature will be added and tested only when all previous modules sufficient for operation demonstrate to be operational.



5Platform Test

Tested the operation of the board, next step is to connect it to the prototype platform and test a vertical slice of the platform power train system in open loop.

5.1Rewire Motors

Original motor wirings are flimsy. Wires have been desoldered and replaced with longer and more suitable wires. The platform has been hooked to the prototype electronics.

Illustration 7: Rewire Motors
Motors have been numbered like pins in an IC with zero starting on the rear, to allow a consistent numbering scheme to scale up and down with the number of motors
  • 0 = Rear Right
  • 1 = Front Right
  • 2 = Front Left
  • 3 = Rear Left
Speed is meant to be positive with the motor turning clockwise when addressing individual motors. When using the Forward/Turn rate control scheme (2 DOF), a transformation is applied inside the proto board and forward is positive while turn right is positive.



5.2Firmware

The firmware generate a clockwise and a counter clockwise ramp on one motor at a time.

Illustration 8: Firmware Architecture
Firmware for the test can be found in this >>>Github Repository<<<
Again, the RTC is used to generate the main tick that will be used to schedule all tasks.
A LED blinks at a fixed rate of 2Hz.
A slope generator FSM provides a ramp that is either up or down, in two directions either clockwise or counter clockwise to one of four motors.
The power stage with the VNH7040s can be powered down by a switch to allow debug of the control signals safely.


5.3Platform Test

The platform has been enclosed in the mock-up cover and a test has been run to try each motor at full command in both directions individually.

Illustration 9: Full Test
The drivers are left free wheeling when at zero PWM in Option 1 connection. Not a problem, as a closed loop PID will ensure target speed is enforced.


Video 1: Full Test



6Conclusions

This test successfully demonstrated the feasibility of the overall architecture and power train design of the OrangeBot robot due to compete in the PiWars 2020.
Next steps for hardware development are:
  • Connect the Raspberry Pi to the power train electronics
  • Test bidirectional communication between RPI and prototype electronics
  • Test remote control capabilities from the FPV framework already in use inside “Seeker Of Ways B” and “Maze Runner”
  • Rewire the quadrature encoders on board the IG32-05 to the electronics. Test them
  • Test the current sense capabilities of the VNH7040 drivers
  • Develop a quad high precision dual loop (current/speed) PID controller
  • Design a PCB to integrate all the above functionalities



No comments: