Sewing machine speed and needle position control over arduino
If the machine has a brushed or universal motor, you can use a triac dimmer to control its speed.

However, triac dimmers are annoying to control. They fire on each mains cycle, ie every 10ms on 50Hz mains which inserts a large phase lag in the control loop. Also the input-output curve is very nonlinear.

If you want to control needle position you will need fast and accurate control, so you don't want to insert a large phase lag in your control loop. You'd need a smart control algorithm to compensate for this lag.

A much better scheme is to rectify mains and smooth it with a capacitor, then use high-ish frequency PWM like 10-20 kHz through a MOSFET. This has much lower phase lag, and would be easier to control. You can also control current through the motor, if you want to control torque.

For example, I have several electric drills. Most drills use triac dimmers. When using such a drill to drive a screw it is impossible to control torque and speed accurately, and the screw always ends up either deep into the workpiece, or sticking out. Triac dimmers just aren't accurate. I have another mains powered drill which uses a rectifier and PWM dimmer, and this one is very easy to control, the screw ends up perfectly flush with the workpiece every time.

Note your project uses high voltage thus it will be dangerous. Be careful.