Free AI web copilot to create summaries, insights and extended knowledge, download it at here
4175
Abstract
images-1.readmedium.com/v2/resize:fit:800/1*NLpvZ90JeajtHpirHGFn_w.jpeg"><figcaption><a href="https://fudemotor.en.made-in-china.com/product/vCQmSnDynkho/China-High-Precision-42X34mm-0-4A-12V-Bipolar-Stepper-Motor-1-8-NEMA-17.html">https://fudemotor.en.made-in-china.com/product/vCQmSnDynkho/China-High-Precision-42X34mm-0-4A-12V-Bipolar-Stepper-Motor-1-8-NEMA-17.html</a></figcaption></figure><p id="cf6e"><b>6)</b> To upload to your Arduino Pro Mini use a TTL to USB Serial Converter — TTL-232R — FTDI Chip. This allows the user to communicate with the USB interface via a standard PC serial emulation port (for example TTY).</p><figure id="20c9"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ujLr2TsQJPjkWaCm0aCYfA.jpeg"><figcaption><a href="https://www.seeedstudio.com/UartSBee-V5-p-1752.html">FTDI cable compatible USB to Serial adapter equipped with BEE socket (20pin 2.0mm)</a>.</figcaption></figure><p id="6a97"><b>7)</b> Connect your 11.1 volt battery poles.</p><figure id="8ecc"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*V1dhxNJTI0v2DTCg2KewTA.jpeg"><figcaption>Lithium_ion Polymer Rechargeble Battery 11v1</figcaption></figure><p id="317c"><b>8)</b> Run this code:</p>
<figure id="0255">
<div>
<div>
<iframe class="gist-iframe" src="/gist/giljr/ef2adfb4704a1f23061ea442e08b7992.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><p id="2d57"><b>9)</b> And finally run this one:</p>
<figure id="e86e">
<div>
<div>
<iframe class="gist-iframe" src="/gist/giljr/181e2d5a4e8ed82a5030776450011b40.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
</div>
</div>
</figure></iframe></div></div></figure><p id="2e84">Pay special attention to the part of the code that determines the voltage of the battery.</p><div id="ef35"><pre><span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">setup</span>()</span>{</pre></div><div id="7a63"><pre>...
<span class="hljs-function"><span class="hljs-title">if</span> <span class="hljs-params">(debug)</span> {</span></pre></div><div id="35fc"><pre><span class="hljs-type">Serial</span>.<span class="hljs-keyword">begin</span>(<span class="hljs-number">9600</span>);
<span class="hljs-type">Serial</span>.println( “BATT Test: Stop Range <span class="hljs-keyword">level</span> <span class="hljs-number">8</span>v < → <span class="hljs-number">10</span>v5” );
<span class="hljs-type">Serial</span>.println( “BATT Output Must be above > <span class="hljs-number">1050</span>” );</pre></div><div id="90c8"><pre>...
<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">loop</span>()</span>
{
battery_voltage = analogRead(A0) * (<span class="hljs-number">1250</span> / <span class="hljs-number">1023.</span>);</pre></div><div id="1c4c"><pre>if (debug) {
Serial<span class="hljs-selector-class">.println</span>(battery_voltage);
<span class="hljs-built_in">delay</span>(<span class="hljs-number">2000</span>);
}</pre></div><div id="a8c9"><pre>if (<span class="hljs-keyword">battery_voltage </span>< <span class="hljs-number">1050</span> && <span class="hljs-keyword">battery_voltage </span>> <span class="hljs-number">800</span>) {
<span class="hljs-keyword">digitalWrite(13, </span>HIGH);
low_bat = <span class="hljs-number">1</span>;
}</pre></div><p id="a225">This part serves to close the motor when the load is between 8v-10.5v. It warns the user that the battery is discharged by lighting the LED 13.</p><p id="62ff">See too this part of the calculation code:</p><div id="dc89"><pre><span class="hljs-string">battery_voltage</span> <span class="hljs-string">=</span> <span class="hljs-string">analogRead(A0)</span> <span class="hljs-string">*</span> <span class="hljs-string">(1250</span> <span class="hljs-string">/</span> <span class="hljs-number">1023</span><s
Options
pan class="hljs-string">.);</span>
<span class="hljs-string">=</span> <span class="hljs-number">1023</span> <span class="hljs-string">*</span> <span class="hljs-number">1250</span><span class="hljs-string">/</span> <span class="hljs-number">1023</span>
<span class="hljs-string">=</span> <span class="hljs-number">1250</span></pre></div><p id="637d">Here if we eliminate 1023 in the equation (assuming analogRead returns 1023) we end up with an integer representing the higher current voltage 1250, that is igual to 12v5.</p><p id="eba8">For your batt test, put <b>debug as true</b> (in the header of this code) and the serial port will send the voltage to the TTL to USB Serial Converter. To test, turn off the engine. Then, test done, just put <b>debug to false</b> and that’s it, the code will run fine!</p><p id="1c5c">See this video!</p>
<figure id="bf33">
<div>
<div>
<img class="ratio" src="http://placehold.it/16x9">
<iframe class="" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs6ocOyQyqXA%3Ffeature%3Doembed&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds6ocOyQyqXA&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs6ocOyQyqXA%2Fhqdefault.jpg&key=a19fcc184b9711e1b4764040d3dc5c07&type=text%2Fhtml&schema=youtube" allowfullscreen="" frameborder="0" height="480" width="854">
</div>
</div>
</figure></iframe></div></div></figure><p id="ffac">In the next post we will deal with:</p><p id="94e0">9-DOF IMU module</p><figure id="ba22"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*3QwgyqWU58-30kUPGgAjiA.jpeg"><figcaption></figcaption></figure><p id="1634">and 2.4G Wireless Serial Transparent Transceiver Module for Arduino</p><figure id="5de0"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*wykSuJNfVT34Zdr7ZIlbfA.jpeg"><figcaption></figcaption></figure><p id="9d3b">We are close to our goal, are not we?</p><p id="1db0">Till There!</p><p id="2a88">See you around! Thanks!</p><p id="5877"><a href="https://drive.google.com/drive/folders/0B8iMbc-iQqlUUENFdmVwUzd6azA?usp=sharing">Download All Files for This Project</a></p><h2 id="8464">References & Credits</h2><p id="f047"><a href="https://readmedium.com/jaythree-balancing-car-project-a90185279c93">Part 1</a> — — Part 2 — — <a href="https://readmedium.com/jaythree-balancing-car-project-part-3-5-3b3117047ac6">Part3</a> — <a href="https://readmedium.com/jaythree-balancing-car-project-part-4-5-4964ab5af128">Part 4 </a>— -<a href="https://goo.gl/JKVE3P">Part5</a></p><p id="7598"><a href="http://www.mauroalfieri.it/elettronica/drv8825-stepper-driver-arduino.html">drv8825 stepper driver arduino</a></p><p id="0224"><a href="http://www.mauroalfieri.it/elettronica/centralina-irrigazione-arduino-pulsanti.html">Centralina irrigazione arduino aggiungi i pulsanti</a></p><p id="112b"><a href="https://www.pololu.com/file/download/drv8825.pdf?file_id=0J590">DRV8825 Stepper Motor Controller IC</a></p><p id="a9a2"><a href="https://www.pololu.com/product/2133">DRV8825 Stepper Motor Driver Carrier, High Current</a></p><p id="0d69"><a href="http://www.pbclinear.com/Download/DataSheet/Stepper-Motor-Support-Document.pdf">Stepper Motor NEMA 17 Datasheet</a></p><p id="adba"><a href="https://www.youtube.com/user/doctoralma77/videos">Mauro Alfieri Youtube Videos</a></p><p id="a980"><a href="https://github.com/giljr/Ardu_Serie">My Github Repo</a></p><figure id="c759"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*BaGTs7__B-WOZrallvAKTQ.jpeg"><figcaption>Project 2 is working!</figcaption></figure><ul><li><a href="https://medium.com/tag/arduino-pro-mini?source=post">Arduino Pro Mini</a></li><li><a href="https://medium.com/tag/gy-85-imu?source=post">Gy 85 Imu</a></li><li><a href="https://medium.com/tag/drv8825-reprap?source=post">Drv8825 Reprap</a></li><li><a href="https://medium.com/tag/lithium-battery?source=post">Lithium Battery</a></li><li><a href="https://medium.com/tag/nema-17-stepper-motor?source=post">Nema 17 Stepper Motor</a></li></ul></article></body>