<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MyWork</title>
	<atom:link href="http://mywork.sanzasystems.co.za/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://mywork.sanzasystems.co.za</link>
	<description>Let me stand next to your fire...</description>
	<lastBuildDate>Wed, 23 Mar 2011 07:21:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Design Project Progress</title>
		<link>https://mywork.sanzasystems.co.za/?p=4</link>
		<comments>https://mywork.sanzasystems.co.za/?p=4#comments</comments>
		<pubDate>Thu, 04 Nov 2010 08:38:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design Projects 3]]></category>

		<guid isPermaLink="false">http://mywork.sanzasystems.co.za/?p=4</guid>
		<description><![CDATA[<p>
Design Projects 3 &#8211; PC Controlled Machine</p>
<p>By</p>
<p>Sandile Nzimande
20002501</p>
<p>                                                 <span style="color:#777"> . . . &#8594; Read More: <a href="https://mywork.sanzasystems.co.za/?p=4">Design Project Progress</a></span>]]></description>
			<content:encoded><![CDATA[<p><strong><br />
Design Projects 3 &#8211; PC Controlled Machine</p>
<p>By</p>
<p>Sandile Nzimande<br />
20002501</p>
<p>                                                 <center>   TABLE OF CONTENTS</center><br />
</strong><br />
CHAPTER 1: INTRODUCTION</p>
<p>1.1 Introduction..……………………………………………………………………………………………………………..…………….……2</p>
<p>CHAPTER 2: BUILDING BLOCKS<br />
2.1 Building Blocks……………………………………………………………&#8230;………………………………………………..………&#8230;…..2<br />
	2.1.1 The Control Terminal…………………………………………………………………………………………………….…&#8230;.…….2<br />
	2.1.2 Switching and Power Circuit……………………………………………………………………………..….………………&#8230;..2<br />
	2.1.3 The Load……………………………………………………………………………………………………………………….……&#8230;……3</p>
<p>CHAPTER 3: PROJECT DESIGN<br />
3.1 Design……………………………………………………………………………………………………………………………………&#8230;.…3<br />
	3.1.1 Block Diagram………………………………………………………………………………………………………………………&#8230;&#8230;3<br />
	3.1.2 Circuit Diagram…………………………………………………………………………………………….………………………&#8230;..4<br />
	3.1.3 Flowchart…………………………………………………………………………………………………………………..…………&#8230;..5<br />
	3.1.4 Software………………………………………………………………………………………………………………….……………&#8230;.5</p>
<p>CHAPTER 4: RESULTS<br />
4.1 Results…………………………………………………………………………………………………………………………….…………..6<br />
	4.1.1 Values measured…………………………………………………………………………………………….……………………&#8230;..7<br />
	4.1.2 Values calculated………………………………………………………………………………………………………………..…….7<br />
	4.1.3 Formulae……………………………………………………………………………………………………………………………&#8230;..….7</p>
<p>CHAPTER 5: CONCLUSION<br />
5.1 Conclusion……………………………………………………………………………………………………………………………………..8</p>
<p>Annexure A Code Listing…………………………………………………………………………………………………….……………..9<br />
Annexure B Bill Of Materials…………………………………………………………………………………………………….…&#8230;.…16<br />
Annexure C Data Sheets…………………………………………………………………………………………………………………..17</p>
<p><br/><br/></p>
<p><center> <strong>CHAPTER 1</strong></center></p>
<p><strong>1. Introduction</strong><br />
This  PC based controller device allows one to wind cotton onto a spool using stepper motors. It consists of two stepper motors and is controlled via a computer parallel port.<br />
<br/><br/><br />
						<center><strong>CHAPTER 2</strong></center></p>
<p><strong>2.1 Building Blocks</strong><br />
The controller device is divided into 3 stages. The divisions were made according to its functions, which will offer simplicity and easy troubleshooting. The three stages are explained below.</p>
<p><strong>2.1.1 The Control Terminal</strong><br />
	 The control terminal is the computer that runs the controlling software. The software written in C++<br />
	 controls the parallel port interface by sending logic HI and LOW signals to the device being controlled</p>
<p><strong>2.1.2 Switching and Power Circuit</strong><br />
	  This is the set of transistors connected to each data line from the control terminal. This circuit offers<br />
	  significant current gains to the loads driven. The magnitude of the gains depends on the device used: </p>
<p>								Ic = hfe x Ib<br />
						where Ic =  load current, hfe = gain, Ib = input current<br />
<br/><br />
<strong>2.1.3 The Load</strong><br />
	This is a pair of stepper motors which work alongside each other to complete the given task. The first<br />
	motor is responsible for winding cotton to the spool and the second distributes the cotton evenly<br />
	across the spool.<br />
	<br/><br/><br />
							<center><strong>CHAPTER 3</strong></center></p>
<p><strong>3.1 Design<br />
3.1.1 Block Diagram</strong><br />
<br/></p>
<p><img src="http://mywork.sanzasystems.co.za/wp-content/uploads/2010/11/block.jpg"  title="Block Diagram" width="606" height="164" /></p>
<p>	Figure 3.1.1<br />
	Shown above is the block layout of the entire system. The computer controls the LPT interface,<br />
	the LPT interface sends control signals and switching circuit provides adequate power to the motors.</p>
<p> <br/><br />
<strong>3.1.2 Circuit Diagram</strong></p>
<p><br/><br />
<img src="http://mywork.sanzasystems.co.za/wp-content/uploads/2010/11/image005.png" alt="" title="Circuit Diagram" width="774" height="471" class="alignnone size-full wp-image-13" /></p>
<p>Fig 3.1.2 – As mentioned earlier this circuit is divided into 3 main stages. The first stage is the computer<br />
	that controls the whole system. The second stage, the  switching circuit which is a set of 4<br />
	transistors. Each set (Q1 to Q4 and Q5 to Q8) of these 4 transistors are identical and connect to<br />
	one stepper motor. Diodes D1 to D8 are protection diodes or snubbing diodes and provide a<br />
	safe way of dispersing the reverse current without damaging the transistor. The reverse is the<br />
	result of an inductive surge created when the coils are toggled. The last stage are the stepper<br />
	motors which connect directly to the switching circuit.</p>
<p><br/><br />
<strong>3.1.3 Flowchart</strong></p>
<p><br/><br />
<img src="http://mywork.sanzasystems.co.za/wp-content/uploads/2010/11/flowchart.png" alt="" title="flowchart" width="293" height="436" class="alignnone size-full wp-image-17" /></p>
<p><strong>3.1.4 Software</strong><br />
	The software interface for this system was written in C++ using the Bloodshed Dev C++<br />
	environment.  Figure 3.1.4 illustrates the layout of the IDE. The source code for the 3 files shown<br />
	below can be found in Annexure A.<br />
<br/><br />
<img src="http://mywork.sanzasystems.co.za/wp-content/uploads/2010/11/image012.jpg" alt="" title="Bloodshed Dev C++" width="729" height="444" class="alignnone size-full wp-image-14" /><br />
Fig 3.1.4 – Snapshot of the Bloodshed Dev C++ IDE<br />
<br/><br/><br />
						<center><strong>CHAPTER 4</strong></center></p>
<p><strong>4.1 Results</strong><br />
	                    <br/><br />
<img src="http://mywork.sanzasystems.co.za/wp-content/uploads/2010/11/image014.png" alt="" title="Mini" width="310" height="200" class="alignnone size-full wp-image-15" /><br />
			Figure 4.1.1 – The circuitry connected to each data line</p>
<p>4.1.1 Values measured using digital multimeter:<br />
	Voltages measured at LPT port pins: LOW = 0,0 v ; HIGH = 0,67 v<br />
	hfe = 240<br />
	VL = 0,68 v<br />
	Vce = 11,35 v<br />
	RL = 52,3 ohms<br />
<br/><br />
4.1.2 Values calculated:<br />
	Ic = 13 mA<br />
	Power = 24,18 W<br />
	Ib = 54 µA<br />
<br/><br />
4.1.3 Formulae:<br />
	Ic = hfe x Ib</p>
<p>	Ic  = VL  / RL</p>
<p>	P = V2 x R</p>
<p><br/><br/></p>
<p>							<center><strong>CHAPTER 5</strong></center></p>
<p><strong>Conclusion</strong><br />
This system perfomed and achieved required task but further investigation is still in progress. The main concern was the low voltage levels at parallel port and specifically the logic HI which was far less than the expected value.</p>
<p><strong>References</strong><br />
[1]		 IBM-PC Parallel Printer Port Programming Considerations, available at:<br />
		<a href="http://www.doc.ic.ac.uk/~ih/doc/par/doc/program.html">http://www.doc.ic.ac.uk/~ih/doc/par/doc/program.html</a></p>
<p>[2]		P Horowitz, W Hill, The Art Of Electronics, 2nd Ed. Cambridge University Press 1980, 1987</p>
<p>[3]		The Electronics Club – Transistors, available at:<br />
		<a href="http://www.kpsec.freeuk.com/components/tran.htm">http://www.kpsec.freeuk.com/components/tran.htm<br />
</a><br />
[4]		ePanorama.net – Powering devices from PC parallel port, available at:<br />
		<a href="http://www.epanorama.net/circuits/lptpower.html">http://www.epanorama.net/circuits/lptpower.html</a></p>
<p><br/><br/></p>
<p><strong>ANNEXURE A: CODE LISTING</strong></p>
<p>1.1 stepper-one.cpp</p>
<p><font size="1.5" color="grey"><br />
#include <stdio.h><br />
#include <conio.h><br />
#include <windows.h><br />
#include <iostream><br />
#include &#8220;delay.h&#8221;</p>
<p>/* Definitions in the build of inpout32.dll are:            */<br />
/*   short _stdcall Inp32(short PortAddress);               */<br />
/*   void _stdcall Out32(short PortAddress, short data);    */<br />
/* prototype (function typedef) for DLL function Inp32: */</p>
<p>    typedef short (_stdcall *inpfuncPtr)(short portaddr);<br />
    typedef void (_stdcall *oupfuncPtr)(short portaddr, short datum);</p>
<p>#define PPORT_BASE 0&#215;378</p>
<p>/* After successful initialization, these 2 variables<br />
   will contain function pointers.<br />
 */<br />
     inpfuncPtr inp32fp;<br />
     oupfuncPtr oup32fp;</p>
<p>/* Wrapper functions for the function pointers<br />
    &#8211; call these functions to perform I/O.<br />
 */<br />
     short  inport (short portaddr)<br />
     {<br />
          return (inp32fp)(portaddr);<br />
     }<br />
     void  outport (short portaddr, short datum)<br />
     {<br />
          (oup32fp)(portaddr,datum);<br />
     }<br />
using namespace std;</p>
<p>int main(void)<br />
{<br />
     Delay s;<br />
     HINSTANCE hLib;<br />
     short x;<br />
     int i;</p>
<p>     /* Load the library */<br />
     hLib = LoadLibrary(&#8220;inpout32.dll&#8221;);</p>
<p>     if (hLib == NULL) {<br />
          fprintf(stderr,&#8221;LoadLibrary Failed.\n&#8221;);<br />
          return -1;<br />
     }</p>
<p>     /* get the address of the function */<br />
     inp32fp = (inpfuncPtr) GetProcAddress(hLib, &#8220;Inp32&#8243;);</p>
<p>     if (inp32fp == NULL) {<br />
          fprintf(stderr,&#8221;GetProcAddress for Inp32 Failed.\n&#8221;);<br />
          return -1;<br />
     }<br />
     oup32fp = (oupfuncPtr) GetProcAddress(hLib, &#8220;Out32&#8243;);</p>
<p>     if (oup32fp == NULL) {<br />
          fprintf(stderr,&#8221;GetProcAddress for Oup32 Failed.\n&#8221;);<br />
          return -1;<br />
     }<br />
/*******************************************************/<br />
/** IF WE REACHED HERE, INITIALIZED SUCCESSFUL    ******/<br />
/*******************************************************/<br />
char direction;<br />
char speed;<br />
int n;</p>
<p>i = PPORT_BASE;<br />
//outport(0x37A,43);<br />
outport(0x037A,4); //write enable</p>
<p>while(1)<br />
{<br />
 system(&#8220;cls&#8221;); //clears screen<br />
  cout<<"Enter direction: (Enter c-clockwise, a-counterclockwise and 'q' to quit)";    cin >> direction;<br />
   if(direction ==&#8217;q')<br />
          exit(1);<br />
   cin.clear();</p>
<p>   cout<<"Speed: Slow or Fast? (s/f)..";    cin >> speed;</p>
<p>float m = 1.08;<br />
    if(speed == &#8216;s&#8217;)<br />
        n = 10;<br />
      else<br />
        n= 0;</p>
<p>    if(direction == &#8216;c&#8217;)<br />
      {<br />
     while(!kbhit())<br />
       {    outport(i,17);<br />
            s.delayMiliSeconds(n+m);</p>
<p>            outport(i,34);<br />
            s.delayMiliSeconds(n+m);</p>
<p>              outport(i,68);<br />
            s.delayMiliSeconds(n+m);</p>
<p>            outport(i,136);<br />
           s.delayMiliSeconds(n+m);</p>
<p>            outport(i,0);<br />
           s.delayMiliSeconds(n+m);<br />
       }<br />
   }<br />
        else if(direction ==&#8217;a')<br />
      {<br />
         while(!kbhit())<br />
           {<br />
             outport(i,0);<br />
            s.delayMiliSeconds(n+m);; </p>
<p>              outport(i,136);<br />
            s.delayMiliSeconds(n+m);;  </p>
<p>                outport(i,68);<br />
            s.delayMiliSeconds(n+m);;</p>
<p>              outport(i,34);<br />
            s.delayMiliSeconds(n+m);;</p>
<p>            outport(i,17);<br />
            s.delayMiliSeconds(n+m);;</p>
<p>            }<br />
         } </p>
<p>     else if(direction ==&#8217;q')<br />
          exit(1);</p>
<p>}<br />
     outport(i,0); //reset port</p>
<p>     /* finished &#8211; unload library and exit */<br />
     FreeLibrary(hLib);</p>
<p>     getch();<br />
     return 0;<br />
}<br />
1.2 delay.cpp<br />
#include <stdio.h><br />
#include <windows.h><br />
#include <time.h><br />
#include &#8220;delay.h&#8221;</p>
<p>Delay::Delay()<br />
{<br />
}<br />
Delay::~Delay()<br />
{<br />
}<br />
void Delay::delaySeconds( float seconds )<br />
{<br />
__int64 timeEllapsed;<br />
__int64 timeStart;<br />
__int64 timeDelta;</p>
<p>QueryPerformanceFrequency( (LARGE_INTEGER*)(&#038;timeDelta ) );<br />
QueryPerformanceCounter ( (LARGE_INTEGER*)(&#038;timeStart ) );</p>
<p>__int64 timeToWait = (__int64)((double)timeDelta * (double)seconds);<br />
timeEllapsed = timeStart;</p>
<p>while( ( timeEllapsed &#8211; timeStart ) < timeToWait ) { QueryPerformanceCounter( (LARGE_INTEGER*)(&#038;timeEllapsed ) );  }; }  void Delay::delayMiliSeconds( float miliseconds ) { __int64 timeEllapsed; __int64 timeStart; __int64 timeDelta;  QueryPerformanceFrequency( (LARGE_INTEGER*)(&#038;timeDelta ) ); __int64 timeToWait = (__int64)((double)timeDelta * (double)miliseconds/1000.0f); QueryPerformanceCounter ( (LARGE_INTEGER*)(&#038;timeStart ) );  timeEllapsed = timeStart;  while( ( timeEllapsed - timeStart ) < timeToWait ) { QueryPerformanceCounter( (LARGE_INTEGER*)(&#038;timeEllapsed ) ); }; }  void Delay::delayMicroSeconds( float microseconds ) { __int64 timeEllapsed; __int64 timeStart; __int64 timeDelta;  QueryPerformanceFrequency( (LARGE_INTEGER*)(&#038;timeDelta ) );  __int64 timeToWait = (__int64)((double)timeDelta * (double)microseconds / 1000000.0f);  QueryPerformanceCounter ( (LARGE_INTEGER*)(&#038;timeStart ) );  timeEllapsed = timeStart;  while( ( timeEllapsed - timeStart ) < timeToWait ) { QueryPerformanceCounter( (LARGE_INTEGER*)(&#038;timeEllapsed ) );  }; }  1.3 delay.h #ifndef __DELAY_H__ #define __DELAY_H__  class Delay { public: Delay(); ~Delay(); static void delaySeconds( float seconds ); static void delayMiliSeconds( float miliseconds ); static void delayMicroSeconds( float microseconds ); };  #endif </font></p>
<p><strong>ANNEXURE B: Bill of materials</strong></p>
<p>8 x BC237B Transistors			at 0,48c each<br />
8 x IN4007 diodes			              at 0,86c each<br />
2 x 2515-02 12v stepper motors		at R65,28c each<br />
1 x DB25 male socket			at R3,21c each<br />
1 x 1m DB25 cable			      at R75,00 each</p>
<p>Total:  R 219, 49</p>
<p>All components bought at Mantech Electronics – Durban, <a href="http://www.mantech.co.za/">http://www.mantech.co.za/</a></p>
<p><br/><br />
<strong>ANNEXURE C: Datasheets</strong><br />
<br/><br />
Transistors used:<br />
<img src="http://mywork.sanzasystems.co.za/wp-content/uploads/2010/11/bc237.jpg" alt="" title="bc237" width="1345" height="969" class="alignnone size-full wp-image-19" /><br />
<br/><br />
Stepper Motors used:<br />
<img src="http://mywork.sanzasystems.co.za/wp-content/uploads/2010/11/stepp.jpg" alt="" title="stepp" width="675" height="438" class="alignnone size-full wp-image-20" /></p>
]]></content:encoded>
			<wfw:commentRss>https://mywork.sanzasystems.co.za/?feed=rss2&#038;p=4</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
