5 channel I2C PWM switch

image

Overview

This board connects over a the two wire I2C bus and provides a 5 PWM low side switches. This can be handy if you are running low on GPIO (eg. ESP8266) or just want a simple solution.

Usage

//include the I2C PWM library you can download from mnux.xyz
#include <I2CPWM.h>

//creates an expander called "myExpander"
I2CPWM myExpander(8); // selects an expander connected on address 8

void setup(){
  // to set a PWM value:
  // myExpander.setPWM(channel, value);
  myExpander.setPWM(1,128); // sets channel 1 to 50% duty
}

void loop(){

}

Component choice

Firmware

Circuitboard layout

As always i used kicad, however this being a circuit with a lot of repeating layout I got to utilize some of its more advanced features and plugins.

Mistakes

Usecase

image

image

Conclusion

Even tho the end device isnt really that interesting i thought it was still worth it making a blog post about it because of all the little techniques used that i never used in any other project. And for me, somebody who always used pre-made libraries for i2c devices it was very fun to learn how it works and make my own library.

offtopic (blog update)

I have made this blog post into a mark down file which just embeds in HTML instead of just writing it in HTML like i used to. Sadly it kindof reminds me of the style how chat bots write (or one of my teachers exams who uses AI to make them). So i wanted to say that I dont use any generative AI.