0
\$\begingroup\$

I am building a self-playing piano project with 88 solenoids and sustain control. I use 11 daisy-chained shift-registers which are connected to an Arduino and controlled using SPI. The latch will be pulsed at a frequency of about 28 kHz. This should make PWM control over these solenoids possible without high pitched hearable noise.

The sustain motor is controlled by a L298N motor driver board which is directly connected to my RPI. The board however is rated for 4.5V logic input but has a threshold of 2.3V, and RPI logic is 3.3V, which should work but could this damage my RPI?

I have 2 seperate power supplies, a 12V 40A ACDC transformer and a 55 Ah battery. I want to be able to switch between these supplies using a rotary switch. I use the 1 A trickle charger I had lying around for budget reasons.

I use 1.5 meter of WS2812B ledstrip with a 470uF(C1) decoupling cap mounted at the begin of the ledstrip. The 88 solenoids are divided over 11 circuit boards all mounted on an metal plate (earthed). Each circuit board has a decoupling capacitor of 2200uF. (See C2 and C6 for example)

I am not sure if I did the decoupling right and if there are any recommendations for my system?

Main overview

shift registers daisy chained

L298N board

\$\endgroup\$
7
  • \$\begingroup\$ Why L298s are fairly crap on low voltage supplies \$\endgroup\$
    – Andy aka
    Dec 9, 2021 at 11:54
  • \$\begingroup\$ "Design recommendations/review" is a 'bad' title, that may attract close votes. \$\endgroup\$
    – Mitu Raj
    Dec 9, 2021 at 13:29
  • \$\begingroup\$ @Andy aka thank you for sharing, I knew about the voltage drop, but I supply 12V if that drops too far I will place a voltage booster for the L298N. The motor can handle up to 24V. \$\endgroup\$
    – aWiseMan
    Dec 9, 2021 at 17:18
  • 1
    \$\begingroup\$ @Mitu Raj Thank you, I changed it \$\endgroup\$
    – aWiseMan
    Dec 9, 2021 at 17:29
  • \$\begingroup\$ I don't understand why the shift registers are connected the way they are. Have you reviewed the design yourself at all or just dumped here for opinions about the circuit? Also if the Arduino outputs 3.3V signals it is not within specs for the 5V powered HC chips. \$\endgroup\$
    – Justme
    Dec 9, 2021 at 17:32

1 Answer 1

1
\$\begingroup\$

IRFZ44 is not rated for 5V gate drive, it needs 10V. There are tons of cheap dual SO-8 MOSFETs with similar RdsON that can be driven with 5V from your 74HC595, and they take less space on the board.

If the solenoid current is low enough, you can use NPIC6C596 instead, which has integrated MOSFETs.

MOSFETs will require gate resistors to prevent oscillation if traces are long, maybe 100R or so.

The diodes are OK.

HC595's need decoupling caps, since there are lots of gates to drive I'd suggest 1µF 16V X7R SMD MLCCs. Also to avoid ringing in 5V power distribution, a local electrolytic cap on each board can be a plus. Value uncritical, 33-100µF, preferably cheap and general purpose with lots of ESR for damping. Check the maximum capacitance load of your 5V DC-DC. Same effect can be achieved with a few ohms resistor between the +5V supply and the 1µF MLCC decoupling cap.

HC595's require 5V signal. If your arduino outputs 3V3 signals, use 74HCT595 instead. Or better, to keep the higher noise margin of 74HC chips, use a HCT buffer to translate 3V3 to 5V, then keep the HC595.

HC595 pinout looks incorrect, also this chip does not have two SRCLK inputs while your schematic does, and it has a Reset input which is not on the schematic. In fact connections to the shift registers look a bit weird.

HC595 shifts data in and out on the same edge of the clock. If the clock runs in the same direction as the data line, this can cause problems. You can add an extra line in your board daisychain to route the clock to the other side, then back, along with resistor footprints to connect HC595 to the clock line you're actually using.

There is a large amount of capacitance on +12V rail. Check your SMPS doesn't have a "maximum capacitance" rating that conflicts. Also this will make a huge spark when you connect the 12V battery, and possibly weld the switch, so a soft-start with a resistor would be a good idea.

Given the huge current circulating in GND, the metal plate is a good idea. PCBs with solenoids should have their grounds tied to it with a very low resistance connection, like screws and metal PCB spacers. If this is unscrewed, solenoid current will flow in the GND wires, or any other ground connections between boards, which will cause problems. Maybe a soldered connection would be more reliable... it has to be close to the MOSFETs so the current doesn't flow through the whole ground plane, just locally.

However GND on each of the 11 circuit boards could still lift relative to the others, which could corrupt the signals to your shift registers or cause latchup. I'd add a BAT54S dual diode on the inputs to make sure the HC595's don't get some nasty spikes on the inputs.

Fast digital signals should be source terminated with 33R, this includes the data outputs of HC595's.

If the boards are connected with wires, this isn't really compatible with fast digital signals. It would be better to daisy chain them with 0.1" headers. These must include GND pins between each signal for HF return current, and the boards should have a ground plane.

Can the arduino output actually drive the clock line?...

WS2812B need 5V signal, you need a 74HCT logic gate for voltage translation between the Pi and WS2812B.

Please don't put the fuse in the negative connection of the power supply...

Resistors in the lines between the Pi and the L298 will save your Pi when the L298 melts and shorts the inputs to +12V.

U4 needs an output cap.

\$\endgroup\$
6
  • \$\begingroup\$ pdf1.alldatasheet.com/datasheet-pdf/view/68621/IRF/… Figure 1 indicates that the IRFZ44N can conduct 10 Amps at 4.5Volt gate drive right? \$\endgroup\$
    – aWiseMan
    Dec 9, 2021 at 19:49
  • \$\begingroup\$ That's "typical", there's no guarantee \$\endgroup\$
    – bobflux
    Dec 9, 2021 at 19:53
  • \$\begingroup\$ The solenoids are up to 2A each. For the HC595's, I messed up, the SRCLK and !SRCLR (which is reset) connections should be switched around. And I didn't connect second !OE. I already have the HC595 and first test worked. I will still add logic level converters, also between RPI and L298 and RPI-ledstrip. \$\endgroup\$
    – aWiseMan
    Dec 9, 2021 at 20:16
  • \$\begingroup\$ About the metal plate, I currently only mounted the solenoids on them and earthed the metal plate, wouln't it be a electrical hazard to let so much current flow through the metal? @bobflux \$\endgroup\$
    – aWiseMan
    Dec 9, 2021 at 20:27
  • \$\begingroup\$ Its a aluminium plate btw \$\endgroup\$
    – aWiseMan
    Dec 9, 2021 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.