I have a raspberry pi 2 and an 8 module relay board (http://nettop.gr/index.php/en/hlektronika/relay/8-channel-5v-relay-module-with-light-coupling-5v.html). Between the relay board and the raspberry I have an 2N3904 Transistor as depicted here (https://myhydropi.com/connecting-a-relay-board-to-a-raspberry-pi). I use PI4J for my program (https://pi4j.com/1.2/index.html). As an operating system I have ubuntu. I have a power adapter of 2A that powers the raspberry and the relay module. I have spliced the power source before the raspberry in order to power the relay module.
I have noted that sometimes there are some glitches (open/close) of some relays for a few fractions of the second. It looks that this random since it can happen at any relay.
Am I doing something wrong in terms of design (raspberry + transistor + relay module? What could be wrong and how should I debug this situation?
Please consider that I am mainly a software developer and not specialized in hardware.
Thank you a lot in advance!