Lamp matrix controller board properly working
Last night my friend DalPoz helped me figure out what was the issue with my lamp matrix controller board for the pinball machine. I fixed the software and now it is working great! I have also done some reverse engineering on Pinball Fantasies to map which palette indexes are used for each lamp in the game. Using this info, now the Arduino is controlling the lamps so that they flash in sync with the lamps of the game.
The issue with the board was that it was drawing too much current from the Arduino output pins.
In my project, lamps are organized in a lamp matrix and 4 pins control the activation of columns while other 4 pins control activation of rows. The first group of pins draw 1mA in each pin, while the second group draws 25mA per pin. I was multiplexing the lamp matrix by activating one column at a time, which resulted in 1mA (for the column selection - only 1 pin activated at a time) plus up to 4 times 25mA (the 4 row pins can be on/off in any configuration depending on the status of the lamps of the selected column). So, the worst case scenario was 1+4*25 = 101mA but the Arduino can only provide 40mA max.
By inverting the multiplexing algorithm, that is, by multiplexing rows instead of columns, the worst case scenario becomes 25 + 1*4, which is only 29mA. That was the solution for the issue with the intensity of lamps noticed last week.
The Arduino board has a limited number of i/o pins, so I'll have to find a way to extend it. One possible solution is to use i2c to communicate with the 4 lamp matrix controller boards that will be used to control the lamps of the whole playfield. But Jeri Ellsworth told me that there might be some issues with using i2c on pinball machines, since there is a lot of noise in such machines, which could lead the i2c communications to eventually freeze. I might have to use long cables for the lamps and connect all of them to a central controller board.