An engine is a noise source. It is best not to feed it from the source that powers the electronic
Although it is possible to use the internal regulator to the arduino, it is preferable to use an external regulator such as a 7805, case like TO220. See the datasheet (www.google.fr
: "7805 datasheet") for usage tips.
Heatsink or not heatsink ?
I = current use by the motor
DV = voltage across the regulator
Rth_jamb = Thermal resistor between junction and the ambiant temperature -> for value see datasheet
Tjmax = maximimal junction température -> for value see datasheet
DT = calculated difference of temperature between junction and ambiant temperature
DT = Rth*P , DT is in °C , P = I *DV, P is in Watt
I= 0.5 A
Tj_max = 170°C
Rth = 20degrees/watt
P = 0.5*(9-5)= 2 W
DT = 20 * 2 = 40°C
The max ambiant operating temperature is = Tj_max- DT = 170-40 =130 °C
If Rth will be 80 degrees/watt Dt will be 160°C and the max ambiant temperature will be 170-160 = +10°C
In this case you have to add an heatsink and the Rth is now : Rth_junction/case + Rth_heatsink.