Motor Driver

Click images to expand

The PCA9635 chip was designed to control LED brightness using a fairly high pwm signal (97  kHz).  Since this is well above normal human hearing range, this makes it very well suited for interfacing with the L298N motor driver without having any unwanted sound effects.  The L298H can accept a PWM signal which will affect the high voltage side of the chip and effectively deliver an average voltage between 0 and 100% of said high voltage (Vs), that is directly proportional to the duty cycle of your PCA9635 duty cycle output.  Note also that the pca9635 can be set to "digital mode" where the output is either high or low without a pwm signal whatsoever.  This is also needed for the L298N since it has input pins designed to control the polarity of the high voltage side and those pins are digital.

Note that it is possible to use pin 18 on the Raspberry Pi header to output a hardware PWM signal which does work and can control the L298N (after logic level conversion), however, pin 18 can only control 1 train wheras the PCA9635 can control several.  Also, pin 18 can be used for RGB LED's, so I would prefer to reserve pin 18 for that purpose.  

Basic instructions:

I only run 12v as that is what the engine motors are rated for.  I know some people like to overdrive it at 16 or even 19v, which the L298N supports, however, you would need to remove a jumper.  Review these notes from the Amazon webpage:

We believe they are referring to jumper con5, see photo [click here]