<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.1" -->
<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/"
	>

<channel>
	<title>e-dsp</title>
	<link>http://www.e-dsp.com</link>
	<description>Digital Signal Processing, DSP, FPGA, ADC, DAC, Analog, Electronic, ATMEL, AVR, MICROCHIP, PIC, ATMega</description>
	<pubDate>Sun, 18 Feb 2007 16:48:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.1</generator>
	<language>en</language>
			<item>
		<title>How to build your own heart monitoring device, a simple ECG?</title>
		<link>http://www.e-dsp.com/how-to-build-your-own-heart-monitoring-device-a-simple-ecg/</link>
		<comments>http://www.e-dsp.com/how-to-build-your-own-heart-monitoring-device-a-simple-ecg/#comments</comments>
		<pubDate>Fri, 02 Feb 2007 19:10:16 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>DSP</category>
	<category>Electronics</category>
	<category>DIY</category>
		<guid isPermaLink="false">http://www.e-dsp.com/how-to-build-your-own-heart-monitoring-device-a-simple-ecg/</guid>
		<description><![CDATA[
I haven&#8217;t been writing for some time and I am sorry for it. During the summer I got a three week scholarship in Germany! I had a great time there, btw. I would like to greet those people now! Finally the exams are over and I wanted to share one of my projects with you. [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image76" alt="How to build your own heart monitoring device, a simple ECG?" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ecg_main.jpg" /></p>
<p>I haven&#8217;t been writing for some time and I am sorry for it. During the summer I got a three week scholarship in Germany! I had a great time there, btw. I would like to greet those people now! Finally the exams are over and I wanted to share one of my projects with you. Lately Biomedical engineering is getting more and more popular, the emerging technologies made this field change rapidly. So I gave it a try, why not?<a id="more-88"></a></p>
<p>This article should teach you how to build a simple heart monitoring device, ECG/EKG (electrocardiograph). In the United States and Worldwide million&#8217;s of people are losing their life because of heart failure. It is a disease that comes with diabetes, stress and etc. Before I continue to explain what I did, I would like to WARN you! 500mA (miliAmps) on 220V will completely destroy your nervous system (so run it from battery supply), check everything twice and you are responsible for it on you own. OK! I think I can continue. There was a student job which I wanted in the Biomedical field, so to make my CV look even better I wanted to have something from this field so I built an ECG. First what I did was I went to google.com and looked for similar projects and I found a great number of similar projects. Some were for logging data of heart disease patients, some were for some futuristic health monitoring devices and some were just for fun, as mine.</p>
<p>Let&#8217;s start with the definition what ECG is all about (taken from Introduction to Medical Electronics Application by D. Jennings, A. Flint, BCH Turton, LDM Nokes):</p>
<p>“The human heart can be considered as a large muscle whose beating is simply muscular contraction. Therefore contractions of the heart cause a potential to be developed. The measurement of the potential produced by cardiac muscle is called electrocardiology.</p>
<p><!--adsense--></p>
<p>The depolarising field in the heart is a vector which alters its direction and magnitude through the cardiac cycle. The placement of the electrodes on the surface of a patient determines the view which will be obtained of that vector as a function of time. The most commonly used electrode placement scheme is shown in Figure 1. Here the differential potential is measured between the right and left arm, between the right arm and the left leg and between left arm and left leg. These three measurements are referred to as leads I, II, III respectively. This measurement lead placement was developed by Einthoven who stated that through measurement of lead I and lead II the signal seen at lead III could be calculated. This is the most basic form of ECG lead placement: from this the various features of the heart’s depolarisation can be calculated. Clinically there is a range of lead placement schemes which incorporate limb leads and chest leads.</p>
<p><img id="image77" alt="3 Lead ECG" src="http://www.e-dsp.com/wp-content/uploads/2007/02/3lead_ecg.jpg" /><br />
Figure 1.</p>
<p>Therefore the ECG waveform shows the clinician the electrical waveforms associated with the contraction of the atria and ventricles. From an ECG a clinician may determine the relative timing of the contractions of the atria and the ventricles and assess the relative amplitude of the atrial and ventricular depolarisation and repolarisation. This information may allow the identification of mild heart block. Following a heart attack a patient’s ECG shows changes as the timing and shape of the waveform are dependent on the transmission of the waveform through the muscle tissue. This changes with ischaemic muscle damage associated with heart attacks.”</p>
<p><img id="image78" alt="Figure 2., connection diagram" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ecg_connection_diagram.jpg" /><br />
Figure 2., connection diagram</p>
<p>After a little introduction into ECG we will move on to the electronic description. The simplest way to explain how it works is to make a block diagram! The signal from the body is being amplified(the signals from the body are small and weak, ranging from 0.5 mV to 5.0 mV), filtered (to remove the noise), sampled (by sampling I mean it goes to an Analog to Digital converter aka ADC) and then sent to your computer through RS232 (wireless or any other way but RS232 was chosen because it is the simplest and fastest to make). The first two steps are shown in Figure 3.</p>
<p><img id="image79" alt="Figure 3., ECG Chain" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ecg_chain.jpg" /><br />
Figure 3., ECG Chain</p>
<p>The amplifiers we use in biomedical engineering, data acquisition or where the signal of interest is represented by a small voltage fluctuation superimposed on a voltage offset are called Instrumentation amplifiers. Instrumentation amplifiers have a high CMRR(Common Mode Rejection Ratio) which means they have the ability of a differential amplifier to not pass (reject) the portion of the signal common to both the + and – inputs. The famous producers of Instrumentation amplifiers are Texas Instruments and Analog Devices. I used the amplifiers from the second company, Analog Devices. The AD620, instrumentation amplifier, and OP97, a high precision operational amplifier. As they require negative voltage supply I generated it with the Linear LTC1044, switched capacitor voltage converter, Figure 4. The supplied voltage was 5V. The schematic is shown on Figure 5, and it was taken from this <a target="_blank" href="http://www.e-dsp.com/downloads/ecg.pdf">datasheet</a> where it is explained in more details.</p>
<p><img id="image82" alt="Figure 4., LTC1044, negative voltage generator" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ltc1044.jpg" /><br />
Figure 4., LTC1044, negative voltage generator</p>
<p><a target="_blank" href="http://www.e-dsp.com/wp-content/uploads/2007/02/ecg_schematic.jpg"><img width="392" height="203" id="image80" alt="Figure 4., ECG Schematic" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ecg_schematic.jpg" /></a><br />
Figure 5., ECG Schematic (click on it for a larger version)</p>
<p>The noise comes from muscle contractions, power line interference 50-60 Hz, electrode contact noise, noise from other electronic devices and etc. The filter for the ECG application should be a notch filter(high-pass and low-pass filter). It should filter in the range from 0.5 Hz to 50 Hz. I created a simple RC highpass and lowpass filter, in series connected (just two capacitors and resistors).</p>
<p><img id="image81" alt="Figure 5., ECG signal" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ecg_signal.jpg" /><br />
Figure 6., ECG Signal</p>
<p>The ADC I used was an internal ADC from an Atmel MCU, ATMega8. The code is here:</p>
<div class="codesnip-container" >
<div class="codesnip">
<ol>
<li class="li1">
<div class="de1">.<span class="kw4">include</span> <span class="st0">&#8220;m8def.inc&#8221;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">.def temp = <span class="kw3">r16</span></div>
</li>
<li class="li1">
<div class="de1">.equ CLOCK = <span class="nu0">4000000</span>&nbsp; &nbsp; <span class="co1">; define frequency speed</span></div>
</li>
<li class="li1">
<div class="de1">.equ BAUD = <span class="nu0">9600</span>&nbsp; &nbsp; <span class="co1">; define baud rate of sending data</span></div>
</li>
<li class="li1">
<div class="de1">.equ <span class="kw3">UBRRVAL</span> = CLOCK/<span class="br0">&#40;</span>BAUD*<span class="nu0">16</span><span class="br0">&#41;</span>-<span class="nu0">1</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">main:</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> <span class="kw3">r16</span>, <span class="re1">0b</span><span class="nu0">00100000</span>&nbsp; &nbsp; <span class="co1">; configure the ADC</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> ADMUX, <span class="kw3">r16</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> r17, <span class="re1">0b</span><span class="nu0">10000111</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> ADCSRA, r17</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; Stackpointer initialisation</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="kw4">LOW</span><span class="br0">&#40;</span><span class="kw3">RAMEND</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">SPL</span>, temp</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="kw4">HIGH</span><span class="br0">&#40;</span><span class="kw3">RAMEND</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">SPH</span>, temp</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; Baudrate configuration</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="kw4">LOW</span><span class="br0">&#40;</span><span class="kw3">UBRRVAL</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">UBRRL</span>, temp</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="kw4">HIGH</span><span class="br0">&#40;</span><span class="kw3">UBRRVAL</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">UBRRH</span>, temp</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; Frame-Format: 8 Bit</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="br0">&#40;</span><span class="nu0">1</span>&lt;&lt;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">UCSRC</span>, temp</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">sbi</span> UCSRB,TXEN&nbsp; &nbsp; <span class="co1">; TX activate</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ADC</span>:</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> r18, <span class="re1">0b</span><span class="nu0">00100000</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> ADMUX, r18</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> r19, <span class="re1">0b</span><span class="nu0">11000111</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> ADCSRA, r19</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">loop</span>:</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">in</span> r24, ADCSRA&nbsp; &nbsp; <span class="co1">; check if ADC done</span></div>
</li>
<li class="li1">
<div class="de1">sbrc r24, <span class="nu0">6</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">rjmp</span> <span class="kw1">loop</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">in</span> temp, <span class="re0">ADCH</span>&nbsp; &nbsp; <span class="co1">; fill the converted ADC value to temp</span></div>
</li>
<li class="li1">
<div class="de1">rcall serout&nbsp; &nbsp; <span class="co1">; send ADC value to RS232(to computer)</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">rjmp</span> <span class="kw1">ADC</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">serout:</div>
</li>
<li class="li1">
<div class="de1">sbis UCSRA,UDRE</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">rjmp</span> serout</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> UDR, temp</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ret</span> </div>
</li>
</ol>
</div>
</div>
<p>The results can be seen on the following pictures. I used LABView to see the ECG of my heart. I would like to mention the blog from my friend, Rich Hoeg, <a target="_blank" href="http://econtent.typepad.com/">eContent</a>. I hope you like it. <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a target="_blank" href="http://www.e-dsp.com/wp-content/uploads/2007/02/ECG.jpg"><img width="375" height="280" id="image83" alt="ECG, LABView" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ECG.jpg" /></a><br />
Figure 7., ECG Results in LABView (click on the picture for a larger version)</p>
<p><a target="_blank" title="Figure 8., ECG Results in LABView (click on the picture for a larger version)" href="http://www.e-dsp.com/wp-content/uploads/2007/02/ECG1.jpg"><img width="377" height="288" id="image84" alt="Figure 8., ECG Results in LABView (click on the picture for a larger version)" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ECG1.jpg" /></a><br />
Figure 8., ECG Results in LABView (click on the picture for a larger version)</p>
<p><img id="image85" alt="Figure 9., that's me with the electrodes (the image on the t-shirt is the logo of the Bosnian Basketball Association)" src="http://www.e-dsp.com/wp-content/uploads/2007/02/electrode_man_rofl.jpg" /><br />
Figure 9., that&#8217;s me with the electrodes (the image on the t-shirt is the logo of the Bosnian Basketball Association)</p>
<p><a target="_blank" href="http://www.e-dsp.com/images/DSCN1017.JPG"><img id="image86" alt="Figure 10., the ECG board that I created myself" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ecg_front.jpg" /></a><br />
Figure 10., the ECG board that I created myself, front (click for a larger version)</p>
<p><a target="_blank" href="http://www.e-dsp.com/images/DSCN1022.JPG"><img id="image87" alt="Figure 11., the ECG board that I created myself, back" src="http://www.e-dsp.com/wp-content/uploads/2007/02/ecg_back.jpg" /></a><br />
Figure 11., the ECG board that I created myself, back (click for a larger version)
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/how-to-build-your-own-heart-monitoring-device-a-simple-ecg/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>How to manufacture your own PCB cheaply?</title>
		<link>http://www.e-dsp.com/how-to-manufacture-your-own-pcb-cheaply/</link>
		<comments>http://www.e-dsp.com/how-to-manufacture-your-own-pcb-cheaply/#comments</comments>
		<pubDate>Mon, 10 Apr 2006 19:45:50 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>Electronics</category>
	<category>DIY</category>
	<category>RF</category>
		<guid isPermaLink="false">http://www.e-dsp.com/how-to-manufacture-your-own-pcb-cheaply/</guid>
		<description><![CDATA[
I tried to make my first professional PCB (Printed Circuit Board) and test a manufacturer for you.
I used EAGLE Layout Editor 4.16 to design this  PCB board, before this I used to make manually my own PCB (you don&#8217;t want to see them :p).

This PCB was made for the RF Receiver, a post before [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="PCB of my RF Receiver" id="image71" src="http://www.e-dsp.com/wp-content/uploads/2006/04/PCB_RF_BOARD.jpg" /></p>
<p>I tried to make my first professional PCB (Printed Circuit Board) and test a manufacturer for you.<a id="more-75"></a></p>
<p>I used EAGLE Layout Editor 4.16 to design this  PCB board, before this I used to make manually my own PCB (you don&#8217;t want to see them :p).</p>
<p><!--adsense#adsenseuclanku--></p>
<p>This PCB was made for the RF Receiver, a post before this one. The company I used to manufacture this PCB was <a target="_blank" href="http://www.batchpcb.com">BatchPCB</a>. They were the cheapest that I found on the web, I think $2.5US per square inch. They have a great <a target="_blank" href="http://www.batchpcb.com/eagle-tutorial.php?osCsid=311a28ba4f1b3b16cc0b3a94cbb36f01">tutorial</a>, as well, on how to create the gerber files, files which the manufacturer uses to create your board.</p>
<p><img alt="Gerber file, Manufacture your own PCB" id="image72" src="http://www.e-dsp.com/wp-content/uploads/2006/04/PCB_Gerber.jpg" /><br />
Gerber file for one side.</p>
<p><img alt="Manufacture your own PCB" id="image74" src="http://www.e-dsp.com/wp-content/uploads/2006/04/PCB_RF_BOARD1.jpg" /><br />
Side view of the PCB.</p>
<p><img alt="Manufacture your own PCB" id="image73" src="http://www.e-dsp.com/wp-content/uploads/2006/04/PCB_RF_BOARD2.jpg" /><br />
Bottom view of th PCB.</p>
<p>Now only your ideas and your skills are the limiting factor to make your own embedded devices <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Good luck! If I can help you somehow let me know and I would be pleased to do so.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/how-to-manufacture-your-own-pcb-cheaply/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>How to build your own wireless receiver and transmitter device? Use RF in your next embedded application design!</title>
		<link>http://www.e-dsp.com/how-to-build-your-own-wireless-receiver-and-transmitter-device-create-rf-in-your-embedded-application/</link>
		<comments>http://www.e-dsp.com/how-to-build-your-own-wireless-receiver-and-transmitter-device-create-rf-in-your-embedded-application/#comments</comments>
		<pubDate>Sat, 11 Mar 2006 21:09:34 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>Electronics</category>
	<category>DIY</category>
	<category>RF</category>
		<guid isPermaLink="false">http://www.e-dsp.com/how-to-build-your-own-wireless-receiver-and-transmitter-device-create-rf-in-your-embedded-application/</guid>
		<description><![CDATA[
Some time has passed since I wrote something for the site but it is really not my fault. The classes have started again and as always there is a great number of assignments and homework. However, I will stop bothering you with my problems, let’s get down to work. Today you cannot see an embedded [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.e-dsp.com/how-to-build-your-own-wireless-receiver-and-transmitter-device-create-rf-in-your-embedded-application/"><img id="image66" alt="RF Wireless Project, Receiver and Transmitter (RLP TLP315 MHz) with ATMega 32" src="http://www.e-dsp.com/wp-content/uploads/2006/03/RF_Project_title.jpg" /></a></p>
<p>Some time has passed since I wrote something for the site but it is really not my fault. The classes have started again and as always there is a great number of assignments and homework. However, I will stop bothering you with my problems, let’s get down to work. Today you cannot see an embedded device without RF (Radio Frequency) capabilities, without the option to transfer data wireless. <a id="more-65"></a>So I decided to make a little project that can be understood, handled and implemented by everybody; simplicity rules. I will tell you a story about RF, if you don&#8217;t like reading it, then just skip the following paragraph.</p>
<p>The scientist who developed the first remote device was born in my region and his name was Nikola Tesla. I am sure everybody heard for Tesla&#8217;s Coil, AC current and he has invented much more of the things that we use today and cannot live without them, well at least some of us use the AC current in our households :-p.  After the discovery by the Russian scientist Alexander Popov that data could be transferred through air, Tesla had decided to give it a try and to implement a remote control circuit. It was the time before the World War I, after developing first prototypes in his lab, in New York, he decided to make a public presentation of what could be accomplished. As every pioneer in any field he wasn&#8217;t understood by the people and had to deal with all kinds of reactions. He made a little boat that was the receiver and a remote control that was the transmitter. All the people were fascinated by what they saw, nobody had ever seen before somebody controlling something without touching it. Everybody considered him a wizard, not a scientist. He died as a poor man in a New Yorker hotel feeding pigeons without people knowing what kind of breakthrough he made for humanity. This is why I had to share the story because without people like Nikola Tesla who shared their knowledge and dedicated their life to make a better world you wouldn&#8217;t sit in front of your computer reading this. I think you understood the moral of the story, share your knowledge and never keep it for yourself only. I hope it will impact at least on some of you who read this.</p>
<p><img id="image67" alt="RF Receiver and transmitter modules (TLP315 RLP315) compared with a 1 Euro coin" src="http://www.e-dsp.com/wp-content/uploads/2006/03/RF_Receiver_Transmitter.jpg" /><br />
RF Transmitter &#038; Receiver modules compared with 1 Euro coin</p>
<p><!--adsense#adsenseuclanku--></p>
<p>Time to continue, sorry to those who read the story and didn&#8217;t like it. The receiver and transmitter boards (RLP &#038; TLP 315) are cheap RF modules manufactured by <a target="_blank" href="http://www.laipac.com/">Laipac Technologies</a>. A pair costs $11.95 at <a target="_blank" href="http://www.sparkfun.com/">SparkFun Electronics</a>. The frequency on which the receiver and transmitter pair works is 315 MHz, UHF (Ultra High Frequency) frequency range. I won&#8217;t explain how data is transferred through air. If you want to know more about RF and how data is transferred through air check out the free book section on my site, you will find two great books about RF. The transmitter works from 2 V to 12 V and the receiver from 3.3 V to 6 V, I supplied it with 5 V in my circuit.</p>
<p><a target="_blank" href="http://www.e-dsp.com/wp-content/uploads/2006/03/shematic.gif"><img width="360" height="356" id="image68" alt="RF Receiver and Transmitter schematic with ATMega32 ,TLP315, RLP315 operating on 315MHz" src="http://www.e-dsp.com/wp-content/uploads/2006/03/shematic.gif" /></a><br />
Schematic for the RF Project, I made only one schematic instead of two to save space (of course the TLP and RLP RF modules are connected to supply voltage as well even if it is now shown on the schematic)</p>
<p>In the datasheet I read the speed can go up to 2400 baud, however I could get it only working up to 1200 baud. In telecommunications and electronics, baud is a measure of the &#8220;signaling rate&#8221; which is the number of changes to the transmission media per second in a modulated signal. It is named after Émile Baudot, the inventor of the Baudot code for telegraphy. For example: 250 baud means that 250 signals are transmitted in one second. If each signal carries 4 bits of information then in each second 1000 bits are transmitted. This is abbreviated as 1000 bit/s (this baud part was taken from <a target="_blank" href="http://en.wikipedia.org/wiki/">Wikipedia</a>).<br />
<img id="image69" alt="RF Receiver and Transmitter signal on HAMEG Oscilloscope" src="http://www.e-dsp.com/wp-content/uploads/2006/03/RF_Signal_Oscilloscope.jpg" /><br />
Analyzing the received and transmitted signal on my HAMEG Oscilloscope</p>
<p>I used two ATMega32 microcontrollers, you can use any other with hardware USART (Universal Synchronous Asynchronous Receiver Transmitter) capabilities however I have few of them laying on my table. I had some problems with GNU C and CodeVision C to receive data over the USART so I found an example code in assembler how to transmit and receive data over the USART.</p>
<p>Here is only the receiver code, the transmitter code is in the zipped project file.</p>
<div class="codesnip-container" >
<div class="codesnip">
<ol>
<li class="li1">
<div class="de1">.<span class="kw4">include</span> <span class="st0">&#8220;m32def.inc&#8221;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Use the ATMega32 library</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; so you don&#8217;t have</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; to remember all the addresses</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; of registers</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">.def temp = <span class="kw3">R16</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Call register R16 temp</span></div>
</li>
<li class="li1">
<div class="de1">.equ CLOCK = <span class="nu0">4000000</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Set the frequency to 4 MHz</span></div>
</li>
<li class="li1">
<div class="de1">.equ BAUD = <span class="nu0">1200</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Set the baud rate</span></div>
</li>
<li class="li1">
<div class="de1">.equ <span class="kw3">UBRRVAL</span> = CLOCK/<span class="br0">&#40;</span>BAUD*<span class="nu0">16</span><span class="br0">&#41;</span>-<span class="nu0">1</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Calculate the the baud</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; rate for our crystal (4MHz)</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">.<span class="kw4">org</span> 0&#215;00&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">; Start at the 0&#215;00 location</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">rjmp</span> main&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">; Jump to main</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">.<span class="kw4">org</span> URXCaddr</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">rjmp</span> int_rxc&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; If interrupt happens jump</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; to int_rxc</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; Main program code</span></div>
</li>
<li class="li1">
<div class="de1">main:</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="kw4">LOW</span><span class="br0">&#40;</span><span class="kw3">RAMEND</span><span class="br0">&#41;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Define the addresses for</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">SPL</span>, temp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">; the stack</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="kw4">HIGH</span><span class="br0">&#40;</span><span class="kw3">RAMEND</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">SPH</span>, temp</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, 0xFF&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Put 0xFF into temp</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">DDRB</span>, temp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Set PORTB as output</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="kw4">LOW</span><span class="br0">&#40;</span><span class="kw3">UBRRVAL</span><span class="br0">&#41;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Set the baud rate</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">UBRRL</span>, temp</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="kw4">HIGH</span><span class="br0">&#40;</span><span class="kw3">UBRRVAL</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">UBRRH</span>, temp</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; Frame-Format: 8 Bit</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">ldi</span> temp, <span class="br0">&#40;</span><span class="nu0">1</span>&lt;&lt;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">out</span> <span class="kw3">UCSRC</span>, temp</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">sbi</span> UCSRB, <span class="kw3">RXCIE</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Interrupt bei Empfang</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">sbi</span> UCSRB, <span class="kw3">RXEN</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">; RX (Receiveing) activate</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">sei</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">; Activate intterupts</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">loop</span>:&nbsp; &nbsp;<span class="kw1">rjmp</span> <span class="kw1">loop</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">; Your code should be here</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">; This interrupt routine will be executed if a byte is received</span></div>
</li>
<li class="li1">
<div class="de1">int_rxc:&nbsp; <span class="co1">; int_rxc routine starts here</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">push</span> temp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">; Save temp on the stack</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">in</span> temp, UDR&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Put the received byte into temp</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">cpi</span> temp, <span class="st0">&#8216;U&#8217;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">; Compare the received byte with &#8216;U&#8217;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">brne</span> int_rxc_<span class="nu0">1</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; If not equal then go to int_rcx_1</span></div>
</li>
<li class="li1">
<div class="de1">cbi PORTB, <span class="nu0">0</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; else turn off PORTB.0</span></div>
</li>
<li class="li1">
<div class="de1">int_rxc_<span class="nu0">1</span>: <span class="co1">; int_rxc1 routine starts here</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">cpi</span> temp, <span class="st0">&#8216;0&#8242;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">; Compare the received byte with &#8216;0&#8242;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">brne</span> int_rxc_<span class="nu0">2</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; If not equal then go to int_rcx_2</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">sbi</span> PORTB, <span class="nu0">0</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; else turn on PORTB.0</span></div>
</li>
<li class="li1">
<div class="de1">int_rxc_<span class="nu0">2</span>:&nbsp; <span class="co1">; int_rxc2 routine starts here</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">pop</span> temp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; Return old value to temp that</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">reti</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">; we saved before and return to loop! </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
</div>
<p>The code is even easier to understand in assembler than it would be in C. I have created only to toggle the PORTB.0 port HIGH or LOW depending of what was received, you can easily modify the code and make an alarm system or receive some other data, you are the wizard now! Let your imagination lead you to your wishes. The next step in this project is going to be the implementation of Manchester encoding, in that case the speed will be reduced to the half of the current speed but the data transfer will have a reduced BER (Bit Error Ratio). I will dedicate another article just for telecommunications.</p>
<p><img id="image70" alt="RF Receiver and Transmitter created devices" src="http://www.e-dsp.com/wp-content/uploads/2006/03/RF_Receiver_Transmitter_ATMega32.jpg" /><br />
The created devices compared with 2 KM coin (Bosnian currency) and one Euro coin.</p>
<p><a href="http://www.e-dsp.com/downloads/RF_Project.zip">Download the complete project with Assembler source code for the Receiver and the Transmitter with pictures</a>.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/how-to-build-your-own-wireless-receiver-and-transmitter-device-create-rf-in-your-embedded-application/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>How to measure temperature with the Dallas Maxim DS1820 sensor?</title>
		<link>http://www.e-dsp.com/how-to-measure-temperature-with-the-dallas-maxim-ds1820-sensor/</link>
		<comments>http://www.e-dsp.com/how-to-measure-temperature-with-the-dallas-maxim-ds1820-sensor/#comments</comments>
		<pubDate>Fri, 17 Feb 2006 21:42:22 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>Electronics</category>
	<category>DIY</category>
		<guid isPermaLink="false">http://www.e-dsp.com/how-to-measure-temperature-with-the-dallas-maxim-ds1820-sensor/</guid>
		<description><![CDATA[
Sometimes we have a need to measure the temperature of a room, of an object or just maybe a terrarium; so it never gets too hot or too cold for your hamster and it warns the system to turn on a cold or hot fan (ok just a bit Sci-Fi)  .
It can be done [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.e-dsp.com/how-to-measure-temperature-with-the-dallas-maxim-ds1820-sensor/"><img alt="LCD Temperature reading, ATMega16, DS1820 and HD44780" id="image52" src="http://www.e-dsp.com/wp-content/uploads/2006/02/lcd_temp_title.jpg" /></a><br />
Sometimes we have a need to measure the temperature of a room, of an object or just maybe a terrarium; so it never gets too hot or too cold for your hamster and it warns the system to turn on a cold or hot fan (ok just a bit Sci-Fi) <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .<a id="more-58"></a></p>
<p>It can be done in less than 3 hours. All what you need is a microcontroller and a temperature sensor. In case you want to build just a warning system then you don’t need a microcontroller because that can be done with a comparator but next time more about comparators.</p>
<p>Today you have a great number of temperature sensors, analog and digital ones. If you want to use an ADC (Analog to Digital Converter) then you can use a thermistor for this project, however I prefer digital sensors. In this project I used the <a target="_blank" href="http://pdfserv.maxim-ic.com/en/ds/DS1820-DS1820S.pdf">Dallas Maxim DS1820 </a>(click for the datasheet) digital temperature sensor with the 1wire technology from <a target="_blank" href="http://www.maxim-ic.com/">Dallas Maxim</a>.</p>
<p><img alt="DS1820 Pinout" id="image53" src="http://www.e-dsp.com/wp-content/uploads/2006/02/sensor_ds1820_pinout.gif" /><br />
The pinout for the DS1820</p>
<p><img alt="DS1820 Scheme for using with a microcontroller" id="image54" src="http://www.e-dsp.com/wp-content/uploads/2006/02/sensor_ds1820_schematic.gif" /><br />
Scheme how I connected the DS1820 with my AVR ATMega16</p>
<p>It is not manufactured anymore but it is equivalent to its successor DS18S20. You can order a sample from Maxim, of course free of charge. This time the source code was not a problem, I found the source for this project in CodeVision’s C example folder (there are a lot of examples also for GNU AVR GCC), I just modified it a bit, I removed some of the code that we won’t need because I used only one DS1820 sensor however you can attach up to 8 sensors on one wire, cool isn’t it?!?! I had not a 4.7k resistor to connect between DQ (the middle pin from the sensor which is used to communicate with it the microcontroller and to read the temperatures) and Vdd, instead I used a 6.8k resistor; it will work fine, don’t worry. DQ is connected to I/O line 6 of PORT A. The microcontroller I used was the ATMega16 and a crystal of 4 MHz frequency; it should work with any other microcontroller as well. I won’t explain how I connected the LCD because I did it in one of my previous projects. It is connected to the PORT C, just to display the results (the current temperature).</p>
<p><img alt="DS1820" id="image57" src="http://www.e-dsp.com/wp-content/uploads/2006/02/sensor_ds1820.jpg" /><br />
DS1820, on a small board with the pullup resistor</p>
<div class="codesnip-container" >
<div class="codesnip">
<ol>
<li class="li1">
<div class="de1"><span class="coMULTI">/* The DS1820/18S20 sensors are connected to</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">bit 6 of PORTA of the ATMega16 as follows:</span></div>
</li>
<li class="li1"></li>
<li class="li1">
<div class="de1"><span class="coMULTI">[DS1820/18S20] [STK500 PORTA HEADER]</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">1 GND&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&nbsp; &nbsp;9&nbsp; GND</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">2 DQ&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&nbsp; &nbsp;7&nbsp; PA6</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">3 VDD&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&nbsp; 10 +5V</span></div>
</li>
<li class="li1"></li>
<li class="li1">
<div class="de1"><span class="coMULTI">All the temperature sensors must be connected</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">in parallel</span></div>
</li>
<li class="li1"></li>
<li class="li1">
<div class="de1"><span class="coMULTI">AN 4.7k (6.8k IN MY CASE) PULLUP RESISTOR MUST</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">BE CONNECTED BETWEEN DQ (PA6) AND +5V !</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#asm</span></div>
</li>
<li class="li1">
<div class="de1">.<span class="me1">equ</span> __w1_port=0&#215;1b</div>
</li>
<li class="li1">
<div class="de1">.<span class="me1">equ</span> __w1_bit=<span class="nu0">6</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#endasm</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* Use an 20 alphanumeric LCD connected</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">to PORTC as follows:</span></div>
</li>
<li class="li1"></li>
<li class="li1">
<div class="de1"><span class="coMULTI">[LCD]&nbsp; &nbsp;[STK500 PORTC HEADER]</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">1 GND- 9&nbsp; GND</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">2 +5V- 10 VCC</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">3 VLC- LCD contrast control voltage 0..1V</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">4 RS - 1&nbsp; PC0</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">5 RD - 2&nbsp; PC1</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">6 EN - 3&nbsp; PC2</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">11 D4 - 5&nbsp; PC4</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">12 D5 - 6&nbsp; PC5</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">13 D6 - 7&nbsp; PC6</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">14 D7 - 8&nbsp; PC7</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#asm</span></div>
</li>
<li class="li1">
<div class="de1">.<span class="me1">equ</span> __lcd_port=0&#215;15</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#endasm</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include&nbsp; // LCD driver routines</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">char</span> lcd_buffer<span class="br0">&#91;</span><span class="nu0">33</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// maximum number of DS1820/DS18S20 connected to the 1 Wire bus</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#define MAX_DEVICES 8</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// DS1820/DS18S20 devices ROM code storage area</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">unsigned</span> <span class="kw4">char</span> rom_code<span class="br0">&#91;</span>MAX_DEVICES,<span class="nu0">9</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">main<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">unsigned</span> <span class="kw4">char</span> i,j,devices;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> temp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">lcd_init<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">lcd_putsf<span class="br0">&#40;</span><span class="st0">&#8220;e-dsp.com Temperature control&#8221;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">delay_ms<span class="br0">&#40;</span><span class="nu0">2000</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">lcd_clear<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// detect DS1820/DS18S20 devices</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">devices=w1_search<span class="br0">&#40;</span>0xf0,rom_code<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">delay_ms<span class="br0">&#40;</span><span class="nu0">2000</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// check if devices were found</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>!devices<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">while</span> <span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span>; <span class="co1">// stop here if no devices were found</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* measure and display the temperature(s) */</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">while</span> <span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span>i=<span class="nu0">0</span>;i</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">temp=ds1820_temperature_<span class="nu0">10</span><span class="br0">&#40;</span>&amp;rom_code<span class="br0">&#91;</span>i,<span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">sprintf<span class="br0">&#40;</span>lcd_buffer,<span class="st0">&#8220;t%u=%i.%u<span class="es0">\x</span>dfC&#8221;</span>,++i,temp/<span class="nu0">10</span>,abs<span class="br0">&#40;</span>temp%<span class="nu0">10</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">lcd_clear<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">lcd_puts<span class="br0">&#40;</span>lcd_buffer<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">delay_ms<span class="br0">&#40;</span><span class="nu0">800</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p>The programming code I used in this project</p>
<p><img alt="The DS1820 working with the ATMega16 and displaying data on the LCD" id="image55" src="http://www.e-dsp.com/wp-content/uploads/2006/02/lcd_temp_start.jpg" /><br />
Startup display</p>
<p><!--adsense#adsenseuclanku--></p>
<p><img alt="The DS1820 working with the ATMega16, displaying temperature on the LCD" id="image56" src="http://www.e-dsp.com/wp-content/uploads/2006/02/lcd_temp_roomtempt_2.jpg" /><br />
Displaying my room temperature</p>
<p>Our new little project is able to measure temperatures from -55°C to +125°C in 0.5°C increments or Fahrenheit equivalent from -67°F to +257°F in 0.9°F increments. The 0.5°C or 0.9°F increment means you will get temperature readings like 30.5°C or 30°C but never 30.1°C (for the case with Fahrenheit it is different, only 0.9°F increments or decrements).</p>
<p>I thought for a while how to get the best (most precise) temperature reading from an object and came up with the idea of using thermal paste between the object and the DS1820. If you try it let me know how good the results were.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/how-to-measure-temperature-with-the-dallas-maxim-ds1820-sensor/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Controlling a color graphic LCD, Epson S1D15G10 Controller, with an ATMEL AVR ATMega32L</title>
		<link>http://www.e-dsp.com/controlling-a-color-graphic-lcd-epson-s1d15g10-controller-with-an-atmel-avr-atmega32l/</link>
		<comments>http://www.e-dsp.com/controlling-a-color-graphic-lcd-epson-s1d15g10-controller-with-an-atmel-avr-atmega32l/#comments</comments>
		<pubDate>Wed, 15 Feb 2006 00:54:50 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>Electronics</category>
	<category>DIY</category>
		<guid isPermaLink="false">http://www.geekland.org/e-dsp.com/controlling-a-color-graphic-lcd-epson-s1d15g10-controller-with-an-atmel-avr-atmega32l/</guid>
		<description><![CDATA[
One of the visitors of e-dsp site sent me an e-mail asking me if I could create a project where we use the LCD display from a cell phone. At first I thought it was a great idea but I already ordered another graphic LCD display to play with it. However I gave it a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.e-dsp.com/controlling-a-color-graphic-lcd-epson-s1d15g10-controller-with-an-atmel-avr-atmega32l/"><img id="image40" alt="Nokia 6100 LCD, Epson S1D15G10 Controller, with an ATMEL AVR ATMega32L" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/LCD2_title.jpg" /></a><br />
One of the visitors of e-dsp site sent me an e-mail asking me if I could create a project where we use the LCD display from a cell phone. At first I thought it was a great idea but I already ordered another graphic LCD display to play with it. However I gave it a try, I ordered the display that is used in some of the Nokia models, and I am not sure in which one.<a id="more-46"></a></p>
<p>I ordered the LCD from <a target="_blank" href="http://www.sparkfun.com/commerce/product_info.php?products_id=569">SparkFun Electronics</a> and the PCB board for it so I don’t have to solder on the small connector (I think it is not also possible to solder anything to the connector). Whatever, after a week and a half it arrived. I had a spare ATMega32L-8PI and I decided to give it a try.</p>
<p><img id="image41" alt="Bunch of parts, quarz, ATMega32L-PI8 MCU, Nokia LCD 6100, capacitors, voltage regulator TC12643.3VAB Microchip, PCB board" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/lcd_bunch_parts.jpg" /><br />
Bunch of parts used in this little DIY project: 4MHz quarz, ATMega32L-PI8 MCU, Nokia LCD 6100 with Epson S1D15G10 Controller, capacitors, voltage regulator TC1264-3.3VAB Microchip, PCB board&#8230;</p>
<p><a target="_blank" href="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/lcd2_schematic.gif"><img width="383" height="347" id="image42" alt="LCD Nokia 6100, ATMega32L and Epson S1D15G10" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/lcd2_schematic.gif" /></a><br />
Scheme of the project (click on the scheme to enlarge it)</p>
<p>I took a Perf Board and wired everything according to my schematic. I used the TC1264-3.3VAB voltage regulator from Microchip. When I was done with the soldering I found some code online by <a target="_blank" href="http://thomaspfeifer.net/nokia_6100_display.htm">Thomas Pfeifer</a> for the Nokia 6100 display but for the Philips PCF8833 controller. I tried it for this display but it didn’t work.</p>
<p><img id="image43" alt="LCD Nokia 6100 wired with the MCU ATMega32 but it doesn't work" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/lcd2_nothing_works.jpg" /><br />
Nothing works however it is not time to give up</p>
<p>However SparkFun was giving away the source code for the Epson S1D15G10 controller but it was written for the Philips ARM LPC2138. I modified both codes and believe it or not I got it working.</p>
<p><img id="image44" alt="LCD Nokia 6100 wired with the MCU ATMega32 AVR from Atmel it works" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/lcd_first_results.jpg" /><br />
It works, it displays a square in different colors (huh 2 AM)!</p>
<p><img id="image45" alt="LCD Nokia 6100 wired with the MCU ATMega32 AVR from Atmel better results" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/lcd_nice_results.jpg" /><br />
Here I made the square with one color!</p>
<p><!--adsense#adsenseuclanku--></p>
<p>Here is the part of code that makes the square</p>
<div class="codesnip-container" >
<div class="codesnip">
<ol>
<li class="li1">
<div class="de1"><span class="co1">// draw a multi-colored square in the center of screen</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span>i = <span class="nu0">0</span>; i &lt; <span class="nu0">4096</span>; i++<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">LCD_put_pixel<span class="br0">&#40;</span>i, <span class="br0">&#40;</span>i % <span class="nu0">64</span><span class="br0">&#41;</span> + <span class="nu0">32</span>, <span class="br0">&#40;</span>i / <span class="nu0">64</span><span class="br0">&#41;</span> + <span class="nu0">32</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p>The new written code uses the GNU-GCC AVR compiler, so you don’t have to buy it you can just download it, it is free. Long live the GNU, HIP HOP HUREY, HIP HOP HUREYYY . It is still under development but works fine, you can download the code and play with it. Good luck with it.</p>
<p>You can download the <a href="http://www.e-dsp.com/downloads/lcd.zip">LCD Code here</a>.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/controlling-a-color-graphic-lcd-epson-s1d15g10-controller-with-an-atmel-avr-atmega32l/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>How to use a LCD with your electronic devices?</title>
		<link>http://www.e-dsp.com/how-to-use-a-lcd-with-your-electronic-devices/</link>
		<comments>http://www.e-dsp.com/how-to-use-a-lcd-with-your-electronic-devices/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 23:04:15 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>Electronics</category>
	<category>DIY</category>
		<guid isPermaLink="false">http://www.geekland.org/e-dsp.com/how-to-use-a-lcd-with-your-electronic-devices/</guid>
		<description><![CDATA[
Almost a month has passed since I have created the Function Generator; sorry for that, it is not my fault. I had final exams so I had to learn. Finally I have holidays, so something should be going on the site. However, let’s get to the project. Today you can rarely see an electronic device [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.e-dsp.com/how-to-use-a-lcd-with-your-electronic-devices/"><img alt="LCD Title, ATMEL AVR ATMega16 and LCD Seiko L2022, HD44780" id="image28" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/LCD_title.jpg" /></a><br />
Almost a month has passed since I have created the Function Generator; sorry for that, it is not my fault. I had final exams so I had to learn. Finally I have holidays, so something should be going on the site. However, let’s get to the project. Today you can rarely see an electronic device without a LCD display, even new fridges have it. It is pretty useful to know how to use some with your device. I will show you how to connect a LCD with a Microcontroller. <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> <a id="more-34"></a></p>
<p>When you see all these weird code names please don’t get scared, they are just names like John, Michael and etc…</p>
<p>Most of the characters LCDs run on a HD44780 controller so I used one from Seiko, the Seiko L2022. You can get this one or other LCDs from <a target="_blank" href="http://www.shopeio.com">ShopEIO</a>. You can get such LCDs for less than 5$. To control this LCD I preprogrammed an ATMEL AVR ATMega 16 microcontroller (MCU).</p>
<p>I had to use my Weller solder iron, my STK500 ATMEL AVR programmer and a loupe.</p>
<p><img alt="Weller solder iron" id="image29" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/solder_iron.jpg" /><br />
My solder iron, it is quite old but Weller makes a first class solder irons.</p>
<p>In case you have never done some soldering I have found a great tutorial for you with an enormous number of photos to see how it is done <a target="_blank" href="http://www.technick.net/public/code/cp_dpage.php?aiocp_dp=how_to_solder">Link</a>. In case you ask yourself “Why the heck do you need a loupe,” it is nice to check your joints after soldering them, this way you avoid mistakes and the process of resoldering and desoldering again.</p>
<p><img alt="STK500 ATMEL AVR Development Board" id="image30" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/stk500_magnifier.jpg" /><br />
Here you can see the STK500 (the AVR programmer) and the loupe.</p>
<p><!--adsense#adsenseuclanku--></p>
<p>If you don’t have a STK500 you can use any other ATMEL AVR programmer or even build one yourself  <a target="_blank" href="http://www.linuxfocus.org/English/March2002/article231.shtml">Link</a> or <a target="_blank" href="http://www.captain.at/electronics/atmel-programmer/">Link</a>. However, I recommend to buy one because it is simpler than building it yourself and they don’t cost that much, in case you want to spend more money on a high quality programmer then get yourself the <a target="_blank" href="http://buy.allamerican.com/atmelavr.html">STK500</a>. It is easy to use and a fun to play with.</p>
<p><a target="_blank" href="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/LCD_schematic.gif"><img width="385" height="432" alt="Scheme ATMEL AVR ATMega16 HD44780" id="image32" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/LCD_schematic.gif" /></a><br />
LCD Scheme, connecting AVR with the LCD (click on the scheme to enlarge it)</p>
<div class="codesnip-container" >
<div class="codesnip">
<ol>
<li class="li1">
<div class="de1"><span class="coMULTI">/*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">LCD Demo</span></div>
</li>
<li class="li1"></li>
<li class="li1">
<div class="de1"><span class="coMULTI">CodeVisionAVR C Compiler</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">(C) 2000-2002 HP InfoTech S.R.L.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">www.hpinfotech.ro</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include &quot;mega16.h&quot;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// the LCD is connected to PORTC outputs</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// see the file lcd.h in the ..inc directory</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// 0&#215;15 is the address of PORTC</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#asm</span></div>
</li>
<li class="li1">
<div class="de1">.<span class="me1">equ</span> __lcd_port=0&#215;15 ;PORTC</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#endasm</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// include the LCD driver routines</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include &quot;lcd.h&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">void</span> main<span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// initialize the LCD for</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// 2 lines &amp; 16 columns</span></div>
</li>
<li class="li1">
<div class="de1">lcd_init<span class="br0">&#40;</span><span class="nu0">20</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// go to the firs line of the LCD (x,y)</span></div>
</li>
<li class="li1">
<div class="de1">lcd_gotoxy<span class="br0">&#40;</span><span class="nu0">0</span>,<span class="nu0">0</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// display the message</span></div>
</li>
<li class="li1">
<div class="de1">lcd_putsf<span class="br0">&#40;</span><span class="st0">&#8220;http://www.e-dsp.com&#8221;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// go to the second line of the LCD (x,y)</span></div>
</li>
<li class="li1">
<div class="de1">lcd_gotoxy<span class="br0">&#40;</span><span class="nu0">0</span>,<span class="nu0">1</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// display the message</span></div>
</li>
<li class="li1">
<div class="de1">lcd_putsf<span class="br0">&#40;</span><span class="st0">&#8220;Hello World! <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> &#8221;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// stop here, loop now</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">while</span> <span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p><img alt="ATMEL AVR ATMega16 and LCD Seiko L2022, HD44780 working" id="image33" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/LCD.jpg" /><br />
The result of our work we can see here! Enjoying, right??</p>
<p>That would be it, ain’t it easy??? In case you need more help or more details let me know. I will help you in the forum or just leave a comment. Thank you for reading this <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> !
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/how-to-use-a-lcd-with-your-electronic-devices/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Software Function/Signal generator</title>
		<link>http://www.e-dsp.com/software-functionsignal-generator/</link>
		<comments>http://www.e-dsp.com/software-functionsignal-generator/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 22:44:06 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>DSP</category>
	<category>Electronics</category>
	<category>Software</category>
		<guid isPermaLink="false">http://www.geekland.org/e-dsp.com/software-functionsignal-generator/</guid>
		<description><![CDATA[
Since we all need sometimes a simple signal generator just to test an amplifier or some circuit we just made. If you did not know, you can use your computer for that. It is just required to have a sound card. We created a little software application for you to generate a signal of different [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.e-dsp.com/software-functionsignal-generator/"><img alt="e-dsp Function/Signal Generator" id="image21" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/FunctionGenerator.gif" /></a><br />
Since we all need sometimes a simple signal generator just to test an amplifier or some circuit we just made. If you did not know, you can use your computer for that. It is just required to have a sound card. We created a little software application for you to generate a signal of different frequency and amplitude.<a id="more-27"></a></p>
<p>was searching the web for something and I found this <a target="_blank" href="http://wireless.ittoolbox.com/groups/technical-functional/visualbasic-l/222768#">source</a> by Jase. After playing a while with it and seeing that this can be used as a function generator I decided to make a little user friendly application out of it for our visitors.</p>
<p>The application is in its first beta version so it has still some things to work on but works fine and can be used so I decided to put it on E-DSP. If you are running Windows XP you will need just to download the Setup file and install it and it should work properly. In case you run another Windows operating system (98, ME, 2000) you will have to install the Visual Basic 6.0 Runtime files and DirectX 7 or above.</p>
<p>To test it, what you have to do is to plug out your speakers and plug in your cable with the same connector and that would be everything. The application includes a more detailed description and help file on how to use it.</p>
<p>I would like to thank my friends Murat, Mikael, Nedim and Zerin for testing this application.</p>
<p><!--adsense#adsenseuclanku--></p>
<p><a href="http://www.e-dsp.com/downloads/edspFG.exe">Download</a> and install this application on your own risks; we can not guarantee you anything. If you have any problems you can leave a comment and we will solve it together.</p>
<p><img alt="Function Generator Icon" id="image22" title="Function Generator Icon" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/fun_icon.gif" /> <a href="http://www.e-dsp.com/downloads/edspFG.exe">Download Function Generator - Beta 1</a> - 365 Kb</p>
<p>I included few shoots for you to see it how it works and looks like; I used my notebook as the signal generator.</p>
<p><img alt="Function generator, sine wave 1, some frequency." id="image23" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/FunGen1.jpg" /><br />
Sine wave 1, some frequency.</p>
<p><img alt="e-dsp Function/Signal generator, sine wave 2, changed the frequency." id="image24" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/FunGen2.jpg" /><br />
Sine wave 2, changed the frequency.</p>
<p><img alt="e-dsp Function/Signal generator, sine wave 3, changed the amplitude." id="image25" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/FunGen3.jpg" /><br />
Sine wave 3, changed the amplitude.</p>
<p><img alt="e-dsp Function/Signal generator, square wave 4." id="image26" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/FunGen4.jpg" /><br />
Square wave 4.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/software-functionsignal-generator/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Why do we need Amplifiers? How to build a simple one? LM 741</title>
		<link>http://www.e-dsp.com/why-do-we-need-amplifiers-how-to-build-a-simple-one-lm-741/</link>
		<comments>http://www.e-dsp.com/why-do-we-need-amplifiers-how-to-build-a-simple-one-lm-741/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 22:28:19 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>Electronics</category>
	<category>DIY</category>
		<guid isPermaLink="false">http://www.geekland.org/e-dsp.com/why-do-we-need-amplifiers-how-to-build-a-simple-one-lm-741/</guid>
		<description><![CDATA[
You have some output source (for example an analog sensor) where the voltage is very low, just few mV (millivolts), and you would like to measure the output with your ADC (Analog to Digital converter) and with the results do some calculations with your MCU (Microcontroller) or some other device. The values the ADC gives [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.e-dsp.com/why-do-we-need-amplifiers-how-to-build-a-simple-one-lm-741/"><img id="image18" alt="Operational Amplifier LM741" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/oper_osci_main.jpg" /></a><br />
You have some output source (for example an analog sensor) where the voltage is very low, just few mV (millivolts), and you would like to measure the output with your ADC (Analog to Digital converter) and with the results do some calculations with your MCU (Microcontroller) or some other device. The values the ADC gives you are all almost the same because its bit resolution is too small to show you any differences between the different states of the sensor. <a id="more-20"></a></p>
<p>One solution to our problem would be to get a better ADC with a greater bit resolution but that automatically means you would have to make a better PCB (Printed Circuit Board) because of the noise problems and etc. Seems like an expensive solution. However, there is a simpler and cheaper solution. We can make a voltage amplifier. It is a simpler solution, you can trust me.</p>
<p><!--adsense#adsenseuclanku--></p>
<p>To realize this simple project you will need just a few parts; two resistors, two 9V batteries, one famous and popular operational amplifier IC (Integrated Circuit a.k.a. chip), LM741, a breadboard and some wire to connect the parts on the breadboard.</p>
<p>LM741 is an operational amplifier. “An operational amplifier or op-amp is a very high-gain amplifier which has two inputs, one inverting (−) and one non-inverting (+). The output voltage is the difference between the + and − inputs, multiplied by the open-loop gain.” – Definition by <a target="_blank" href="http://en.wikipedia.org/wiki/Op-amp">Wikipedia</a>. It is a very popular and famous IC used in a wide range of applications. It can be used for voltage, current and other amplifications. In our case it is a non-inverting voltage amplifier.</p>
<p>We amplify a signal by the following rule y=G*x (this is only the case for the linear amplifiers, not logarithmic or any other amplifier). y is our output signal, G is the gain and x is our input signal. For an example you have a signal that is between 2 – 5 mV and we want to get an output signal eleven times greater than the input one, 22 – 55 mV. So our gain should be eleven. Right, we need a formula to calculate the values of external components to get our gain. Every amplifier has its own formula, given by the manufacturer, to calculate the gain. For the LM741 the gain formula is the: G=1+R2/R1, see the schematic on figure 1.</p>
<p><img alt="LM741 Schematic Operational Amplifier" id="image47" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/op_amp.gif" /><br />
Figure 1.</p>
<p>As we want a gain of eleven one solution would be to use R2 = 10kΩ and R1 = 1kΩ. When we put these values into our formula G = 1 + (10 000/1 000) we get a gain of eleven.</p>
<p>In one of my projects I needed a gain of 5.7 so I used R2 = 47kΩ and R1 = 10kΩ. Here are the results on my HAMEG oscilloscope, figure 2. The bottom signal is from the signal generator, on the scale of one volt. It was not supposed to be a square signal in case you already think “what a bad signal” <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> . The upper signal is the output signal from our circuit, on the scale of five volts.</p>
<p>The highest point at the bottom signal had amplitude of 0.8V. At the same point just on the upper signal the amplitude was 4.56V. This is one of the ways to test your amplifier; by changing the signal types (sinusoid, triangle, square and many other), voltage amplitudes and frequencies.</p>
<p><img id="image16" alt="LM741 and Oscilloscope" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/oper_osci.jpg" /><br />
Figure 2.</p>
<p>If you do not know how to build this circuit, you can see a picture of it on my breadboard, figure 3. In case you do not have a negative voltage generator you can use two 9V batteries. Connect them as on figure 4, colors match the colors on the breadboard.</p>
<p><img id="image17" alt="LM741 Operational Amplifier circuit breadboard" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/oper_circuit.jpg" /><br />
Figure 3.</p>
<p><img id="image19" alt="Negative Voltage power suply" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/oper_amp_bat.gif" /><br />
Figure 4.</p>
<p>We encourage you to download the datasheet of your manufacturer but on figure 5 you can see the pin out for the DIP version of LM741.</p>
<p><img id="image15" alt="Operational Amplifiers Pins LM741" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/oper_amp_pins.gif" /><br />
Figure 5.</p>
<p>I hope you understood this simple practical project of building a small voltage amplifier. If you want to know more about operational amplifiers you can go to our <a href="http://e-dsp.com/books.php">book section</a> and download the book &#8220;Op Amps for Everyone Design Guide&#8221;, Texas Instruments. In case you did not feel free to ask me, comment or mail me. <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' />
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/why-do-we-need-amplifiers-how-to-build-a-simple-one-lm-741/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>What are Fourier Coefficients and how to calculate them?</title>
		<link>http://www.e-dsp.com/what-are-fourier-coefficients-and-how-to-calculate-them/</link>
		<comments>http://www.e-dsp.com/what-are-fourier-coefficients-and-how-to-calculate-them/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 22:06:28 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>DSP</category>
	<category>MATH</category>
		<guid isPermaLink="false">http://www.geekland.org/e-dsp.com/what-are-fourier-coefficients-and-how-to-calculate-them/</guid>
		<description><![CDATA[
I will try to explain you what Fourier coefficients are in an as simple as possible way. It will require you to have some basic knowledge on how to solve integrals because we will use them! I will give my best to explain it to you, please notify me in case I made some mistakes [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.e-dsp.com/what-are-fourier-coefficients-and-how-to-calculate-them/"><img alt="2 Title" id="image12" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/2title.gif" /></a><br />
I will try to explain you what Fourier coefficients are in an as simple as possible way. It will require you to have some basic knowledge on how to solve integrals because we will use them! I will give my best to explain it to you, please notify me in case I made some mistakes or you don’t understand something. I would be happy if you leave some comments regarding this tutorial.<a id="more-13"></a><br />
After we have learnt what Fourier series are it is essential to understand the Fourier coefficients because later on we will use them to break complicated signals into simple waves like sine and cosine. As you have noticed in the Fourier series formula, in figure 1, there are variables like a0, a1, b1, a2, b2 and so on. These variables are called Fourier coefficients.</p>
<p><img alt="1figure4.gif" id="image7" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/1figure4.gif" /><br />
Figure 1.</p>
<p>I am sure you asked yourself how we can get these values. Well there is a simple and straightforward procedure to get them.</p>
<p>To find an, you have to multiply the original signal by cos[nωt], find that area and then divide it by T/2.<br />
To find bn, you have to multiply the original signal by sin[nωt], find that area and then divide it by T/2.</p>
<p><!--adsense#adsenseuclanku--></p>
<p>Why is this possible? Well, when we multiply a wave by another wave that is not the same then the area cancels itself and you get zero but if we multiply two same waves we get some area that is not equal to zero (the area we were looking for was just for one oscillation/period). The area we just got we divide by T/2 or multiply by 2/T.</p>
<p>Let me show you an example, on figure 2 there is a wave multiplied with another wave that is different (the frequency is different). As you can see for one period the area cancels itself and equals zero.</p>
<p><img alt="2 Figure 2" id="image9" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/2figure2.gif" /><br />
Figure 2.</p>
<p>On figure 3 we see two same waves multiplied by each other and we note there is no negative part (part bellow zero on y-axis) and we got some area. The area we just got we have to divide with T/2 and that’s it, that is our coefficient (in this case b1 because I used sine wave as an example).</p>
<p><img alt="2 Figure 3" id="image10" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/2figure3.gif" /><br />
Figure 3.</p>
<p>If it does not make sense to you why we multiplied it with the same wave try to take the integral of cos[ω]; where ω is from 0 to 2π (two pi) :-S. What will you get for the result? You will get 0 because the area from positive part (above zero on y-axis) and negative part (bellow zero on y-axis) cancel each other so that’s why we multiply it.</p>
<p>I think you understand it now <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> . In figure 4 you have the formulas to calculate these coefficients.</p>
<p><img alt="2 Figure 4" id="image11" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/2figure4.gif" /><br />
Figure 4.</p>
<p>Simple! I know! I hope it will be easier for you to follow the upcoming tutorials, introductions and projects now. It would be nice if you leave me a comment so I know that it was helpful or useful to somebody. Thank you for reading it! <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/what-are-fourier-coefficients-and-how-to-calculate-them/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>What are Fourier series? Basic introduction to Fourier series&#8230;</title>
		<link>http://www.e-dsp.com/8/</link>
		<comments>http://www.e-dsp.com/8/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 21:48:31 +0000</pubDate>
		<dc:creator>refikh</dc:creator>
		
	<category>DSP</category>
	<category>MATH</category>
		<guid isPermaLink="false">http://www.geekland.org/e-dsp.com/?p=8</guid>
		<description><![CDATA[
This is going to be my first introduction to Fourier series. It should teach you some basics so you can follow some other tutorials on my site. In this tutorial it is required that you already know the elementary trigonometric functions, sine and cosine. I will give my best to explain it to you, please [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.e-dsp.com/8/"><img id="image4" alt="1title.gif" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/1title.gif" /></a><br />
This is going to be my first introduction to Fourier series. It should teach you some basics so you can follow some other tutorials on my site. In this tutorial it is required that you already know the elementary trigonometric functions, sine and cosine. I will give my best to explain it to you, please notify me in case I make some mistakes or you don’t understand something. I would be happy if you leave some comments regarding this tutorial.<a id="more-8"></a><br />
Let us start first with a few questions: Why do we need it at all and why is it so important for us to understand the Fourier series?</p>
<p>Well there are a lot of complex signals like the human speech or seismologic earthquake readings. Figure 1 is one of them.</p>
<p>People wanted to understand the signals in a more appropriate and easier ways than to break their heads with complicated signals. It was always simpler to analyze a signal that was simple enough for us to understand, maybe just one sin(x) function. So they decided to decompose the signal to simpler signals/waves. These simpler signals are made out of trigonometric functions, sine and cosine.</p>
<p><img id="image3" alt="1figure1.gif" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/1figure1.gif" /><br />
Figure 1.</p>
<p>Conclusion after this part: No matter how complicated the signal looks like, it can be represented as a sum of elementary trigonometric functions. It just has to be periodic, to repeat itself, and to be continues.</p>
<p>Let me show you an example. In figure 2 we see a signal that looks pretty weird and you ask yourself how that signal is composed?!?! The answer is simple; it is composed out of two sine waves, sin[ωt] and sin[2ωt]. Figure 3 represents these two waves.</p>
<p>Where ω (omega) is the angular velocity, ω = 360°•f, t the time and f the frequency of the wave. Assume t = 1 second, forget about these numbers on the x-axis (don’t let them confuse you), so the frequency of the first wave (first wave on figure 3) is 2 Hz (Hertz is the unit for frequency). That means: It makes two oscillations in one second. The second wave (second wave on figure 3) has a frequency of 4 Hz because it makes 4 oscillations in one second.</p>
<p><!--adsense#adsenseuclanku--></p>
<p><img id="image5" alt="1figure2.gif" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/1figure2.gif" /><br />
Figure 2.</p>
<p>I draw one vertical line (parallel to the y-axis) in the middle so you can see that the second wave has two times greater frequency than the first one.</p>
<p><img id="image6" alt="1figure3.gif" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/1figure3.gif" /><br />
Figure 3.</p>
<p>If you add them up together, waves from figure 3, you will get the signal in figure 2. I will use a new term now, the fundamental frequency. The fundamental frequency is the frequency from the slowest wave in the group of waves, so in our case it is 2 Hz (first from figure 3). The fundamental wave will be the first wave again because it is the slowest. So simple!</p>
<p>Every next wave is the integral multiple of the fundamental wave. What does that mean? It means: every next wave has an integral multiple frequency of the fundamental wave, ex. ω, 2ω, 3ω, 4ω, …, nω.</p>
<p>I guess you ask yourself how do I create complex signals, with different amplitudes and different starting points?!? Well you just use cosine together with sine and you multiply them with different coefficients.</p>
<p>Now let’s make a final formula for the Fourier series, figure 4. T is the period.</p>
<p><img id="image7" alt="1figure4.gif" src="http://www.geekland.org/e-dsp.com/wp-content/uploads/2006/02/1figure4.gif" /><br />
Figure 4.</p>
<p>Voila. We got the sum we wanted <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . I hope you understood everything so far, if not please read it again. You can leave your comments and I will try to answer all your questions. Thank you for reading it! <img src='http://www.e-dsp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.e-dsp.com/8/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
