Need help with a circuit diagram where the motor does not seem to have any connection to ground. Error with diagram? Or am i missing something?

The shockingly badly drawn circuit diagram (from the cited article) is wrong.
There should be a connection from the Q1 transistor emitter to ground (ATtiny pin4, battery negative). The transistor will then be driven on in the usual manner by R2 = 3.3 K Ohm.

As drawn diode D1 has minimal effect and R3 is of no real value.
Better would be to connect D1 across the motor (Cathode to B+) so that the diode does NOT conduct when the motor is being driven and acts as a "freewheel" diode when the transistor is off.

The value of R2 (= 3k3) will provide less than 1 mA drive to the transistor base and depending on the transistor used may limit motor current. A value of 1K Ohm or even lower may produce better results.


The circuit is wrong. I think the ground is connected to D1's anode, but that's not the only problem with it. 1N4001 is too slow there. Also, putting one diode between the motor's pins and another between the transistor's E and C works better. (the motor is probably small enough in this case to kill the transistor, that's why the original circuit didn't self-destruct, but it's still wrong)

R3 is probably there to limit the current through your motor, but I don't see why it's there (putting it between the transistor and the motor, or between the motor and Vcc would be better if it's necessary at all).

R2 is small - as Russell McMahon pointed that out.

You can use the ATTINY's internal pullup resistor, and put the switch between the pin and GND, and simply invert it in software. But it's just some minor modification.

Edit: you can clearly see what the original author did in his pictures. The diode is between Q1's emitter and collector, but at first he put it in the wrong way. The last picture shows it in the correct orientation (anode to the left). You could also reverse engineer the correct solution based on the last picture if you wanted to.