tag:blogger.com,1999:blog-30001316063330985572024-03-22T00:36:29.806-07:00xMechaTronics : Exploring Technology with Fun....neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-3000131606333098557.post-75972325665974062692016-02-17T08:30:00.000-08:002016-02-17T08:30:59.320-08:00DIY Mini Drill Controller<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
Scene-1: The Cause</h3>
I was using a small MiniCraft drill machine for drilling holes into my home made PCBs and also for some cutting activity with some attachments. The problem that I had was that when I bought the drill it didn't come with any sort of controller. I used to use it with direct connection to battery.<br />
<br />
It was difficult to every time remove the drill once it got stuck, because there was no way to reverse.<br />
<h3 style="text-align: left;">
Scene-2: The Idea</h3>
So one fine Sunday I thought of building this drill controller.<br />
<br />
The basic concept was that I have to build a controller circuit for :<br />
<br />
<ol style="text-align: left;">
<li>Speed Control; so that if there is any delicate job to be done then I can start slowly and increase the speed as and when reuired.</li>
<li>Direction Control; for when the drill would get stuck/jammed I could reverse easily by the push of button.</li>
<li>It should have a Power ON-OFF control.</li>
<li>And finally everything should fit into a Compact box and all the controls should be user friendly and easily accessible. (don't want any tricky controls when you are handling a high speed sharp tool right :D )</li>
</ol>
<h3 style="text-align: left;">
Scene-3: Component Selection</h3>
<div>
To achieve this I thought of a simple idea which is to use motor-driver IC for reversing the direction and controlling the speed and a microcontroller to control the motor-driver.</div>
<div>
<br /></div>
<div>
I initially thought of using relays to control the direction, but then it could have become bulky and speed control would anyhow raise the need of some linear components.</div>
<div>
<br /></div>
<div>
Finally I ended up with L293D, which has 4 individual PUSH-PULL driver and every two of them can be paired to form a H-Bridge channel. It has a current capacity of 600mA per channel with in SOA (Safe Operating Area), beyond which it would require a heatsink (which I don't intend to provide, lack of space).</div>
<div>
<br /></div>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje4qD_XDUS2r2UOQZsTb9Hikmu1UuBwtDsMKtM-cSWPx0QrLVGvJYsoE9izgVZaxAPHWCi8VrVhYUwtpRUmY1GtHJEmdCpLMqnIGCC9YQy04KArXPVnv8-9jjUEudKh-vtlB3UZCxH0O8v/s1600/l293d.PNG" imageanchor="1"><img alt="" border="0" height="396" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje4qD_XDUS2r2UOQZsTb9Hikmu1UuBwtDsMKtM-cSWPx0QrLVGvJYsoE9izgVZaxAPHWCi8VrVhYUwtpRUmY1GtHJEmdCpLMqnIGCC9YQy04KArXPVnv8-9jjUEudKh-vtlB3UZCxH0O8v/s640/l293d.PNG" title="L293D" width="640" /></a></div>
<div>
<br /></div>
<div>
So I coupled 2 channels which would effectively double the current capacity now to 1.2A. </div>
<div>
<br /></div>
<div>
The goal was to control the direction of the motor by Input signals of L293D and speed by providing PWM to L293D input. Both of which would be from a simple low cost microcontroller, and nowadays we can pick up a cheap arduino-pro mini clone for around 200 INR, which is relatively cheap.</div>
<div>
<br /></div>
<div>
The advantage of using a pro-mini kind of board is that all the essential circuity for the microcontroller like clock, power are already present on board and it is quite sleek to fit into my box, and why not go for a pro-micro-328p board for 200 INR when a DIP atmega328p would cost 150 INR.</div>
<div>
<br /></div>
<div>
For speed control I used a 10k POT generally available in market.</div>
<div>
<br /></div>
<div>
I also used two tactile switches:</div>
<div>
<ol style="text-align: left;">
<li>For toggling direction.</li>
<li>For turning it ON or OFF.</li>
</ol>
<div>
Other components used are a couple of leds, resistors, a plastic knob for POT and a DC barrel Jack.</div>
</div>
<div>
<br /></div>
<h3 style="text-align: left;">
Scene-4: Realization and Testing</h3>
<div>
The schematic of the circuit is shown below:</div>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKAHbCVl-b9PUAs_IdcAwUjdaNsmOTZ-q_RkFuqtBfX4rYfV0Ni4VgZ7BoRfleHutED6LS-rGAaCAVCVoziIlyxPH1t1AdzGjBaNvDdELY2ePwVfthaqDjq7N1-WAbGmqvuo1Xzu9vg8Dy/s1600/drill_controller.png" imageanchor="1"><img alt="" border="0" height="440" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKAHbCVl-b9PUAs_IdcAwUjdaNsmOTZ-q_RkFuqtBfX4rYfV0Ni4VgZ7BoRfleHutED6LS-rGAaCAVCVoziIlyxPH1t1AdzGjBaNvDdELY2ePwVfthaqDjq7N1-WAbGmqvuo1Xzu9vg8Dy/s640/drill_controller.png" title="Drill Controller" width="640" /></a></div>
<br />
<br />
I have added a mechanism to detect Over-current, by which I can prevent L293D from Over-heating, if the motor really gets jammed.<br />
<br />
Since it is a brushed motor if the rotor gets stuck then current starts continuously flowing from the same part of the coil which eventually heats-up the armature and reduces its life, and also the Motor-driver can get damaged because of high-current flow, remember the peak limit is 1.2A even when both channels are combined.<br />
<br />
So for that I used a shunt resistor of 0.08Ohm and used to measure the voltage drop across it using ADC of atmega328p. So when voltage across it reaches 96mV (1.2A x 0.08Ohm) then we should disable the L293D in the program.<br />
<br />
I also added a functionality to prevent transients which is called Soft-start (mostly used for powering high-current loads), which is basically slowly increasing speed (using PWM) during POWER-UP instead of instantly supplying full power.<br />
<br />
All these and other features are present in the program.<br />
<br />
Click the link below to get the design files (schematic) and program for it.<br />
<a href="https://github.com/neutronstriker/Drill_Controller" target="_blank">Code and Schematic</a><br />
<br />
I have written the program using Atmel Studio, however it can be easily adapted for use with Arduino.<br />
<br />
The programming is almost complete however there are a few glitches which I am not getting time to resolve (documented in the Readme file). Feel free to make any changes and customize according to your needs.<br />
<br />
<h3 style="text-align: left;">
Scene-END: Result</h3>
Below is the result of what I built :)<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEqKs5IsTLNwYFkr81HGv-eBX1i0eOObekORtO-GcckZxM9fjmJu4YKYFoeFgF8dj1YmDrtyRjLpEgm-YVbwQJ9oYnScIaU9EfscZQi38p4LFQRPHwFb18U_4JG9PywnrcA-shDddE7Cws/s1600/P_20160210_002406.jpg" imageanchor="1"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEqKs5IsTLNwYFkr81HGv-eBX1i0eOObekORtO-GcckZxM9fjmJu4YKYFoeFgF8dj1YmDrtyRjLpEgm-YVbwQJ9oYnScIaU9EfscZQi38p4LFQRPHwFb18U_4JG9PywnrcA-shDddE7Cws/s640/P_20160210_002406.jpg" width="480" /></a><br />
<br />
The demo can be seen in the video below :<br />
<br />
<div>
<iframe allowfullscreen="" frameborder="0" height="360" src="https://www.youtube.com/embed/kj8AfH1zToc" width="640"></iframe>
</div>
<br />
<br />
CAUTION: DO NOT PLAY WITH HIGH-VOLTAGE AND CURRENT. USE EXTREME CAUTION WHILE HANDLING POWER TOOLS.<br />
<br />
DISCLAIMER: ALL THE INFORMATION PROVIDED IN HERE IS AS IS, WITHOUT ANY WARRANTY. THE AUTHOR IS NOT LIABLE FOR ANY LOSS WHAT SO EVER ARISING FROM THE USE OF THIS INFORMATION. USE AT YOUR OWN RISK.</div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com20tag:blogger.com,1999:blog-3000131606333098557.post-67121518104858262562015-01-08T08:37:00.000-08:002015-01-08T09:03:25.953-08:00Full featured FTDI-FT232RL Usb to UART breakout board<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;">FTDI's <a href="http://www.ftdichip.com/Products/ICs/FT232R.htm" rel="nofollow" target="_blank">FT232RL</a> is the most popular USB to UART converter chip and is used by many hobbyists. </span><br />
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzlq8E2_Qa7_R-hnCNAFZCWb1RQWE_K2mc_SCPECa4px170B5Gz1BfkCFPnc2F3NoBBGz2886XmYUR0qdl1QjYnAy_I6ZM4qyxBFyvD8DOBCIBG3Arpe8UiqQ4dp6nyU5Fzg_tsOYJ8Q1/s1600/ft232rl.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVzlq8E2_Qa7_R-hnCNAFZCWb1RQWE_K2mc_SCPECa4px170B5Gz1BfkCFPnc2F3NoBBGz2886XmYUR0qdl1QjYnAy_I6ZM4qyxBFyvD8DOBCIBG3Arpe8UiqQ4dp6nyU5Fzg_tsOYJ8Q1/s1600/ft232rl.jpg" height="212" width="320" /></a></div>
<div>
<span style="font-family: Verdana, sans-serif;">It is very popular because it is easy to use and is reliable and also requires very less components to build a full featured UART interface from it.</span></div>
<div>
<br /></div>
<div>
<span style="font-family: Verdana, sans-serif;">For example when compared with others like <a href="http://www.prolific.com.tw/US/ShowProduct.aspx?pcid=41" rel="nofollow" target="_blank">PL2303</a> it doesn't require a crystal oscillator externally.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">And one other advantage over Pl2303 is that it doesn't hang. Sometimes if the PL2303's internal FIFO buffer overflows then it will hang the driver as a result it won't work until computer is restarted and also since the driver is hung it will not respond to OS kill messages sent during Shutdown, so you will have to FORCE shutdown your computer.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Ok so the FT232R is available on breakout boards from many stores like sparkfun, adafruit etc and also on ebay. But many breakout boards just provided connections for the basic RX, TX , VCC and GND pins only.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">If you ever try to use an FTDI serial-bridge as a arduino programmer (via bootloading), then you will know that we also require the DTR pin of the FT232R.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Another thing is that there is IO voltage selection pin on FT232R which can be used to switch the IO levels between 3.3v and 5v, this is also not broken out.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">So keeping in mind all these extra features i designed a simple but fully loaded PCB design for the FT232RL, it contains all the features i talk above like IO voltage selection, broken out DTR, RTS and CTS pins and also multiple GND pins and 5v and 3.3v supply output.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Here is the schematic below:</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4RLnhWmp-PidreI1OAllpw91aKTi1hTA3LVpgcZusEgteNcuMnuxXsN7N2Kx8KKNY3PXaYNgb8FDu8dqJkv3vGX9mCQdnGxyKXTUv2TsPzTW2t_KnoNltIYAt0x0HBmfZbMaCTqfO1ARa/s1600/sch.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4RLnhWmp-PidreI1OAllpw91aKTi1hTA3LVpgcZusEgteNcuMnuxXsN7N2Kx8KKNY3PXaYNgb8FDu8dqJkv3vGX9mCQdnGxyKXTUv2TsPzTW2t_KnoNltIYAt0x0HBmfZbMaCTqfO1ARa/s1600/sch.png" height="294" width="640" /></a></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">And below is board layout (warning! not to scale use the pdf from repository for printing).</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKCVag6n6K1N0SFigHa9djIYrso7_Z0zpsMMDpVfqWCpCdHSR6SqIyKUoyGekmyI4WLjKwgxw4VOFm3RKzxRKLceq5g7vUU5VzwrXn1ZD8mLGaG6ldRFQuHtumQ0vpzhqCnPr0D787QSWn/s1600/board.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKCVag6n6K1N0SFigHa9djIYrso7_Z0zpsMMDpVfqWCpCdHSR6SqIyKUoyGekmyI4WLjKwgxw4VOFm3RKzxRKLceq5g7vUU5VzwrXn1ZD8mLGaG6ldRFQuHtumQ0vpzhqCnPr0D787QSWn/s1600/board.png" height="393" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
<span style="font-family: Verdana, sans-serif;">For soldering the components you can take help of this image.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9-Eir6CgC6JseuJ_3uqcVUmh_G7fdFQPOkR9d-G5yrQli9oLpwAQUUchsnyDOLKp11XnCP_v67d8w9wcCM4BJGfGVkLAkKSVQJGmaMKn8G2tJjINxBJw9j4vInDM9WQiRcwbN3Uivd5XF/s1600/components.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9-Eir6CgC6JseuJ_3uqcVUmh_G7fdFQPOkR9d-G5yrQli9oLpwAQUUchsnyDOLKp11XnCP_v67d8w9wcCM4BJGfGVkLAkKSVQJGmaMKn8G2tJjINxBJw9j4vInDM9WQiRcwbN3Uivd5XF/s1600/components.png" height="356" width="640" /></a></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">If you observe my design you will find that i have included two USB connectors one USB-A type board mount plug and another micro-USB Connector. That is more of something like an experimental thing i was doing. But you don't need to bother with that micro-USB just use the USB-A type connector.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Two jumpers will be required to connect the Blue lines(bottom side of board) in the above image.</span></div>
<div>
<br /></div>
<div>
<span style="font-family: Verdana, sans-serif;">For printing the board layout use <a href="https://github.com/neutronstriker/FTDI_BREAKOUT/blob/master/ftdi.pdf?raw=true" target="_blank">ftdi.pdf</a> file from the repo.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<div>
<span style="font-family: Verdana, sans-serif;">You can find all the Eagle Design files from here <a href="https://github.com/neutronstriker/FTDI_BREAKOUT" target="_blank">https://github.com/neutronstriker/FTDI_BREAKOUT</a>.</span></div>
</div>
<div>
<br /></div>
<div>
<span style="font-family: Verdana, sans-serif;">After building the final product will look like this, <i>at least thats what mine looks like</i> :D</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhqSBGTo4bAdT299XuX-XRFT9y5cPjFcdhvnN_CMDl7RtJM2kAZtPgJr358ULrTQzBrXptNTAUAhBEGHpx62nOtWsIBFXIkrNRueMKJ9fmNOqBdQE_LANlq92gTfmvMgvtUcA7y6Anq3PB/s1600/20141003_162331.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhqSBGTo4bAdT299XuX-XRFT9y5cPjFcdhvnN_CMDl7RtJM2kAZtPgJr358ULrTQzBrXptNTAUAhBEGHpx62nOtWsIBFXIkrNRueMKJ9fmNOqBdQE_LANlq92gTfmvMgvtUcA7y6Anq3PB/s1600/20141003_162331.jpg" height="640" width="480" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT0J-Wthvo_yzTfXFzdxWddSstzE0v8bCvodbtr-okHNgC3Hw9Kdi6raKwqxHMcaxygJa71aHEmO2pqc3IbjUwaspINg_SC3qeNnXr_ZJtCpuLw-fQf65l4PMkQD75EvoTb1vv5egoC2U9/s1600/20141003_162340.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT0J-Wthvo_yzTfXFzdxWddSstzE0v8bCvodbtr-okHNgC3Hw9Kdi6raKwqxHMcaxygJa71aHEmO2pqc3IbjUwaspINg_SC3qeNnXr_ZJtCpuLw-fQf65l4PMkQD75EvoTb1vv5egoC2U9/s1600/20141003_162340.jpg" height="640" width="480" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;">So thats all and thanks for reading, if you have any queries or ideas just leave a comment.</span></div>
</div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com8tag:blogger.com,1999:blog-3000131606333098557.post-3737764555239967482015-01-07T10:11:00.001-08:002015-01-07T10:15:23.173-08:00Simple Hexapod<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;">Now most of you reading this article might have seen robots or remote controlled vehicles that move using wheels because people generally build robots that run on wheels.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">But sometimes the flexibility and agility achieved by having a few pair of legs on your robot really outweighs the simplicity of wheels.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">So i finally decided to build a <a href="http://en.wikipedia.org/wiki/Hexapod_%28robotics%29" rel="nofollow" target="_blank">Hexapod</a>. I had built some wheel based robots before, but building a hexapod was really a quite interesting job.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">I was inspired to build this after i saw a video of <a href="https://www.pololu.com/docs/0j42/all" rel="nofollow" target="_blank">Polulu Simple Hexapod walker</a>, which i felt was like one of the quite simplest hexapods to built.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Below are some images of my little Hexapod.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_8NuYn3BjJ7C5HjeHOzXLiRAHJ39AiKkdeyAGWUI4JbknEc1mImXgqrF7ZnuzCmIOZrfExVt7KP72y4tHzTIHju95luNiYvYnuizhLr0BUgP6kgh-0zglCrjMNvj2yeLZj8Y0Qnt9HMBg/s1600/20141129_011637.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_8NuYn3BjJ7C5HjeHOzXLiRAHJ39AiKkdeyAGWUI4JbknEc1mImXgqrF7ZnuzCmIOZrfExVt7KP72y4tHzTIHju95luNiYvYnuizhLr0BUgP6kgh-0zglCrjMNvj2yeLZj8Y0Qnt9HMBg/s1600/20141129_011637.jpg" height="480" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: center;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD9q-pTzOXhtgqYE9SKbySXF8W_lpph-ZDchEHnpsin2LRt_woNMEyKO1SS4aZDgYHUuy8IUY7MvONn8mvY7w6oLowqj-yS728a8hGeJ__rHoLpfWBh_JULuXZRAm7jNYNrVbib_0TVKtO/s1600/20141129_011629.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD9q-pTzOXhtgqYE9SKbySXF8W_lpph-ZDchEHnpsin2LRt_woNMEyKO1SS4aZDgYHUuy8IUY7MvONn8mvY7w6oLowqj-yS728a8hGeJ__rHoLpfWBh_JULuXZRAm7jNYNrVbib_0TVKtO/s1600/20141129_011629.jpg" height="240" width="320" /></a></div>
<br />
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; text-align: left;">My build structure and technique is nearly same as Pololu walker. A few differences are that:-</span><br />
<span style="font-family: Verdana, sans-serif; text-align: left;"><br /></span>
<span style="font-family: Verdana, sans-serif; text-align: left;">I used cycle spokes to build its legs instead of large size paper clips, because cycle spokes are undoubtedly more stronger in enduring the load before they bend and also easily available. </span><br />
<span style="font-family: Verdana, sans-serif; text-align: left;"><br /></span></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNAsozzrucMbMyZ6Hczlh77H92ubEtm0W1BMJz8GmHb1_4OpEPMNGVbzwKBz9EMcSvXbs_29VaNw1Rfd81LGOC0-jySbqvwvwbD67MMsUyA_UmH2hdu2sfHFEF3z8plr4HwMUwasm93B0c/s1600/20141129_011644.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNAsozzrucMbMyZ6Hczlh77H92ubEtm0W1BMJz8GmHb1_4OpEPMNGVbzwKBz9EMcSvXbs_29VaNw1Rfd81LGOC0-jySbqvwvwbD67MMsUyA_UmH2hdu2sfHFEF3z8plr4HwMUwasm93B0c/s1600/20141129_011644.jpg" height="240" width="320" /></a><span style="font-family: Verdana, sans-serif;"><br /></span><br />
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">And i used an Atmega8 micro-controller instead of the Pololu micro maestro to control the 3 servo motors to move its legs.</span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">But Gait is same as that of Pololu walker. However i didn't get the time to develop the lateral movements i only wrote the code for Front and Back movements.</span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">The connections are quite simple just simply choose any 3 IO pins as your servo control pins and connect the servo channels directly to those. </span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">To build it i just placed the servos together in position and glued (using hot-melt glue) and taped everything just to be sure. Then glued the legs (made by bending cycle spokes) to the servo attachment and then fixed it with the Servos.</span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">I have written a software based servo control driver program for Atmega8 which can be adapted to build a Soft-Servo library for AVR micro-controllers. It just requires one 8-bit timer-interrupt. <a href="https://github.com/neutronstriker/TinyHexapod" target="_blank">https://github.com/neutronstriker/TinyHexapod</a> is the link to the code.</span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">Here is my hexapod in action. </span></div>
<div style="text-align: left;">
<br /></div>
<div align="center">
<iframe allowfullscreen="" frameborder="0" height="312" src="//www.youtube.com/embed/eEiKT8PZ-l8" width="512"></iframe>
</div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;">So if you have any questions or ideas just leave a comment.</span></div>
</div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com4tag:blogger.com,1999:blog-3000131606333098557.post-56896935517042420682015-01-07T03:46:00.005-08:002015-01-08T01:47:43.362-08:00Do it Yourself Power-Bank Part-3<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So the <a href="http://www.xmechatronics.com/2014/12/do-it-yourself-power-bank-part-2.html" target="_blank">previous part(part-2)</a> was completely about working and construction of <i>Control Circuit</i>. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Since we have built the <i>Control circuit</i> and also adjusted and connected the <i>Booster circuit</i> to <i>Usb socket</i>, now its time to connect the dots and complete the Puzzle.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">See below to understand how to connect all the parts that we have gathered or built so far.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjveOZI4r9cU_hwfCl0ap9Mamyk_kaBriKFQeLkY4uU5D1cycaGF1XfqUTt6kcf9GBmLLRb3m3a6WFBSeR7EEXlcVjNaVHlOPAmExLSHsPQ7cjFQ3I0MqY4c-D_Fs2A7IOBuaCez0lsOVBc/s1600/connection.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjveOZI4r9cU_hwfCl0ap9Mamyk_kaBriKFQeLkY4uU5D1cycaGF1XfqUTt6kcf9GBmLLRb3m3a6WFBSeR7EEXlcVjNaVHlOPAmExLSHsPQ7cjFQ3I0MqY4c-D_Fs2A7IOBuaCez0lsOVBc/s1600/connection.png" height="534" width="640" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Now after you gathered all parts and connected them together as shown above, all you need is a decent housing (plastic case ) for your Powerbank. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">What i generally do is get a plastic box from the General store and make necessary holes or modifications in it and use it, but i</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">t is upto you for what type of housing you would like to use.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Here are some images of mine below:</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigkN4kaolgUIDRzl-Aw42j5K3Dfp-CgFYLvJ4DePvHURmRYug_vmMWdexSXRP6x6Nn5tLwvLx2C0Dxihpdp7ibeOuwOlClNy4v9UV7twMMu28UCuA4npvkkG_X2UbT3S5bR9KinLt4i4SH/s1600/20141024_012123.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigkN4kaolgUIDRzl-Aw42j5K3Dfp-CgFYLvJ4DePvHURmRYug_vmMWdexSXRP6x6Nn5tLwvLx2C0Dxihpdp7ibeOuwOlClNy4v9UV7twMMu28UCuA4npvkkG_X2UbT3S5bR9KinLt4i4SH/s1600/20141024_012123.jpg" height="300" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXkAOCaUBladvjXhpVVBC14ZrztlZbpIvW9ZcXrnzpooT2G2L3V-xJ9Xfj4AaQdmZWCrzwEStJI4MLs3oJ1cNiMdpGbcv58fBW1dHUJJsMlyDBRTCLZ6wfvxZ81FGhGwhcEA3erTE2U4VW/s1600/20141024_012132.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXkAOCaUBladvjXhpVVBC14ZrztlZbpIvW9ZcXrnzpooT2G2L3V-xJ9Xfj4AaQdmZWCrzwEStJI4MLs3oJ1cNiMdpGbcv58fBW1dHUJJsMlyDBRTCLZ6wfvxZ81FGhGwhcEA3erTE2U4VW/s1600/20141024_012132.jpg" height="300" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB6iVC-MwL1tw2mdMSTZSaJ9uSvJ1C5xdPF8i8YTstnn-h8dg9s8q_o0tr-JTGVFtm8xeOsggXMZ4GIMq2tGpyqNOBQDU2SkpPpHFYnqHT3JDmBRc_uHLoZjhsv4zgcPI2gACZhB6N3SUv/s1600/20141024_012145.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB6iVC-MwL1tw2mdMSTZSaJ9uSvJ1C5xdPF8i8YTstnn-h8dg9s8q_o0tr-JTGVFtm8xeOsggXMZ4GIMq2tGpyqNOBQDU2SkpPpHFYnqHT3JDmBRc_uHLoZjhsv4zgcPI2gACZhB6N3SUv/s1600/20141024_012145.jpg" height="300" width="400" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So if you have built it successfully then congrats you have made yourself a Powerbank that you can use when your mobile battery is out of power or to power other electronic portable devices that are generally powered by computer USB port(5v).</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But if you are stuck somewhere in the build process then you can just leave a comment and i will try to help you out.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">And finally a demo video of it in action:</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div align="center">
<iframe allowfullscreen="" frameborder="0" height="270" src="//www.youtube.com/embed/h6-a6088CK4" width="480"></iframe> </div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Some extra stuff:</b></span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b><br /></b></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The batteries that i have used here are from one of my old laptop battery pack. I had said that in 1st part of this series that i will explain how to use old laptop batteries. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">I took 3 cells and connected them in parallel ( i.e. positive to positive and negative to negative). So since each cell was of 4.2v and 2600mAh then my total rating is 4.2v 7800mAh.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Most laptop battery-packs internal contain these 18650 size Li-ion batteries in parallel sets of 3 or 4 Cells in series.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">If your laptop battery is of 10.8v or 11.1v then it will contain generally 3 cells in series and 1 or more sets in parallel. If it is 14.4v then it will contain 4 cells in series and the rest is same.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The capacity generally written on battery as 4400mAh or 5600mAh or 2600mAh is defined by the battery material concentration itself and the number of battery sets in parallel.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGvA9Do9C_vICnlOXVJqUfW-_t-dXF-JJKvTOZTjv_sPN26dBA9ZuozLCewi6Y3IC9FiOZuiEi1EABI71ezW9TWW5AfJUtNWLUnsI8xjpmoMVnZygIdQpJVkYd5xA23BHwHjycD3W-3Uj9/s1600/laptopbatt_internal.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGvA9Do9C_vICnlOXVJqUfW-_t-dXF-JJKvTOZTjv_sPN26dBA9ZuozLCewi6Y3IC9FiOZuiEi1EABI71ezW9TWW5AfJUtNWLUnsI8xjpmoMVnZygIdQpJVkYd5xA23BHwHjycD3W-3Uj9/s1600/laptopbatt_internal.jpg" height="480" width="640" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The above image has 3 cells in series and 2 such sets in parallel. Each cell was of 2600mAh so the total capacity rating would be 10.8v 5200mAh.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">When the laptop informs us the laptop battery is damaged or the capacity has depleted to very low. Most of the time it happens so that the actual cells still have 80% of juice in them.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But the battery gauge (a chip which calculates battery capacity and wear) gives wrong information. Unfortunately it is not possible most of the times to reset or override this and bring back the battery to life. Because the battery gauge chip communicates all information on a one way like traffic from battery to motherboard(from the computer we cannot send data to the battery) and even if you get your hands dirty and open up the battery to directly reprogram the chip it sometimes it stores most of its calculation info deep down locked in its protected memory.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Most battery gauge chips nowadays come with advanced security features such that if we try to tamper with their data then it will lock itself and show the battery as dead when inserted in computer.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">As you can see in the above picture the battery-packs are not manufactured to be refurbished or dis-assembled and re-assembled again. Because the top and base covers which are made up of plastic are fused together. So once you try to open them it will definitely break some part of the cover.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxHC5p2lG6CtHj_htia2_16lLQtijOYOFxNBEeYQ7-SgB6_2tSQnFu5sZhOOQsEI-VHPYZFTZtOxpPBTK8QejJ9OSNbDgh5Vaay0VAGAfDGbZ3b1x1Akx4FTrKd4m1ENtcsSzZ0OFwWDNo/s1600/IMG_0439_2.preview.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxHC5p2lG6CtHj_htia2_16lLQtijOYOFxNBEeYQ7-SgB6_2tSQnFu5sZhOOQsEI-VHPYZFTZtOxpPBTK8QejJ9OSNbDgh5Vaay0VAGAfDGbZ3b1x1Akx4FTrKd4m1ENtcsSzZ0OFwWDNo/s1600/IMG_0439_2.preview.jpg" height="426" width="640" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">If you are lucky enough then you may be able to open it up without breaking the cover. However we don't need the cover. What we need to do is the remove the battery connection from the circuit safely by proper desoldering.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Then disconnect the batteries in series and divide them into individual pieces and then check each cell's voltage using a multimeter.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Now those cells which have a voltage of 2.8v (strictly) or more can be used rest are to be disposed of safely or sent for recycling. If you try to charge a battery which has less than 2.8v it <b>could pose dangerous threats like explosion. </b>So you are at your OWN RISK.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">And before finally using it you should like charge it at 4v to 4.2v maximum constant voltage and monitor if the battery temperature starts increasing then get rid of it. I would recommend you to charge at 4v only because it is safe(float charging) as at 4v you can leave the battery connected to the charger for like ever and it won't harm the battery. But this method of charging is slower and charges a Li-ion to 80% of its full capacity only.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Its normal for most used cells to decrease voltage quickly when loaded but you can do a quick calculation and find out its real capacity by giving a constant load that shouldn't exceed current draw by 70% of the maximum rating of the battery.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So this was a quick intro regarding re-usage of laptop battery cells in Robotics or electronic projects. If you have any doubts you can post a comment.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">DISCLAIMER: ALL INFO PROVIDED IN HERE IS GIVEN "AS IS" WITHOUT ANY WARRANTIES AND SUITABILITY OR FITNESS FOR ANY PARTICULAR TASK ARE DISCLAIMED. THE AUTHOR IS NOT LIABLE FOR ANY LOSS ARISING DIRECTLY OR INDIRECTLY DUE TO USAGE OF GIVEN INFORMATION. THE AUTHOR IS NOT RESPONSIBLE FOR WHATEVER PURPOSE THE GIVEN INFORMATION IS USED FOR AND THE CONSEQUENCES ARISING DUE TO IT.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">!! USE IT AT YOUR OWN RISK. !!</span></div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com23tag:blogger.com,1999:blog-3000131606333098557.post-17233759776895150542014-12-30T09:55:00.002-08:002015-01-08T12:15:53.547-08:00Do it Yourself Power-Bank Part-2<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">This is the 2nd Part of the DIY Powerbank Tutorial. Link to the first part is <a href="http://www.xmechatronics.com/2014/12/do-it-yourself-power-bank-part-1.html">here</a>. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So far we have covered the basic working principle of the Powerbank. List of Parts required and description of some parts.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Now we will work on the part called "Control circuit". This will work as the <b>Brain</b> of the Powerbank. Let me just give you a brief idea of the functions the control circuit will deal with.</span><br />
<span id="goog_1045424744"></span><span id="goog_1045424745"></span><a href="https://www.blogger.com/"></a><br />
<ul style="text-align: left;">
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">It will show you the battery level of the Powerbank.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Provide a soft turn-on and turn-off mechanism. It is necessary to turn-off the device when not in use otherwise a lot of power will be wasted by the boost converter.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Provide indication of charging while the powerbank is charging.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Turn-off the boost converter when the internal battery is very low, otherwise the powerbank battery will be so depleted that it can't be charged anymore.</span></li>
</ul>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Well to say precisely it is control circuit that can be used for any battery operated device. Because any device that operates on rechargeable batteries requires those above mentioned functions to be carried out by some circuit.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9uZHz6Y5ECZAn8yafwapNdKL6fJVIQPhneKINnqxm_D8tAl2DF33mfRIyGiqjF1wBlsGvdg9q1xS7hDKtmAZCP_cawwq4GU0hgkPkziXBlQ254GqZR36Lu7rNQSV5Xh6tlO5Xvb3URIzx/s1600/20141024_012157.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9uZHz6Y5ECZAn8yafwapNdKL6fJVIQPhneKINnqxm_D8tAl2DF33mfRIyGiqjF1wBlsGvdg9q1xS7hDKtmAZCP_cawwq4GU0hgkPkziXBlQ254GqZR36Lu7rNQSV5Xh6tlO5Xvb3URIzx/s1600/20141024_012157.jpg" height="480" width="640" /></a></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So in the picture the control circuit in the center is shown, on the right is Step-up/boost converter and below it is the Usb socket mounted on a DOT-PCB.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">You can see that the circuit is not clean because </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">while designing the circuit</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> i selected a component which was not available in the market and realised the mistake after fabricating the circuit. So i had to fork my way around by cutting traces and using jumpers.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But now i have corrected that error and redesigned the circuit completely. So that anyone can easily fabricate it.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The major components in this circuit are ATTINY45 microcontroller, 74HCT595 shift-register, and BSO119N03S a N-channel Power E-MOSFET, which drops minimum voltage and has very low leakage.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Below is the schematic of the Control circuit.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBZkinXrtx66bXmDLQQGZd-GYivtZGGlWNx3PLsiWuFILEIBRZmnR5zGube0O1uioDIekCl3M-iql8ta-Ein-32oyCDdscf_c-B4mhSIhnL6pkwEehSQFcilFNuWOKhSSxYvghg9wQ2_oG/s1600/schematic.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBZkinXrtx66bXmDLQQGZd-GYivtZGGlWNx3PLsiWuFILEIBRZmnR5zGube0O1uioDIekCl3M-iql8ta-Ein-32oyCDdscf_c-B4mhSIhnL6pkwEehSQFcilFNuWOKhSSxYvghg9wQ2_oG/s1600/schematic.png" height="300" width="640" /></a></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> However you can download the schematic and board layout files designed in EAGLE from <a href="https://github.com/neutronstriker/Powerbank_EC" target="_blank">https://github.com/neutronstriker/Powerbank_EC</a>.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">And this is the layout</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDNgbaDEronJukDqlj4nw7tc1SuwvsT8FvCzMaGuksqUIU_5eyunf4Sc1hyIuBlzrUrgDSUIrjNTlU6POsECXxttMcDyTWLFWPwH3WrPeZUKpmgfhj4sdQtsZU-WiydnSy3wVfDMxjXmBa/s1600/board.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDNgbaDEronJukDqlj4nw7tc1SuwvsT8FvCzMaGuksqUIU_5eyunf4Sc1hyIuBlzrUrgDSUIrjNTlU6POsECXxttMcDyTWLFWPwH3WrPeZUKpmgfhj4sdQtsZU-WiydnSy3wVfDMxjXmBa/s1600/board.png" height="385" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">This version is little different than what mine looks like because my actually prototype had some problems. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Mind that the above image is not according to scale so just download <a href="https://github.com/neutronstriker/Powerbank_EC/blob/master/Powerbank_EC.pdf?raw=true" target="_blank">Powerbank_EC.pdf</a> and print in on paper without any scaling then you will get the correct size, or you could download the whole repository from link above and download the eagle files and print them.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipUM_kS-MjJ_jTE5-TMsi0bOiffg35hfJFzjxz_Ow1k4PFIBGxDaYXy2FO9oUsnHglCBZ5E6Gsef0UZ15p8lXrVaCeQyCPJ8IZjtfiXrTwepwUTYCPfacD2LZcLe8T16eHBjjhNMMiYqA3/s1600/board+components.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipUM_kS-MjJ_jTE5-TMsi0bOiffg35hfJFzjxz_Ow1k4PFIBGxDaYXy2FO9oUsnHglCBZ5E6Gsef0UZ15p8lXrVaCeQyCPJ8IZjtfiXrTwepwUTYCPfacD2LZcLe8T16eHBjjhNMMiYqA3/s1600/board+components.png" height="350" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<br /></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">After you have fabricated the board you can solder the components on to it by taking help from the above image.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b><i>Now the Working:</i></b></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So i will just briefly explain the working of the circuit. </span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The attiny45 is loaded with a program which continuously monitors the battery level of the Powerbank using ADC and Voltage divider configuration. When it falls below the programmed minimum value it will display warning, but when battery falls below reserve threshold the Control Circuit turns of the powerbank automatically.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">While the device is off the attiny45 is in powerdown(sleep) mode and boost converter is off because of the MOSFET. </span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The switch is connected to INT0 and when the powerbank is off and we press the switch for 3 seconds then it turns on. If i press the switch for 3 seconds when the device is ON it turns off.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">When the device is ON and if press the switch for only 1 second then it displays battery level.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The charging socket is connected to PCINT0 and when external charger is connected the Powerbank starts charging and the battery animation is shown.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In this circuit 6 leds are connected to a 74hc595 shift-register which takes input from Attiny45 to drive the leds. But data is sent to 74HC595 using only 1 pin instead of 3 requied(SH_CP, ST_CP, DATA) it has been possible because i am using a modified version of <a href="http://www.romanblack.com/shift1.htm" rel="nofollow" target="_blank">Shift1 technique.</a> You should read more about shift1 it is really very useful tool to multiplex your output pins when you have less number of IO pins.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Even if you don't understand the working now don't worry you can understand it clearly if you read the whole program source code. I have explained the working of the code and its relation and effect on the circuit in the code itself.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So below is the code just read through it and you will be able to understand how it works as i have explained what the code does where ever required.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<script src="https://gist.github.com/neutronstriker/733580a81a6861ff2f3a.js"></script>
<br />
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><a href="https://github.com/neutronstriker/Powerbank_TINY" target="_blank">https://github.com/neutronstriker/Powerbank_TINY</a> is the link to the source and hex files. It was written using AVR Studio 4 and Winavr. </span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Note that in the fusebit settings of ATTINY45, the clock was set to internal 8Mhz RC oscillator, brown out(BOD) was disabled, CKDIV was UNPROGRAMMED and SUT was set to default.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Thats it for now in the next part will be final assembly and demo of its working.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><a href="http://www.xmechatronics.com/2015/01/do-it-yourself-power-bank-part-3.html" target="_blank">Click here to goto Part-3 of this project</a>.</span></div>
</div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com2tag:blogger.com,1999:blog-3000131606333098557.post-50560004658752699872014-12-30T09:53:00.002-08:002015-01-06T04:44:48.100-08:00Do it Yourself Power-Bank Part-1<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Almost everyone nowadays owns a smart-phone. Obviously the merits of having a small computer(smart-phone) in your pocket is not necessary to explain.</span><br />
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But as we know every coin has two sides, this heavy computation power, packed with awe features like stunning graphics, high-speed data connectivity and great multimedia abilities require a great sacrifice of battery power. </span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So many smart-phone users spend much of their device usage time connected to the wall-outlet charger.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But while on the run when a wall-outlet was not available came to our save our G<i>reat Hero :D </i>the <b>Power-Bank.</b></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So nowadays power-banks are a usual gadget for most users and you can usually get a good bargain for quite a decent capacity power-bank in market.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But i wanted to build one on my own, just for fun and also because that technically i had most of the stuff required to build it lying around my workbench.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">And this is what mine looks like :</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4-q6uXVjG1LKR78pyfQ4mHzB4u6f04RBhUgJzRPj14kmOc9_S5za9mev3yqtXHlb-NuxazLCC3qaxyMnO_8lHS_KGGj2CXUwTtIyK8e9m-86kbhLf6BAycLFGQswteMfSI0s9IQACw4HS/s1600/20141024_012248.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4-q6uXVjG1LKR78pyfQ4mHzB4u6f04RBhUgJzRPj14kmOc9_S5za9mev3yqtXHlb-NuxazLCC3qaxyMnO_8lHS_KGGj2CXUwTtIyK8e9m-86kbhLf6BAycLFGQswteMfSI0s9IQACw4HS/s1600/20141024_012248.jpg" height="480" title="powerbank" width="640" /></a></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i><b>So lets begin....</b></i></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">I will start by listing out first what parts are required and explaining what role do they play in our project on a need to know basis.</span></div>
<div>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">The list:</span></div>
<div>
<ul style="text-align: left;">
<li><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">A couple of <a href="http://en.wikipedia.org/wiki/List_of_battery_sizes" rel="nofollow" target="_blank">18650</a> batteries. </span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><a href="http://www.ti.com/product/lm2577" rel="nofollow" target="_blank">LM2577</a> Step-Up or Boost converter.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A USB-A Type Socket/receptacle.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A control Circuit.(We need to build this one).</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A piece of Dot-PCB or veroboard for Prototyping.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Needless to say a soldering iron, and accessories like solder flux and solder wire.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Some general DIY tools.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">And finally the housing, a box in which we will fit our parts and circuits.</span></li>
</ul>
</div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The explanation:-</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The working principle of our Power-bank is very simple and is shown in the diagram below.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPOOHwlZWteIrmoeZnJ8StLndR4dd4bS0R2ukbg6wmEp5R7UCJa379QvsFvojxSD6Sw8_DyJZzLnh-ab3DACkDOiDtlpRFNeS56LZKWCuEIP5GecjKeWV-svwwA4xTg89tgFrMKIFyY3v9/s1600/operation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPOOHwlZWteIrmoeZnJ8StLndR4dd4bS0R2ukbg6wmEp5R7UCJa379QvsFvojxSD6Sw8_DyJZzLnh-ab3DACkDOiDtlpRFNeS56LZKWCuEIP5GecjKeWV-svwwA4xTg89tgFrMKIFyY3v9/s1600/operation.png" height="478" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Now the 5v DC supply available via the USB socket can be used to charge your mobile phone using your data cable. Almost all mobile phones require 5v DC input to charge-up but the current required varies from device to device. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">However most mobile phones chargers provide somewhere around 1A and thats our target too.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">And when you are not using your power-bank you can charge its internal battery with your usual mobile charger only.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>The Battery:</i></span></div>
<div>
<br /></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Now lets focus on the voltage part. It obvious that we are going to take power from those batteries i listed above. 18650 as battery size standard. It is the type of battery that most power-banks in the market contain. It is a lithium-ion rechargeable battery and even most laptop battery-packs contain these 18650 cells internally.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">!!Caution!!:- DO NOT EVER TRY TO SHORT-CIRCUIT THESE BATTERIES. IT CAN LEAD TO EXPLOSIONS AND DON'T USE LEAKY OR SWELLED OR FUMING BATTERIES. </span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">IF BECAUSE OF ANY REASON THE BATTERIES HEAT-UP, REMOVE ALL CONNECTIONS IMMEDIATELY AND DISPOSE THEM OFF PROPERLY.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">DON'T PLAY WITH STUFF YOU DON'T KNOW ABOUT. Read usage and safety information about these batteries in the datasheets if the manufacturer provides any or else the generic ones at <a href="http://www.candlepowerforums.com/vb/showthread.php?106242-Li-Ion-protection-technology-and-possible-dangers" rel="nofollow" target="_blank">here</a> or <a href="http://batteryuniversity.com/learn/article/charging_lithium_ion_batteries" rel="nofollow" target="_blank">here</a>, before proceeding any further.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKkUXNx8vcpZGC9RPmnxoBMqWLp0TlUd4xTIaUXebOVV2P1u49FOSVxmG88Eixws6dEkZxCqD2KOBRDjULgzicRPW3AWjSPRnCzN6pESdIWZhvX_MCUtMcHknSgAX7sQ_GX2iNVyQeTRy4/s1600/18650_example.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKkUXNx8vcpZGC9RPmnxoBMqWLp0TlUd4xTIaUXebOVV2P1u49FOSVxmG88Eixws6dEkZxCqD2KOBRDjULgzicRPW3AWjSPRnCzN6pESdIWZhvX_MCUtMcHknSgAX7sQ_GX2iNVyQeTRy4/s1600/18650_example.jpg" height="320" width="320" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">These lithium-ion batteries generally have a full charged voltage of 4.2 - 4.3v max at no load. But when you load them it may decrease to about 3.7v to 4v. So lets assume that the moderate working voltage would between 3.3v to 4v.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">You can get a variety of these batteries on <b>ebay</b> or other sites of various capacities and brands at various prices. So choosing the right one would be difficult. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Most batteries come at standard 2600mAH capacity.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Now the more batteries you connect in parallel more is the total capacity of your battery-pack. Suppose you get 4 x 2600mAH batteries and connect them in parallel, then their voltage will stay the same but their charge capacity will add up, so the total capacity will be 10400mAH.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Capacity of battery-pack directly translates to the number of times you can charge your mobile phone battery. Now some people might have a misconception that "my mobile battery is of 2000mAH and 10400/2000 = 5, so i will be able to charge my mobile battery 5 times" . </span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">NO thats wrong actually.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">How many times you can charge your mobile battery depends on many other factors too.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">First of all nearly 10-15 % of the battery energy is wasted as heat during conversion from 3.8v to 5v.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">Now we provide 5v to the phone but the phone's internal charging circuitry also wastes some 5 to 10% power.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">When we say 2600mAH, we mean the total charge of the battery when used from full charge to full depletion. But if you deplete a rechargeable battery completely then you can't charge it any more, because a irreversible chemical reaction will occur in it . So we can use it until the battery voltage stays above 3v.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">So that translates to roughly 70-80% of the total battery energy that is directly going into your mobile battery.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">You would be surprised to know that many of us could get these batteries from used up old laptop battery-packs, and actually <b><i>i built mine from used laptop battery only</i></b>, but there are some quirks related to using cells from a depleted laptop battery-pack. So i will explain it in the last post of this series.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">OKAY now i think we have enough info regarding batteries, lets proceed to the next part in the list. </span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>Step-Up Converter:</i></span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">The LM2577 Step-up(boost) converter. It is a DC-DC conversion circuit which takes any DC input voltage between 2.5 to 27 volts and can provide a constant regulated output anywhere between 3v to 30v, provided that the input voltage doesn't exceed the set output voltage.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><i>If the input voltage exceeds adjusted output voltage then output will start directly following input and no conversion or regulation will take place.</i></span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOIhub9Q_EGuCi9xjT92ySAN0g8yFogKL2tIDYaVGYPup_r1zlZVahId_hXikmJU3aB1xcQ8MiVC5-qpR38L-7_WpBLWRi8OXHXVDGf7x5DPWgdL9aIocvlYOLx3Gcm7XoUZqemRdzkgzz/s1600/LM2577-012.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOIhub9Q_EGuCi9xjT92ySAN0g8yFogKL2tIDYaVGYPup_r1zlZVahId_hXikmJU3aB1xcQ8MiVC5-qpR38L-7_WpBLWRi8OXHXVDGf7x5DPWgdL9aIocvlYOLx3Gcm7XoUZqemRdzkgzz/s1600/LM2577-012.jpg" height="288" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">To set the output properly first connect the battery at the input pins keeping in mind the correct polarity and then connect a multimeter across the output and keep turning the trim-pot until you get 5.0v on your multimeter.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Just take look at the video below for further clarification..</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<iframe allowfullscreen="" frameborder="0" height="390" src="//www.youtube.com/embed/VSHyd8jjPyI" width="640"></iframe>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Once the output is adjusted, the step-up converter tuning part is complete.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Now just take a piece of dot-pcb (prototyping PCB) and mount the USB socket/receptacle on it and solder its legs firmly, then solder the output pads(O+, O-) of the LM2577 step-up circuits to two wires and solder the other ends to USB socket mounted on the PCB.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdDfpLD9ybF45HRcCbG434fePX6771pqAX86WSG5bTi0tjvIan55wjFPap8eBKEj-mWE3ZL8IPAI060T7-4GdIguGZrEVvFsuhH3TSwKgr4NmayKCNioZbioWSSPIWRGUiGMs1-WT_VKfE/s1600/USB+2+A+Female.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdDfpLD9ybF45HRcCbG434fePX6771pqAX86WSG5bTi0tjvIan55wjFPap8eBKEj-mWE3ZL8IPAI060T7-4GdIguGZrEVvFsuhH3TSwKgr4NmayKCNioZbioWSSPIWRGUiGMs1-WT_VKfE/s1600/USB+2+A+Female.jpg" height="426" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So now you have setup the output portion of our project successfully.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We will look into building the Control Circuit in the next part of this blog.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<a href="http://www.xmechatronics.com/2014/12/do-it-yourself-power-bank-part-2.html" target="_blank"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Click here to proceed to the next part in this series.</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> </span></a></div>
</div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com5tag:blogger.com,1999:blog-3000131606333098557.post-81148119023312896482014-12-28T11:36:00.000-08:002015-01-20T09:37:28.885-08:00AVR 28-pin Development Board with USB support<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;">So i made a development board for the 28-pin AVR micro-controllers like the ATMEGA 8, 168p, 328p etc. some time ago.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">I made my design after i found the <a href="https://metalab.at/wiki/Metaboard" rel="nofollow" target="_blank">Metaboard</a>. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">The metaboard design fascinated me in that it was a AVR development with built-in programmer(i.e. <a href="http://www.obdev.at/products/vusb/usbasploader.html" rel="nofollow" target="_blank">Usbasploader</a> support) and also we could upload code from Arduino directly and we can also use the USB interface on-board with the <a href="http://www.obdev.at/products/vusb/index.html" rel="nofollow" target="_blank">V-USB</a> library.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Verdana, sans-serif; margin-left: 1em; margin-right: 1em;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8aCJ7lpxZuf3ksJwICt2TC5wcEbREbaiL0eCZzgc6iFGl7o5lhq6MmE9iXkFtECFhn2PJrkyLprgUc6kJ3iNPhKRsfQPPVHdhNtA5RzLCIDNow6UdBjty9Q71pTlRlXBO8U_KEoU9F-ow/s1600/IMG_4485.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8aCJ7lpxZuf3ksJwICt2TC5wcEbREbaiL0eCZzgc6iFGl7o5lhq6MmE9iXkFtECFhn2PJrkyLprgUc6kJ3iNPhKRsfQPPVHdhNtA5RzLCIDNow6UdBjty9Q71pTlRlXBO8U_KEoU9F-ow/s1600/IMG_4485.JPG" height="480" width="640" /></a></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6f7-pjNE0b29emea65aUXx_fpHg_YHHawahGp9a2SqXeoCdBo_BkL3QyzRp7Ep7PkmPwynEQgMEyv8PgrK47Ag_6bDw7aKZV0ydJ-YPPF46fJoPKCtIGMUy0PZrOvAM6L43cdOWiBJydc/s1600/IMG_4472.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a></div>
<br />
<br />
<div align="center">
<embed flashvars="host=picasaweb.google.com&hl=en_US&feat=flashalbum&RGB=0x000000&feed=https%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2F105520804031179986429%2Falbumid%2F6097969171045773905%3Falt%3Drss%26kind%3Dphoto%26hl%3Den_US" height="400" pluginspage="http://www.macromedia.com/go/getflashplayer" src="https://photos.gstatic.com/media/slideshow.swf" type="application/x-shockwave-flash" width="600"></embed>
</div>
<span style="font-family: Verdana, sans-serif;">But i had some extra requirements like a 3.3v regulated supply on-board. Also i did not want to sacrifice 2 pins for the USB connection so added a dip switch to disconnect them whenever </span><span style="font-family: Verdana, sans-serif;">necessary and some other changes as mentioned below:-</span><br />
<br />
<ol style="text-align: left;">
<li><span style="font-family: Verdana, sans-serif;"><i>Added an led which was connected to a digital I/O as well as PWM pin.</i></span></li>
<li><span style="font-family: Verdana, sans-serif;"><i>Added an extra 47uF capacitor close to VCC and GND pins.(Required to compensate ground bounce when driving motors using L293D or any other motor drivers using the same supply that powers the dev board)</i></span></li>
<li><span style="font-family: Verdana, sans-serif;"><i>Extra regulation filter capacitor added for power supply stability.</i></span></li>
<li><span style="font-family: Verdana, sans-serif;"><i>Added a 10uH inductor <i>for AVCC </i>as specified by Atmel Docs for cleaner ADC.</i></span></li>
<li><span style="font-family: Verdana, sans-serif;"><i>And finally as you can notice in the picture above <i>every I/O pin </i>has dual sockets(both male and female, you will understand the advantage only when you face the need).</i></span></li>
</ol>
<div>
<span style="font-family: Verdana, sans-serif;">You can say that my design is a bit overloaded design with whatever i could possibly add of whatever features i required.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Best of all i have tried to keep the PCB still a Single-sided one so that most people can still build it at home using toner-transfer method and common etching techniques.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Here is the layout (Warning! its not to scale, use pdf from github design files link given below)and :</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiTBRt1JmaQMqkOGAtWwCENhuqpySlr3SVMEMpp2BEGhRmPiFH4C9X-tu59qCsYBIqEjOMyrOcZ-vrHC9InAR0YVZBwe2k3oE00adOqq5EDkRAlruNcvQmdbw68GthjpkT0HdIfNlaxg6R/s1600/metaboard_mine.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiTBRt1JmaQMqkOGAtWwCENhuqpySlr3SVMEMpp2BEGhRmPiFH4C9X-tu59qCsYBIqEjOMyrOcZ-vrHC9InAR0YVZBwe2k3oE00adOqq5EDkRAlruNcvQmdbw68GthjpkT0HdIfNlaxg6R/s1600/metaboard_mine.jpg" height="609" width="640" /></a></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">and this is the schematic :</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJygSM3WTQvtZBBT5jlM5qPXcohautq1TPJa0Qy8nYgjGN4N2KLiGRVq5Px_dor-aK0ifTqZhbtWRmxhl_pcXOP94BlADth2ZmPlYfBB7avqnTeaqsuINZZCihbaAWSxrtElhWkx3XCwzw/s1600/metaboard_mine_sch.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJygSM3WTQvtZBBT5jlM5qPXcohautq1TPJa0Qy8nYgjGN4N2KLiGRVq5Px_dor-aK0ifTqZhbtWRmxhl_pcXOP94BlADth2ZmPlYfBB7avqnTeaqsuINZZCihbaAWSxrtElhWkx3XCwzw/s1600/metaboard_mine_sch.png" height="480" width="640" /></a></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<span style="font-family: Verdana, sans-serif;">You can get the board design files from here <a href="https://github.com/neutronstriker/Metaboard_mine/tree/master" target="_blank">https://github.com/neutronstriker/Metaboard_mine/tree/master</a>. It was made using Eagle Cad software. You are welcome to make any modifications if you like.</span><br />
<br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<br /></div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com17tag:blogger.com,1999:blog-3000131606333098557.post-35677567955117687432014-12-06T13:29:00.002-08:002015-01-20T09:49:53.710-08:00USB Programmer for 93c46 family EEPROMs<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">I have seen many people have been searching for a At93c46 programmer. Some time ago i built a programmer for one of my friend. So here i am publishing its source and schematic. </span><br />
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">I built the programmer using ATTINY2313 AVR micro-controller. My programmer uses <a href="http://www.obdev.at/products/vusb/index.html" rel="nofollow" target="_blank">V-USB</a> library to implement a software based USB protocol handler.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyw4F6UYCUUp-3ykEof-0pQcuPY2ZcJnLrExerJS_8KYM4xKHXH-o9gIDCQv5SUJ3iJJVs98zFXrSABhJJJEvxBSrT17fzijwJUMnCaoTQSyXsvcC178MsRNmzs78ojhTpRmlS_l4w-0qf/s1600/at93.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="color: black; font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyw4F6UYCUUp-3ykEof-0pQcuPY2ZcJnLrExerJS_8KYM4xKHXH-o9gIDCQv5SUJ3iJJVs98zFXrSABhJJJEvxBSrT17fzijwJUMnCaoTQSyXsvcC178MsRNmzs78ojhTpRmlS_l4w-0qf/s1600/at93.jpg" height="452" title="at93c46 programmer schematic" width="640" /></span></a></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">If you want the high-resolution PDF format of the schematic <a href="https://drive.google.com/file/d/0B-P7CFBtMNLhS0dWeWt5V2tTVFk/view?usp=sharing" target="_blank">here</a> it is.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">I have implemented the programmer using the USI module found in the ATTINY. However there where couple of glitches which came up when interfacing with same chip from different manufacturers. Solution for it is provided in the Host Software.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The USI module of Tiny2313 is configured to run as SPI Master mode 0.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The Source code for the programmer can be found at <a href="https://github.com/neutronstriker/VUSB_93C46_PROG" target="_blank">https://github.com/neutronstriker/VUSB_93C46_PROG</a>.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">If you want only the at93c46 interfacing library then you will only need at93c46.h and at93c46.c files from the repository.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The companion windows software is at <a href="https://github.com/neutronstriker/UBS93CxxProg" target="_blank">https://github.com/neutronstriker/UBS93CxxProg</a></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Just enter the program name in the console and press Enter it will show all the commands that are valid.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO8e19QNGqJEs6x6RWT09ldM3NZq-Jfg9XJW-6b91J5j8QLnl-7FFj9ltra0uOFSfdQQfXbcp22-r7dsRnLKug0ww62wBGRCNjMVrdYkpzMYYMNhA_4y_088Sd8BNrRCBM6tNf03Zg3nqV/s1600/ubs.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO8e19QNGqJEs6x6RWT09ldM3NZq-Jfg9XJW-6b91J5j8QLnl-7FFj9ltra0uOFSfdQQfXbcp22-r7dsRnLKug0ww62wBGRCNjMVrdYkpzMYYMNhA_4y_088Sd8BNrRCBM6tNf03Zg3nqV/s1600/ubs.jpg" height="321" width="640" /></span></a></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">I built the circuit and fit it into a small transparent case. This is what my final design looks like:</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6j764UczD_Fy4x7wgRXIwffMyOsxBOPA1r-0EeoKvuji0obf45Ztpvc_UBM6Q9uJsbXHaCUTk5Tcz_xjCpM0pR2Jbt-P2veWEAtCOGlMceveEbaAXv18YSk5I9zEf5dgwXHYnVrPyVC8n/s1600/20141015_211650.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6j764UczD_Fy4x7wgRXIwffMyOsxBOPA1r-0EeoKvuji0obf45Ztpvc_UBM6Q9uJsbXHaCUTk5Tcz_xjCpM0pR2Jbt-P2veWEAtCOGlMceveEbaAXv18YSk5I9zEf5dgwXHYnVrPyVC8n/s1600/20141015_211650.jpg" height="240" width="320" /></span></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtAS2cXBv3Cy6NclbJ0ZDjgcKH5rUSasVkAzZWcyucKpdM1i-zuG_BoASJB9JML_SIAdvHhzkp5a26L1gyT9YzYpScL3PpQ8YsVr2qBNJmsmgxy3Fc_ladWzi9Ca8gHVKrvs8ZvpJhWhKr/s1600/20141015_211627c.jpg" imageanchor="1" style="display: inline !important; margin-left: 1em; margin-right: 1em; text-align: center;"><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtAS2cXBv3Cy6NclbJ0ZDjgcKH5rUSasVkAzZWcyucKpdM1i-zuG_BoASJB9JML_SIAdvHhzkp5a26L1gyT9YzYpScL3PpQ8YsVr2qBNJmsmgxy3Fc_ladWzi9Ca8gHVKrvs8ZvpJhWhKr/s1600/20141015_211627c.jpg" height="240" width="320" /></span></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Since I designed the programmer circuit on a perfboard(DOT PCB). So i can't provide any board layouts. But you are welcome to make your own designs. Click <a href="https://drive.google.com/file/d/0B-P7CFBtMNLhQ2tiQk9qRWZFQTQ/view?usp=sharing" target="_blank">here</a> to download the schematic in .sch format.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Until now i have only added support for the c46 chip with 1KBit, but in future i may add support for c56, c66 and other members of the family. Meanwhile if any you are interested to add support for other chips, then just grab the source and modify as you like.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">If you have any suggestions or question you can post a comment.</span></div>
</div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com5tag:blogger.com,1999:blog-3000131606333098557.post-79024231524902689842014-12-05T04:02:00.000-08:002014-12-05T04:02:46.866-08:00Programming and Interfacing the Serial/UART/RS-232 port of a Computer/PC in Windows and Linux Part-2<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;">So here is the linux part of my tutorial on how to interface a serial port. Windows part is <a href="http://www.xmechatronics.com/2014/09/programming-and-interfacing.html" target="_blank">here</a>.</span><br />
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">To say the truth the programming a serial port is comparatively easier in linux then in windows.</span><br />
<br />
<span style="font-family: Verdana, sans-serif;">In linux we can open the serial port directly using the terminal emulator. As the terminal emulator has nearly the same settings like a Serial Terminal.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Below is the code for a basic SerialConsole like program which sends any characters typed to the serial port and prints received text in the terminal emulator.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<script src="https://gist.github.com/neutronstriker/911f57c642008a585a3a.js"></script>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">So first we have to override the terminal settings and then apply the settings for the serial port.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">You can compile the program directly in linux and run it. Like i wrote above make sure you have proper rights to access the serial port, or better just run the program as root user.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">So this is the end of my serial port tutorial.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">If you have any questions or suggestions feel free to post a comment.</span></div>
</div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com6tag:blogger.com,1999:blog-3000131606333098557.post-18036407112175818822014-12-03T08:39:00.000-08:002014-12-05T11:46:18.423-08:003 wire interface for 16x2 or 8x2 or any other HD44780 based LCDs.<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">When interfacing with Micro-controllers a LCD display could be a very useful tool either for debugging or displaying messages or to show result of a calculation or some other information.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In embedded World the most popular LCD is a 16x2 display i.e. 16 characters per line and 2 lines on the display. However there are other variants like 8x2 or 20x4 etc. These Displays are run by the very popular lcd controller Hitachi HD44780.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiww4k_beUGLQ7ciMdoGjKr0WqzinuzJqaAag3QxVwqjtrIDgsOP6RWOdlerwzWcTf9KxcqXN9qwI_vB497aVKdWE3omnsURDAxcSDG65pK4fPrc_BC5Dr87Owy_yjgy95Vw9yqW3SzTJCq/s1600/lcd162b-yhy.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiww4k_beUGLQ7ciMdoGjKr0WqzinuzJqaAag3QxVwqjtrIDgsOP6RWOdlerwzWcTf9KxcqXN9qwI_vB497aVKdWE3omnsURDAxcSDG65pK4fPrc_BC5Dr87Owy_yjgy95Vw9yqW3SzTJCq/s1600/lcd162b-yhy.jpg" height="283" width="640" /></a></div>
<br />
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">This display controller is the most widely used one and has lot of documentation available on the web. However while interfacing it with micro-controllers one problem arises very often. The scarcity of pins.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The HD44780 operates on a 8bit or 4bit wide bus and requires at-least 2 extra control pins(3 to be exact). So the minimum number of pins required to interface such a display is 6.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So to add a lcd to our micro-controller system we will have to sacrifice at-least 6 pins of our micro-controller. If we are using 40pin ICs like ATMEGA32 or 89C51/89S51 or 40 pin PIC then it is not much of a concern.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOsgD0dtG1JqfiFEnddvpdmu3HS6HpL7G5BhAt_-psehLpdFBWCQhf7WaeTJMODCStjcKsE5UGHk-LtUpmlIP0h4gSVTHwOrrd4BEd7L-ChlIHtZ2hf8Ew6Ktg2erMwML4OW5U7YpzoLCM/s1600/16x2-LCD-Pin-Diagram.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOsgD0dtG1JqfiFEnddvpdmu3HS6HpL7G5BhAt_-psehLpdFBWCQhf7WaeTJMODCStjcKsE5UGHk-LtUpmlIP0h4gSVTHwOrrd4BEd7L-ChlIHtZ2hf8Ew6Ktg2erMwML4OW5U7YpzoLCM/s1600/16x2-LCD-Pin-Diagram.jpg" height="347" width="640" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But if our chip has about 20 or less than that pins for IO? lets take Arduino UNO for example we have only 14 digital + 6 Analog/Digital pins. Reserving 6 pins for LCD is very tragic.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But what if we could reduce the number of pins required. This can be achieved by a very simple and effective digital logic chip : A Serial in Parallel out shift Register.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So by using a shift register either CD4094 or 74HC595 we can interface the Lcd with the help of only 3 pins.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A serial-in-parallel-out shift-register takes data-in using essentially one pin only(however another pin CLK is required to synchronise the transfer) and it has in general a 8 bit output(i.e. 8 output data pins).</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHaPHVLPADuM9rr25YtPpfvPEsQwJ8tXvpuEoQ7D7mnK5MEiB5OKiryTZhFyH6hD2tFGxM1F0aXAh983n_k0CHTXHmLpZkY7QTg3WgZmXc0DJW_qM5ZxZPxl6lAuOBF5vjQgeyP6__RCQQ/s1600/Note.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHaPHVLPADuM9rr25YtPpfvPEsQwJ8tXvpuEoQ7D7mnK5MEiB5OKiryTZhFyH6hD2tFGxM1F0aXAh983n_k0CHTXHmLpZkY7QTg3WgZmXc0DJW_qM5ZxZPxl6lAuOBF5vjQgeyP6__RCQQ/s1600/Note.jpg" height="354" width="640" /></a></div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So we send the data using only one pin of the micro-controller and then as usual the 4bit or 8bit data is given to the LCD controller by the Shift-register.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">However another pin Strobe is required to enable or disable the output of data on the pins. Because if we keep continuously sending the data and data keeps travelling on the shift-register's output pins continuously then the lcd controller can get mad.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So what we do is we actually hold the outputs until the whole 8 bits are sent into the shift register. Then we release the output pins and data goes into the lcd controller.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<script src="https://gist.github.com/neutronstriker/85b30f4578896404d1f5.js"></script>
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">But remember since we still need to control the RS(register select) and E(enable) pins of the LCD controller and that is also accomplished by the help of shift-register. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So what i did was that i connected the RS and EN pins of the LCD to the shift-register output pins and sent the same data or control byte twice; once with EN set(1) and again the same data content and RS value but EN pin value cleared(0).</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In this way the EN pin was provided with CLK.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Since i was using 4bit data bus so i had to send 4 nibbles while using Shift-register as opposed to the 2 nibbles when directly connected.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">I have made a project to demonstrate this on AVR micro-controller you can get it <a href="https://github.com/neutronstriker/SIPO_4B_LCD" target="_blank">here</a>. This project also contains an arduino sketch with the same functionality. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">However i have also made a ready made library to to integrate it with your existing programs. Here is the link to the <a href="https://github.com/neutronstriker/AVR_UTILITY_LIBS" target="_blank">library</a>. You just need to keep two files sipolcd.h and ds.h in the folder of your <main_program>.c file and and before including sipolcd.h you need to define SIPO_PORT possible values are A,B,C,D or whatever ports your AVR has.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">And then SPIN which is the DATA pin of Shift-register, STB i.e. strobe, and CLK is CLOCK.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Let me put an example here.</span><br />
<script src="https://gist.github.com/neutronstriker/2f581d71cd5797b29d26.js"></script>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">You can find other keywords in the keywords.txt file in the above mentioned library.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">And finally here is the code in action.</span><br />
<br />
<iframe allowfullscreen="" frameborder="0" height="390" src="//www.youtube.com/embed/rfwGW-oYukM" width="640"></iframe>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">We know that to be able to use the LCD with only 3 wires is cool but there are some people who have made it possible to use a lcd with Only 1 wire, That's right only 1 wire is enough. But it is a little tricky and you will have to go a little deeper with R-C time constants and frequencies etc. Here is the link to the <a href="http://www.romanblack.com/shift1/sh1_projects.htm" rel="nofollow" target="_blank">Shift1_System</a>.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">So as usual guys if you have any suggestions or questions feel free to post a comment.</span></div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com1tag:blogger.com,1999:blog-3000131606333098557.post-26744860904321579212014-09-15T19:19:00.000-07:002014-12-05T04:10:31.837-08:00Programming and Interfacing the Serial/UART/RS-232 port of a Computer/PC in Windows and Linux Part-1<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<span style="font-family: Verdana, sans-serif;">From now on in this article i will be using the <a href="http://en.wikipedia.org/wiki/Serial_port" target="_blank">Serial/COM</a>/<a href="http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter" target="_blank">UART</a> words interchangeably so dear readers please cope with it. RS-232 is also the same just that it defines the same communication protocol with different voltage levels. Read more about it at <a href="http://en.wikipedia.org/wiki/RS-232" target="_blank">RS-232 wiki.</a></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<span style="font-family: Verdana, sans-serif;">After many futile attempts of trying to write a program in C/C++ to access the serial port of a computer especially in windows, I finally succeeded in writing a simple program in C to access the serial port of windows to send and receive data.</span><br />
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Now in this era of modern computers where high-speed lan, wifi and optical fibre like communications method exist some of you might think what is the use of serial port, also most of computers nowadays don't have a serial/com port any more.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">But ask any electronic engineer or an embedded system designer or any networking engineer dealing with programming of modems, network switches etc or to my fellow hobbyists and electronic enthusiasts out there, a serial port is as important and crucial tool of their day to day requirement as you can say is a hammer is to a blacksmith.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">I agree that serial ports have disappeared from modern PCs but to fill the void and especially suited for the needs of people like us are Usb to Serial converters available in the market from many vendors to list a few FTDI232RL/230x/231x and Prolific PL2303 or Silicon labs CP2102 etc.There are many more also.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Now using them for sending and receiving data from a device having a UART is very easily accomplished in windows or linux or osx, by using the appropriate drivers for the device and using a console application like hyper-terminal or Termite in windows or Putty which is cross-platform. So that we can communicate with our device may be for programming or debugging or just for using as input/output console for example with microcontroller platforms like Arduino, AVR, ARM, PIC, 8051 etc.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">But sometimes need arises to write a custom application so that you can make it a total standalone app fine tuning it according to your requirement. </span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Like for example suppose i want a windows app to have a few buttons such that when i press a button a particular character is sent to the serial port; now i can send a character using any serial console apps described above, but suppose i need it for use by people of non-technical background to operate this. Then it would be a bad idea to think of training the end user for operating the product using a terminal app which would obviously be difficult for non-technical people instead we can just ask the end user to press a button.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">But for that we will have to build a custom app which can interface with serial port. Many people have built this kind of stuff but there are rarely good articles on the web which can explain people with very less experience in windows coding where to begin from.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">For people like me with not so much experience with windows programming it is a difficult feat to achieve especially the receiving data part(sending data is comparatively easier).</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">After doing a lot of search on the web and reading a few books i was able to send data using a program built in Visual C++/CLR dotnet. But still i was not able to receive data. I wrote this program for an embedded systems project i did "<a href="https://github.com/neutronstriker/SerialPortClr" target="_blank">Bluetooth based home automation</a>". In this project, by sending certain characters to the device using serial port i could turn on or off household electrical appliances connected to it.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">But recently i figured it out how to write a simple ( totally basic command line) program to send and receive data from serial port. well this was a good start then building upon it, I decided to build a console like Windows app in C/C++( not .net) and i can say i somewhat succeeded as i was able to send and receive data using it. I built the GUI part using wxWidgets(had to mess around a lot first to get the wxWidgets to work at beginning) and used the same C code used in the console app to deal with the UART interfacing part. Well it has a few bugs but i consider it not bad for beginners like me.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span><span style="font-family: Verdana, sans-serif;">Below you can find the complete code for the command lin<span id="goog_537024437"></span><span id="goog_537024438"></span><a href="https://www.blogger.com/"></a>e program. The program below uses <a href="http://en.wikipedia.org/wiki/Windows_API" rel="nofollow" target="_blank">WINAPI</a>. You can compile it using any free version of Visual Studio or using mingW. You can use Codeblocks also it comes with a pre-configured version of mingW.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Most of the code is self explanatory but i will explain the important ones.</span><br />
<br />
<script src="https://gist.github.com/neutronstriker/6bd040bbd5982b13768c.js"></script>
<span style="font-family: Verdana, sans-serif;"><br />Here is the link <a href="https://github.com/neutronstriker/SerialPortWin" target="_blank">https://github.com/neutronstriker/SerialPortWin</a> to whole project you can download it and modify it if you like.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">I think after going through the whole code thoroughly by now you must have understood the basics of sending and receiving data from the serial port in C using <a href="http://en.wikipedia.org/wiki/Windows_API" rel="nofollow" target="_blank">WINAPI</a>.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">So lets now proceed to make a more user-friendly app i.e. a GUI(Graphical user interface) program, which should be easy to use even by the non-programmers.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">So using the same functions used above to send and receive data i made a GUI program <a href="https://github.com/neutronstriker/GUI_SerialConsole_wx" target="_blank">GUI_SerialConsole_wx</a>. I made the GUI part using <a href="https://www.wxwidgets.org/" rel="nofollow" target="_blank">wxWidgets</a> and <a href="http://www.codeblocks.org/" rel="nofollow" target="_blank">CodeBlocks</a> IDE. <a href="https://www.blogger.com/"></a></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Well Codeblocks i a great IDE and when combined with wxWidgets makes building the GUI part as easy as possible.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Here is a screen shot of my app </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3jrSq9bNU2taETwo97C1zQdA-oAGo8WjXDjZSyi8RdUan4-hl6olg-auX1W6nFgmFwISj-fa_IwLPaYPlV3-wQOGIQCscv2_6v6vRFEsjyXlWCYd6kurRbtPCng9EiBo3AyOVKGN2XLc7/s1600/s1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3jrSq9bNU2taETwo97C1zQdA-oAGo8WjXDjZSyi8RdUan4-hl6olg-auX1W6nFgmFwISj-fa_IwLPaYPlV3-wQOGIQCscv2_6v6vRFEsjyXlWCYd6kurRbtPCng9EiBo3AyOVKGN2XLc7/s1600/s1.jpg" height="300" width="320" /></a></div>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Now if you want the program only and want to skip the hassle of searching for the dependencies then here it is <a href="https://github.com/neutronstriker/GUI_SerialConsole_wx/blob/master/bin/Release/Release.7z" target="_blank">Release.7z</a>. It contains all necessary files related to the program.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">However i have to warn you that this is test-only initial release and it has lot of bugs especially related to the receiving part. Because the program needs to actively keep polling the serial port buffer for any new characters received, So that it can be shown in the app window. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">But it requires multi-threaded programming or Inter process communication, with which i am not much familiar. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">So what i did was i used wx_timer to initiate a 1-Second timer and whenever the timer event was triggered i would display the characters in the lower Receive Data Box. Well this works but isn't a very clean solution to our problem.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">So i welcome you to modify the code and solve the issue if you like.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">For basic programming of serial port in linux please read the next part of this blog..</span></div>
</div>
</div>
neutronstrikerhttp://www.blogger.com/profile/10578356814480108464noreply@blogger.com3