Close
0%
0%

TWI to 4 x PWM Driver, Alice V2

4 x Multi purpose power outputs, controlled via TWI commands

Similar projects worth following
Building a sort of vending machine i needed multiple PWM drivers. Motors, LED´s, Servos. That got complicated very fast so i built one controller who can handle all my needs while being easily daisychainable.

Possible uses are
4 LED strips
4 Servo motors with power off possibility
2 DC motors in two directions
4 Fans
etc etc....

Features:
- Up to 36V Input
- 2A out peak per channel
- Configurable overcurrent shutdown
- 4 Half bridge outputs
- Every output with extra PWM channel for easy Servo control
- Configurable TWI address offset (up to 16 chainable devices)
- Handy business-card form factor
- 2x Adafruit STEMMA compatible TWI connectors

Overview:

The general idea is to have 4 outputs the can either be configured to drive a PWM (to drive a DC-Motor) or a servo.

The AVR16EA32 provides 2 16-bit timers and 4 8-bit timers which are used in this project.

While the 16-bitters provide a fast clock and a slow clock (which end up as 50Hz for servo or 1,6KHz for PWM at the output)

Each of the 8-bit clocks control the PWM outputs depending on the configuration.

-

This way i can use one module to build a small RC car.
1 servo, 1 DC motor (in 2 directions) and one free output for maybe lights.
All via simple TWI commands. no need to use the precious Arduino pins or processing time.

-

The general purpose output driver:

What makes this device so handy, is the possibility to control 4 of these output drivers via easy TWI commands:

This allows us to configure each output as one of 3 Modes:

  • Servo Mode
    The pinout is already setup to easily connect any servo motor. Pin 3 outputs the 50Hz signal while the power pin can be switched off for a poser-saving mode possibility.
  • PWM Mode
    In this mode, pin 3 is functionless. But the middle/power pin will toggle with a ~1.6KHz PWM
  • Output Mode
    Of course a simple output mode is possible. You can constantly pull pin 2 to PWR, GND or just let it float.

Power input

Generally, the µC is controlled by the TWI connector. Thus the system can be powered by 5V or 3V3.

Also, this allows the Output to go up to 24V (Limited by OP-amp for overcurrent detection)

The Voltage on the Servo outputs will still be 5V. Alternatively, if only 5V for power are used, a solderjumper can connect the TWI Power.

Overcurrent detection

Over a shunt and OP-amp the current is constantly measured.

-> Still WIP

By now the controller just shuts down when >2A is detected

TWI Commands

The command system is set up in 2 Bytes.

First a command byte, then a data byte.

See the TWI-Commands.h for further info

TWI_CMD_Alice_V3.h

h - 566.00 bytes - 04/16/2025 at 10:14

Download

V3.hex

hex - 8.44 kB - 04/16/2025 at 10:01

Download

PWM_Module.kicad_pcb

kicad_pcb - 565.16 kB - 04/16/2025 at 10:01

Download

  • Learnings

    Phil Weasel05/19/2025 at 09:31 0 comments

    So after using this project in a sort of "vending-machine", im quite happy with the outcome.

    I use 2 outputs for a DC-motor and the other 2 for two servos just as intended.

    Yet i have two learnings i have for the next version or for whoever wants to build something like this:

    1. Just one timer in PWM-mode for the Servo is not enough. The duty cycle is 255 steps over the whole 20ms while the servo only wants like ~10-30% of this whole range.

    2. Temperature sensors on the output stage. While the overcurrent detection is fine, Having the full load on one output can overhat the Transistor when not careful.

    But since everything else works, i can close this project for now and book it as a success.

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates