Awesome project! I’m working on a similar design, and happy to exchange information if you want.
For the current sensing: as some people have already mentioned, you need to size the shunt resistor so that:
a) your max power dissipation (given by the voltage drop on the shunt x the max current, probably 5A for a 6234 driver) must be well within the power rating for the shunt, or it will burn up
b) your voltage drop is as large as possible (makes readings more accurate and less noisy)
So you basically pick the largest value that (with some safety margin) doesn’t burn
Since you’re using a single shunt sensing topology, you probably don’t want to use the current sensing to drive the FOC algorithm in terms of motor position, so you will still need an accurate encoder. But you can use the current sensing to drive motors with lower winding resistances by implementing current limiting. Note that this is currently not implemented in the SimpleFOC library, I think.
For a 1 Ohm winding resistance, I think your shunt value will need to be quite low, and you will definitely need to amplify the voltage. For this an op amp is what you need, but I would strongly recommend using a current sense amp (a ready made IC integrating most of the stuff you need as well as filtering circuitry etc). This is where it starts to get quite complicated, because you will need to choose the op-amp or current sense amp according to the needs of the application. So in your case you need a common mode that can go (at least a little bit) negative, 16(?)V input, fast response times, and can map the positive/negative voltages you get from the shunt to a positive only voltage the microcontroller can work with. You may also need to use some kind of voltage reference to provide a stable reference voltage to the amp. Take a look at the INA*** current sense amps, they have some useful models.
From there it needs to go to the microcontroller. I’d be interested what your plan is for this. The STM32 have good ADCs, I think, and I think there are features to connect them to the PWM driving. Some models also have built in op-amps and comparators. I think the problem here is that the switch-off has to happen fairly quickly, probably faster than would happen if you just “read ADC, re-adjust PWM” in the FOC control loop. Many designs I’ve looked at use comparators to detect the over-current condition and switch the EN or IN control signals low using hardware, and not software. Some of the motor driver chips also have dedicated inputs for this purpose, so you can get a current control loop many times faster than your FOC control loop, maybe even considerably faster than your PWM period…
One final note: I’d urgently recommend doing some kind of simpler design as your first assembled PCB. Doing a motor controller with current sensing and microcontroller as your first project is very ambitious, IMHO. For example, why not start with just a part of it, as a breakout board, and use an existing microcontroller board to drive it?
Regards from Vienna,