Electronic – How to redesign a circuit to use a current sinking IC rather than a current sourcing IC


I'm building a serial servo controller to learn about electronics and assembly language as part of my hexapod robot project. Quite early on I decided that I needed more I/O channels than my ATTiny2313 that I was using at the time supported so I investigated some 3-8 line demultiplexer chips (CD74HCT238E's) which have allowed me to create a 64 channel PWM servo controller with just 8 I/O pins for the PWM channels and 3 address lines.

Anyway. I also bought some CD74HCT138E's which are active low rather than the active high CD74HCT238E's. I understand, in principal, the differences between the current sourcing chip that I'm using and the current sinking chips but I don't really know how to adjust my circuit to use the current sinking chips instead of the current sourcing chips.

The schematic for the active high chips is here:
alt text
What do I need to change to swap the CD74HCT238E's for CD74HCT138E's?

Note that the reason for asking this question is that I bought a tube of the active low ICs by mistake and I'm curious at how much more complex the schematic and circuit design would need to be for me to make use of them.

Best Answer

The '238 have only one of eight outputs logic high, sourcing current, the rest of the pins will be logic low, sinking current. The '138 is precisely the opposite, one of eight pins can be low, sinking current, the rest will be high, sourcing current.

To "invert" the function of the '138, you could use eight PNP transistors with the bases each tied to an output of the '138 with a resistor, the emitters all connected to +5 and the collectors each connected to one of your servo connectors. Or use a bunch of inverters (74HCT04 or octal 74HCT240) to change the sense of the outputs.

Your choice of 1 of 8 decoders will limit what you can do with your servos, as your circuit can only activate one output at a time. Max speed of any one servo will be limited by the number of servos that you want active. If you wanted all 64 channels on, for example, they would all be running at at average of 1/64th speed.

The PCF8575C is very handy for expanding digital IO using serial I2C protocol from devices like Arduino. You could run 64 servos using 2 pins on the Arduino and 4 PCF8575Cs. This would give you more flexibility in setting your PWM duty cycles.