Hello, this entry seems some years old, but I also recognize that behaviour with my direction dependend lights for Trains. Normally if the PWM Signal starts in one direction, the light switches and remains (red rear / white front).
A simple CMOS Flip Flop do the job correct with the IR controller from LEGO and other Solutions. Here the signal confuses the Flip-Flops and sometimes booth LED colors light up at the same time. The explanaition from Rob shows why this occures. This exists also in the SBrick 2.
Hello, in using SBrick and working to develop add-ons for Power Functions, I have noticed the PWM output coming from SBrick for motors is not normal (verified using an oscilloscope). Normal PWM looks smooth and rises and falls from 0V to max voltage and back again.
With SBrick, this is how the PWM operates when there is no motor connected. However, when there is a motor connected to any port, the PWM signals on that port become very irregular. The irregularities vary depending on which type of motor is connected, so an M-Motor will cause less irregularity than an XL-Motor for example.
I did research into this and also spoke with Texas Instruments, maker of the H-Bridge chips SBrick uses to control outputs, and it seems this behavior may be caused by the fact that you did not implement any current sense resistors on the H-Bridges in your design. TI illustrates the use of current sense resistors connected to pins 1 and 4 of the chip (AISEN and BISEN), yet you have these pins connected directly to ground. This would seem to explain part of why I'm seeing the irregular waveforms: the H-Bridges may be tripping max current and resetting constantly.
I see on the SBrick PCB there is a large set of pads where each of the current sense resistors should have been, which leads me to believe you tested with the resistors but in the end decided not to implement them.
Can you provide more detail about why you made this design choice? The irregular waveforms (whatever is causing them) are making it impossible to design reliable accessories that will work with SBrick. They work fine with the LEGO PF controllers (as these generate clean waveforms regardless of what motor is connected to them), but not with SBrick.
Thank you!
--Rob