How to control motor (1.5 V at about 0.5 A) with Particle Photon using optocouplers and transistors?
fortunately the noise of a motor with these specs is easy to control.
the figure 5.2.5 in the second link, works fine. but I assume you have connected both grounds together. it should be connected like this :



simulate this circuit &ndash; Schematic created using CircuitLab
this way, there is no physical connection between motor control and logic circuits. but there are some notes:

a tiny relay would work without much hassle.
the transistor should withstand at least 1amps for a safe margin.