Neumi / ethersweep

Open Source, easy to use Ethernet connected stepper motor controller. Built in FreeCAD, KiCAD and Arduino.
Other
495 stars 58 forks source link

Consider using internal voltage reference #15

Open Duckle29 opened 1 year ago

Duckle29 commented 1 year ago

Quick look through the schematic I noticed your voltage reading assumes a 3.3V ADC reference voltage. Just be aware that your ADC measurements are then limited to the accuracy of your supply voltage.

You probably don't need any high accuracy ADC measurements, I just recently ran into a problem where I did and I wished I'd prepared my PCB for it instead of having to do a re-spin.

The STM32F103 (and F107) have a built in 1.2V, 100ppm/K. It is however +5% -3% for initial accuracy going with the min/max spec so, meh.
I don't have any experience with how close to the typical 1.2V it usually is.

Alternatively an external vref could be used.

Also, remember to check the errata for the MCU you're using when considering this stuff... Yes I also got burned there :P (The F103 doesn't seem to have any vref related errata, tho a short blurp about ADC ch0 generating a 10ns 150mV blip in certain usecases)

Neumi commented 1 year ago

Thanks for the tip. I will check for the next hardware version. The ADC is currently only used to detect the raw input voltage (5-30v). I think it is okay to have a drift of a few percent. This is not critical to the operation.