I am trying to control automatic air perfumer with ATMega 328. This type of perfumer have a motor inside that momentary gets a signal to run for about a second and then switched off. The perfumer is running on two AA batteries. I first tried the motor separately and it works fine when connecting the batteries wires directly to it. I measured the drawn current and found it 105mA DC on about 3.1v from 2 AA batteries.
I need to run my ATMega 328 chip from the same batteries and send signal from one of the Arduino pins to switch the motor on for a second and then switch it off to simulate its original action for flushing it.
I tried 4N25 optoisolator to drive the motor as per the attached drawing.
The chip is running fine, however the motor could not run on the above configuration. Although I tried the same configuration on a LED to check and it is working fine.
What am I doing wrong please?