Tag Archive | "education"

Australian Electronics – David Jones interviews Colin Mitchell

Welcome back

In this post I would like to share a series of interviews conducted by Dave Jones from eevblog.com. Dave interviews Colin Mitchell from Talking Electronics. Throughout the 1980s and onwards, Colin published a range of electronics magazines, tutorials and a plethora of electronics kits – of which many are still available today. Personally I was a great fan of the TE products, and sold many of his books through my past retail career with DSE. I hope you enjoy these interviews, and if not – stay tuned for upcoming articles. Furthermore, I’ve reviewed one of the classic TE kits.

Once again, thanks to Dave Jones and of course Colin Mitchell from Talking Electronics for their interview and various insights.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in australia, education, electronics, history, talking electronicsComments (3)

Kit Review – Snootlab Rotoshield

Hello Readers

[Update: 11/12/11 – Added example code and video]

In this article we will examine yet another product from a bundle sent for review by Snootlab, a Toulouse, France-based company that in their own words:

… designs and develops electronic products with an Open Hardware and Open Source approach. We are particularly specialized in the design of new shields for Arduino. The products we create are licensed under CC BY-SA v3.0 (as shown in documents associated with each of our creations). In accordance with the principles of the definition of Open Source Hardware (OSHW), we have signed it the 10th February 2011. We wish to contribute to the development of the ecosystem of “do it yourself” through original designs of products, uses and events.

Furthermore, all of their products are RoHS compliant and as part of the Open Hardware commitment, all the design files are available from the Snootlab website.

The subject of the review is the Snootlab Rotoshield – a motor-driver shield for our Arduino systems. Using a pair of L293 half-bridge motor driver ICs, you can control four DC motors with 256 levels of speed, or two stepper motors. However this is more than just a simple motor-driver shield… The PCB has four bi-colour LEDs, used to indicate the direction of each DC motor; there is a MAX7313 IC which offers another eight PWM output lines; and the board can accept external power up to 18V, or (like other Snootlab shields) draw power from a PC ATX power supply line.

However as this is a kit, let’s follow construction, then explore how the Rotoshield could possibly be used. [You can also purchase the shield fully assembled – but what fun would that be?] Assembly was relatively easy, and you can download instructions and the schematic files in English. As always, the kit arrives in a reusable ESD bag:

There are some SMD components, and thankfully they are pre-soldered to the board. These include the SMD LEDs, some random passives and the MAX7313:

Thankfully the silk-screen is well noted with component numbers and so on:

All the required parts are included, including stackable headers and IC sockets:

It is nice to not see any of the old-style ceramic capacitors. The people at Snootlab share my enthusiasm for quality components. The assembly process is pretty simple, just start with the smaller parts such as capacitors:

… then work outwards with the sockets and terminals:

… then continue on with the larger, bulkier components. My favourite flexible hand was used to hold the electrolytics in place:

… followed with the rest, leaving us with one Rotoshield:

If you want to use the 12V power line from the ATX socket, don’t forget to bridge the PCB pads between R7 and the AREF pin. The next thing to do is download and install the snooter library to allow control of the Rotoshield in your sketches. There are many examples included with the library that you can examine, just select File > Examples > snootor in the Arduino IDE to select an example. Function definitions are available in the readme.txt file included in the library download.

[Update]

After acquiring a tank chassis with two DC motors, it was time to fire up the Rotoshield and get it to work. From a hardware perspective is was quite simple – the two motors were connected to the M1 and M2 terminal blocks, and a 6V battery pack to the external power terminal block on the shield. The Arduino underneath is powered by a separate PP3 9V battery.

In the following sketch I have created four functions – goForward(), goBackward(), rotateLeft() and rotateRight(). The parameter is the amount of time in milliseconds to operate for. The speed of the motore is set using the Mx.setSpeed() function in void Setup(). Although the speed range is from zero to 255, this is PWM so the motors don’t respond that well until around 128. So have just set them to full speed. Here is the demonstration sketch:

… and the resulting video:

For support, visit the Snootlab website and customer forum in French (use Google Translate). However as noted previously the team at Snootlab converse in excellent English and have been easy to contact via email if you have any questions. Snootlab products including the Snootlab Rotoshield are available directly from their website. High-resolution images available on flickr.

As always, thank you for reading and I look forward to your comments and so on. Furthermore, don’t be shy in pointing out errors or places that could use improvement. Please subscribe using one of the methods at the top-right of this web page to receive updates on new posts, follow on twitterfacebook, or join our Google Group.

[Disclaimer – the products reviewed in this article are promotional considerations made available by Snootlab]

Posted in arduino, I2C, kit review, L293, MAX7313, microcontrollers, motor shield, product review, rotoshield, snootlabComments (5)

Discovering Arduino’s internal EEPROM lifespan

How long does the internal EEPROM of an Atmel ATmega328 last for? Let’s find out…

Updated 18/03/2013

Some time ago I published a short tutorial concerning the use of the internal EEPROM  belonging to the Atmel ATmega328 (etc.) microcontroller in our various Arduino boards. Although making use of the EEPROM is certainly useful, it has a theoretical finite lifespan – according to the Atmel data sheet (download .pdf) it is 100,000 write/erase cycles.

One of my twitter followers asked me “is that 100,000 uses per address, or the entire EEPROM?” – a very good question. So in the name of wanton destruction I have devised a simple way to answer the question of EEPROM lifespan. Inspired by the Dangerous Prototypes’ Flash Destroyer, we will write the number 170 (10101010 in binary) to each EEPROM address, then read each EEPROM address to check the stored number. The process is then repeated by writing the number 85 (01010101 in binary) to each address and then checking it again. The two binary numbers were chosen to ensure each bit in an address has an equal number of state changes.

After both of the processes listed above has completed, then the whole lot repeats. The process is halted when an incorrectly stored number is read from the EEPROM – the first failure. At this point the number of cycles, start and end time data are shown on the LCD.

In this example one cycle is 1024 sequential writes then reads. One would consider the entire EEPROM to be unusable after one false read, as it would be almost impossible to keep track of  individual damaged EEPROM addresses. (Then again, a sketch could run a write/read check before attempting to allocate data to the EEPROM…)

If for some reason you would like to run this process yourself, please do not do so using an Arduino Mega, or another board that has a fixed microcontroller. (Unless for some reason you are the paranoid type and need to delete some data permanently). Once again, please note that the purpose of this sketch is to basically destroy your Arduino’s EEPROM. Here is the sketch:

If you are unfamiliar with the time-keeping section, please see part one of my Arduino+I2C tutorial. The LCD used was my quickie LCD shield – more information about that here. Or you could always just send the data to the serial monitor box – however you would need to leave the PC on for a loooooong time… So instead the example sat on top of an AC adaptor (wall wart) behind a couch (sofa)  for a couple of months:

The only catch with running it from AC was the risk of possible power outages. We had one planned outage when our house PV system was installed, so I took a count reading before the mains was turned off, and corrected the sketch before starting it up again after the power cut. Nevertheless, here is a short video – showing the start and the final results of the test:


So there we have it, 1230163 cycles with each cycle writing and reading each individual EEPROM address. If repeating this odd experiment, your result will vary.

Well I hope someone out there found this interesting. Please refrain from sending emails or comments criticising the waste of a microcontroller – this was a one off.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, atmega328, atmel, EEPROM, hardware hacking, lesson, microcontrollers, projects, tutorialComments (5)

Update – Upcoming Electronics Industry Documentary

Hello readers

Today I am going to introduce something quite different, yet hopefully interesting to you out there. The renowned director and cinematographer Karl von Muller has just released the roll-call trailer for his upcoming documentary titled “State of Electronics” – a discussion on the Electronics Industry in Australia. Although the focus is on the Australian electronics scene, much of the content and discourse within the documentary can be related to by those from many other countries.

However, Karl can explain it better:

After several months of researching, interviewing and filming, I’m excited to present the first public Trailer to my new Documentary “State of Electronics” – A discussion on the Electronics Industry in Australia. Even though the documentary is focused on Australian Electronics Design and Manufacture, much of it applies to all countries from around the world.

The discussion is focused initially on the world of Hobby Electronics and how it’s decline could affect the Electronics Industry in the future. The Documentary then discusses many issues that face industry including the issue of “Repair and Recycle”, “Education”, “Surface Mount Technology”, “Globalisation”, “Opportunities” and many many more off the cuff & candid comments from Industry professionals.

The Documentary features interviews with famous Australians and Industry professionals including Dick Smith, Dave L Jones, Doug Ford, Leo Simpson, Grant Petty, Matthew Pryor, Jonathan Oxer, Andy Gelme, Andrew Griffiths, Eugene Ruffolo & Bill Petreski. In the future, I am planning to interview just a few more before the final release of the Documentary soon.

Shot completely on the Canon 5DMK2, using the Zoom H4N Audio recorder. Directed, Edited and shot by Karl von Moller, this version of the trailer is largely ungraded and only has an FCP sound mix applied. Music track is composed by Karl von Moller also. Enjoy!

Please visit karlvonmoller.com for more on the progress and information on “State of Electronics”

Here is the new roll-call trailer:

… and the original trailer for those unfamiliar with the project:

This will surely be a fascinating and insightful documentary that we are all looking forward to. Nice one Karl!

Posted in education, electronics, historyComments (0)

Tutorial: Arduino and Infra-red control

Learn how to use Arduino and infra-red remote controls in chapter thirty-two of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

Updated 10/07/2013

In this article we will look at something different to the usual, and hopefully very interesting and useful – interfacing our Arduino systems with infra-red receivers. Why would we want to do this? To have another method to control our Ardiuno-based systems, using simple infra-red remote controls.

A goal of this article is to make things as easy as possible, so we will not look into the base detail of how things work – instead we will examine how to get things done. If you would like a full explanation of infra-red, perhaps see the page on Wikipedia. The remote controls you use for televisions and so on transmit infra-red beam which is turned on and off at a very high speed – usually 38 kHz, to create bits of serial data which are then interpreted by the receiving unit. As the wavelength of infra-red light is too high for human eyes, we cannot see it. However using a digital camera – we can. Here is a demonstration video of IR codes being sent via a particularly fun kit – the adafruit TV-B-Gone:

Now to get started. You will need a remote control, and a matching IR receiver device. The hardware and library used in this tutorial only  supports NEC, Sony SIRC, Philips RC5, Philips RC6, and raw IR protocols. Or you can purchase a matching set for a good price, such as this example:

irpackage

Or you may already have a spare remote laying around somewhere. I kept this example from my old Sony Trinitron CRT TV after it passed away:

sonyremote1

It will more than suffice for a test remote. Now for a receiver – if you have purchased the remote/receiver set, you have a nice unit that is ready to be wired into your Arduino, and also a great remote that is compact and easy to carry about. To connect your receiver module – as per the PCB labels, connect Vcc to Arduino 5V, GND to Arduino GND, and D (the data line) to Arduino digital pin 11.

Our examples use pin 11, however you can alter that later on. If you are using your own remote control, you will just need a receiver module. These are very cheap, and an ideal unit is the Vishay TSOP4138 (data sheet .pdf). These are available from element-14 and the other usual retail suspects. They are also dead-simple to use. Looking at the following example:

From left to right the pins are data, GND and Vcc (to Arduino +5V). So it can be easily wired into a small breadboard for testing purposes. Once you have your remote and receiver module connected, you need to take care of the software side of things. There is a new library to download and install, download it from here. Please note that library doesn’t work for Arduino Leonardo, Freetronics Leostick, etc with ATmega32U4. Instead, use this library (and skip the modification steps below). Extract the IRremote folder and place into the ..\arduinoxxx\libraries folder. Then restart your Arduino IDE if it was already open.

Using Arduino IDE v1.0 or greater? Open the file “IRRemoteInt.h” in the library folder, and change the line

Then save and close the file, restart the Arduino IDE and you’re set.

With our first example, we will receive the commands from our remote control and display them on the serial monitor:

Open the serial monitor box, point your remote control to the receiver and start pressing away. You should see something like this:

What have we here? Lots of hexadecimal numbers. Did you notice that each button on your remote control resulted in an individual hexadecimal number? I hope so. The number FFFFFFFF means that the button was held down. The remote used was from a yum-cha discount TV. Now I will try again with the Sony remote:

This time, each button press resulted in the same code three times. This is peculiar to Sony IR systems. However nothing to worry about. Looking back at the sketch for example 32.1, the

section is critical – if a code has been received, the code within the if statement is executed. The hexadecimal code is stored in the variable

with which we can treat as any normal hexadecimal number. At this point, press a few buttons on your remote control, and take a note of the matching hexadecimal codes that relate to each button. We will need these codes for the next example…

Now we know how to convert the infra-red magic into numbers, we can create sketches to have our Arduino act on particular commands. As the IR library returns hexadecimal numbers, we can use simple decision functions to take action. In the following example, we use switch…case to examine each inbound code, then execute a function. In this case we have an LCD module connected via I2C, and the sketch is programmed to understand fifteen Sony IR codes. If you don’t have an LCD you could always send the output to the serial monitor. If you are using the DFRobot I2C LCD display, you need to use Arduino v23.

Furthermore you can substitute your own values if not using Sony remote controls. Finally, this sketch has a short loop after the translateIR(); function call which ignores the following two codes – we do this as Sony remotes send the same code three times. Again. you can remove this if necessary. Note that when using hexadecimal numbers in our sketch we preced them with 0x:

And here it is in action:


You might be thinking “why would I want to make things appear on the LCD like that?”. The purpose of the example is to show how to react to various IR commands. You can replace the LCD display functions with other functions of your choosing.

At the start working with infra-red may have seemed to be complex, but with the previous two examples it should be quite simple by now. So there you have it, another useful way to control our Arduino systems. Hopefully you have some ideas on how to make use of this technology. In future articles we will examine creating and sending IR codes from our Arduino. Furthermore, a big thanks to Ken Shirriff for his Arduino library.

LEDborder

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, control, DFR0107, dfrobot, education, infrared, IR, learning electronics, lesson, microcontrollers, remote, tronixstuff, tutorialComments (17)

Tutorial: Your Arduino’s inbuilt EEPROM

This is chapter thirty-one of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here 

[Updated 09/01/2013]

Today we are going to examine the internal EEPROM in our Arduino boards. What is an EEPROM some of you may be saying? An EEPROM is an Electrically Erasable Programmable Read-Only Memory. It is a form of non-volatile memory that can remember things with the power being turned off, or after resetting the Arduino. The beauty of this kind of memory is that we can store data generated within a sketch on a more permanent basis.

Why would you use the internal EEPROM? For situations where data that is unique to a situation needs a more permanent home. For example, storing the unique serial number and manufacturing date of a commercial Arduino-based project – a function of the sketch could display the serial number on an LCD, or the data could be read by uploading a ‘service sketch’. Or you may need to count certain events and not allow the user to reset them – such as an odometer or operation cycle-counter.

What sort of data can be stored? Anything that can be represented as bytes of data. One byte of data is made up of eight bits of data. A bit can be either on (value 1) or off (value 0), and are perfect for representing numbers in binary form. In other words, a binary number can only uses zeros and ones to represent a value. Thus binary is also known as “base-2″, as it can only use two digits.

How can a binary number with only the use of two digits represent a larger number? It uses a lot of ones and zeros. Let’s examine a binary number, say 10101010. As this is a base-2 number, each digit represents 2 to the power of x, from x=0 onwards:

binary2 binary12

See how each digit of the binary number can represent a base-10 number. So the binary number above represents 85 in base-10 – the value 85 is the sum of the base-10 values. Another example – 11111111 in binary equals 255 in base 10.

binary2

Now each digit in that binary number uses one ‘bit’ of memory, and eight bits make a byte. Due to internal limitations of the microcontrollers in our Arduino boards, we can only store 8-bit numbers (one byte) in the EEPROM. This limits the decimal value of the number to fall between zero and 255. It is then up to you to decide how your data can be represented with that number range. Don’t let that put you off – numbers arranged in the correct way can represent almost anything!

There is one limitation to take heed of – the number of times we can read or write to the EEPROM. According to the manufacturer Atmel, the EEPROM is good for 100,000 read/write cycles (see the data sheet). One would suspect this to be a conservative estimate, however you should plan accordingly. *Update* After some experimentation, the life proved to be a lot longer

Now we know our bits and and bytes, how many bytes can be store in our Arduino’s microcontroller? The answer varies depending on the model of microcontroller. For example:

  • Boards with an Atmel ATmega328, such as Arduino Uno, Uno SMD, Lilypad or the Freetronics KitTen/Eleven – 1024 bytes (1 kilobyte)
  • Boards with an Atmel ATmega1280 or 2560, such as the Arduino Mega series – 4096 bytes (4 kilobytes)
  • Boards with an Atmel ATmega168, such as the original Arduino Lilypad, old Nano, Diecimila etc – 512 bytes.

If y0u are unsure have a look at the Arduino hardware index or ask your board supplier.

If you need more EEPROM storage than what is available with your microcontroller, consider using an external I2C EEPROM as described in the Arduino and I2C tutorial part two.

At this point we now understand what sort of data and how much can be stored in our Arduino’s EEPROM. Now it is time to put this into action. As discussed earlier, there is a finite amount of space for our data. In the following examples, we will use a typical Arduino board with the ATmega328 with 1024 bytes of EEPROM storage.

To use the EEPROM, a library is required, so use the following library in your sketches:

The rest is very simple. To store a piece of data, we use the following function:

The parameter a is the position in the EEPROM to store the integer (0~255) of data b. In this example, we have 1024 bytes of memory storage, so the value of a is between 0 and 1023. To retrieve a piece of data is equally as simple, use:

Where z is an integer to store the data from the EEPROM position a. Now to see an example.

This sketch will create random numbers between 0 and 255, store them in the EEPROM, then retrieve and display them on the serial monitor. The variable EEsize is the upper limit of your EEPROM size, so (for example) this would be 1024 for an Arduino Uno, or 4096 for a Mega.

The output from the serial monitor will appear as such:

So there you have it, another useful way to store data with our Arduino systems. Although not the most exciting tutorial, it is certainly a useful.

LEDborder

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, education, EEPROM, lesson, microcontrollers, tutorialComments (33)

Moving Forward with Arduino – Chapter 30 – twitter

Learn how to tweet from your Arduino in chapter thirty of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe.

[Updated 26/7/2013]

In this article we will learn how to send messages from our Arduino to twitter. For the uninitiated who may be thinking “what is all this twitter nonsense about?”, twitter is a form of microblogging. You can create a message with a maximum length of 140 characters, and broadcast this on the twitter service. For people to receive your messages (or tweets) they also need to be a member of twitter and choose to subscribe to your tweets.

Generally people will use the twitter service using one of three methods: using a web browser on a personal computer or internet device, on a mobile phone, or using a specific application such as TweetDeck on one of the aforementioned devices. For example, here is a typical web browser view:

And here is an example of a twitter application running on an Android OS smartphone:

tweetdeck

So as you can see, it is easy enough to read peoples’ tweets. Therein lies the reason for this article – we can harness twitter as an output device for our Arduino systems. We can broadcast various messages, so systems can be created to monitor specific parameters and report on their status at regular intervals, upon an event occurring, and so on.

In some areas, you can set twitter to send tweets from a certain user to your mobile phone via SMS – however if doing so be careful to confirm possible charges to your mobile phone account. Finally, if you are worried about privacy with regards to your tweets, you can set your account to private and only allow certain people to follow your tweets.

So let’s get started. First of all – you will need a twitter account. If you do not have one, you can sign up for one here. If you already have a twitter account, you can always open more for other uses – such as an Arduino. For example, my twitter account is @tronixstuff, but my demonstration machine twitter account is @tronixstuff2. Then I have set my primary account to follow my machine’s twitter account. Once you have logged into twitter with your machine account, visit this page and get yourself a token by following the Step One link. Save your token somewhere safe, you’ll need to insert it into your Arduino sketch.

Next, you will need some hardware. Apart from your usual Arduino board, you will need an Ethernet shield. However to save space and money I’ll be using the Freetronics EtherTen:

If you are unfamiliar with using Arduino and Ethernet, please review chapter sixteen before continuing forward with this article. From a software perspective, we will need another library for our Arduino IDE. Download and install the twitter library from here. Now, at this point – please run the Webserver example described in chapter sixteen and ensure it is working before moving forward from this point. While you do that, we’ll have a break…

lopburi-0606

Now it is time to send our first tweet. The following sketch is a modification of the demonstration version, in which we have isolated the tweet-sending into a separate function called (strangely enough) tweet();. It is not complex at all:

So after uploading the above sketch, running a network cable from your access point to the Ethernet shield, and powering up the Arduino board – your tweet should appear as such:

Excellent – it works. And I hope yours did as well. If it did not, open the serial monitor box to get some feedback from the sketch. From experimentation the most amount of errors are caused by incorrect IP and trying to send multiple tweets too quickly. If you get excited and try to run the sketch again by hitting reset, twitter will reply back with an error – it does not allow duplicate tweets to be sent (over a short period of time). Twitter will reply to your tweet with a code which describes the result of your tweet. This code is stored in an integer variable using the function:

For example, 200 means the tweet was sent successfully, and 403 means you have attempted a duplicate tweet. However you can omit the code-checking if you are not fussed about your tweet’s status.

Although it was fun tweeting Hello world, let’s create an example that reacts to various events and tweets about them. To simulate some events I have connected four buttons to digital inputs (using the button board from chapter twelve). Pressing a button sends of the matching message. However you can use any form of digital output or decision-making in your sketch. For now, here is the example sketch:

And here is a screen shot of the results after pressing buttons one, four, two then three:

So there you have it, another useful way to send information from your Arduino to the outside world. Stay tuned for upcoming Arduino tutorials by subscribing to the blog, RSS feed (top-right), twitter or joining our Google Group. Big thanks to @neocat for their work with the twitter  Arduino libraries.

LEDborder

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, cellular, ethernet, learning electronics, microcontrollers, tutorial, twitterComments (2)

Various 555 Timer circuits

Hello readers

The purpose of this article is to follow on from our explanation of the 555 timer IC by demonstrating some simple yet interesting, noisy and plain annoying uses of the 555. They are by no means that complex, and intended to help move theory into practice.

Button de-bouncer

De-bouncer? How does one bounce a button in the first place? Many years ago I bounced a button on the arcade Sonic the Hedgehog – hit it so hard it popped out and bounced over the table… But seriously, when working with digital logic circuits, you may need to use  a momentary button to accept user input. For example, to pulse a trigger or so on. However with some buttons, they are not all that they seem to be. You press them once, but they can register multiple contacts – i.e. register two or more ‘presses’ for what seems like only one press. This could possibly cause trouble, so we can use a 555 timer monostable circuit to solver the problem. In our de-bounce example, when the button is pressed, the output is kept at high for around half a second. Here is the schematic:

555debouncesch

What we have is a basic monostable timer circuit. For my example the output delay (t) is to be half a second. The formula for t is: t=1.1xR1xC1. The closest resistor I had at hand was 2k ohms, so to find the required value for C1, the formula is rearranged into: C1=t/(1.1xR1). Substituting the values for t and R1 gives a value of C1 as 227.274 uF. So for C1 we have used a 220 uF capacitor.

Now for a visual demonstration of the de-bouncer at work. In the following video clip, the oscilloscope is displaying the button level on the lower channel, and the output level on the upper channel. The button level when open is high, as the 555 requires a low pulse to activate. The output level is normally low. You can see when the button is pressed that the button level momentarily drops to low, and then the output level goes high for around half a second:

Make some noise

As we know the 555 can oscillate at frequencies from less than 1Hz to around 500 kHz. The human ear can theoretically hear sounds between (approximately) 20 and 20 kHz. So if we create an astable timing circuit with an output frequency that falls within the range of the human ear, and connect that output to a small speaker – a range of tones can be emitted.

The circuit required is a standard 555 astable, with the output signal heading through a small 8 ohm 0.25 watt speaker and a 4.7 uF electrolytic capacitor to ground. The capacitor stops any DC current flowing to ground, without this we will overload the current-handling ability of the 555. (I couldn’t help myself by trying it without the capacitor – pulled 550 mA from the 555 before it stopped working…). To choose the values of R1 and C1 to emit out required frequency, the following formula is used: f (frequency) = 1.4 / {(R1 + [2 x R2]) x C1}. To cover the range required, a 100k ohm trimpot was used for R1. Here is the resulting schematic:

noisemakersch

The input voltage can fall within the specification of the 555, however for optimum results a supply of between 5 and 9 volts DC should be used. In the following demonstration, we used a 9V supply. The purpose of the video is to learn the relationship between the tones and their frequencies. You can see the frequency on my old counter and hopefully hear the result:

Our next example is to create a  siren effect, using two 555 circuits – one for a low frequency and one for a high frequency. To determine the value for R1 for the low and high frequency, I used the previous circuit and chose two tones that were quite different, and measured the resistance of the trimpot (R1) at those frequencies. My R1 value for the ‘low’ tone is 82k ohm and 36k ohm for the ‘high’ frequency.

The switching between low and high frequency will be handled by a 4047 multivibrator – the Q and Q outputs will control NPN transistors. The transistors are used as switches to allow current to flow from the supply to the 555 high or low tone circuit. We use this method as the 4047 is not able to source enough current to drive the 555 circuits. Here is the schematic:

555siren

Don’t forget to connect pin 14 of the 4047 to supply voltage. This circuit has been tested with a supply voltage between 5 and 12 volts. As the supply voltage increases, so does the amplitude of the square wave emanating from the 555 output pins, which in turn in creases the volume of the siren. At 5 volts, the entire circuit drew only 20 milliamps. Speaking of which, you can listen to a recording of the output here. If you wish to alter the time for each tone, adjust the value of what is the 47k ohm resistor on pins 2 and 3 of the 4047.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in 4047, 555, arduino, COM-09273, education, learning electronics, lesson, tutorialComments (0)

Review – CD4047 Astable/Monostable Multivibrator

Hello readers!

Today we are going to examine an older but still highly useful integrated circuit – the 4047 Astable/Monostable multivibrator:

4047icsss

My reason for doing this is to demonstrate another way to create a square-wave output for digital circuits (astable mode) and also generate single pulses (monostable mode). Sometimes one can get carried away with using a microcontroller by default – and forget that there often can be simpler and much cheaper ways of doing things. And finally, the two can often work together to solve a problem.

What is a multivibrator? In electronics terms this means more than one vibrator. It creates an electrical signal that changes state on a regular basis (astable) or on demand (monostable). You may recall creating monostable and astable timers using the 555 timer described in an earlier article. One of the benefits of the 4047 is being able to do so as well, but with fewer external components. Here is the pinout diagram for a 4047 (from the Fairchild data sheet):

Note that there are three outputs, Q, Q and OSC out. Q is the normal output, Q is the inverse of Q – that is if Q is high, Q is low – at the same frequency. OSC output provides a signal that is very close to twice the frequency of Q. We will consider the other pins as we go along. In the following small video, we have LEDs connected to all three outputs – you can see how Q and Q alternate, and the increased frequency of OSC out:

That was an example of the astable mode.  The circuit used is shown below. The only drawback of using a 4047 is that you cannot alter the duty cycle of your astable output – it will always be 50% high and 50% low. The oscillator output is not guaranteed to have a 50% duty cycle, but comes close. The time period (and therefore the frequency) is determined by two components – R1 and the capacitor:

[Quick update – in the schematic below, also connect 4047 pin 14 to +5V]

astabledemo

The values for R2~R4 are 560 ohms, for the LEDs. R1 and the capacitor form an RC circuit, which controls the oscillation frequency. How can we calculate the frequency? The data sheet tells us that time (period of time the oscillator is ‘high’) is equal to 4.4 multiplied by the value of R1 and the capacitor. As the duty cycle is always 50%, we double this value, then divide the result into one. In other words:

And as the frequency from the OSC out pin is twice that of Q or Q, the formula for the OSC out frequency is:

However the most useful formula would allow you to work with the values of R and C to use for a desired frequency f:

When calculating your values, remember that you need to work with whole units, such as Farads and Ohms- not microfarads, mega-ohms, etc. This chart of SI prefixes may be useful for conversions.

The only thing to take note of is the tolerance of your resistor and capacitor. If you require a certain, exact frequency try to use some low-tolerance capacitors, or replace the resistor with a trimpot of a value just over your required resistor value. Then you can make adjustments and measure the result with a frequency counter. For example, when using a value of 0.1uF for C and 15 k ohm for R, the theoretical frequency is 151.51 Hz; however in practice this resulted with a frequency of 144.78 Hz.

Don’t forget that the duty cycle is not guaranteed to be 50% from the OSC out pin. This is shown in the following demonstration video. We measure the frequency from all three output pins, then measure the duty cycle from the same pins:

(The auto-ranging on that multimeter is somewhat annoying).

Now for some more more explanation about the 4047. You can activate the oscillations in two ways, via a high signal into pin 5 (pin 4 must then be low) or via a low signal into pin 4 (and pin 5 must be low). Setting pin 9 high will reset the oscillator, so Q is low and Q is high.

The monostable mode is also simple to create and activate. I have not made a video clip of monstable operation, as this would only comprise of staring at an LED. However, here is an example circuit with two buttons added, one to trigger the pulse (or start it), and another to reset the timer (cancel any pulse and start again):

[Quick update – in the schematic below, also connect 4047 pin 14 to +5V]

4047monoschematic

The following formula is used to calculate the duration of the pulse time:

Where time is in seconds, R is Ohms, and C is Farads. Once again, the OSC output pin also has a modified output – it’s time period will be 1.2RC.

To conclude, the 4047 offers a simple and cheap way to generate a 50% duty cycle  square wave or use as a monostable timer. The cost is low and the part is easy to source. As always, avoid the risk of counterfeit ICs and get yours from a reputable distributor. Living in Australia, mine came from element-14. Thanks to Fairchild Semiconductor for product information from their 4047 data sheet.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in 4047, education, learning electronics, lesson, part review, tutorialComments (41)

Kit Review – MDC Bare-bones Board Kit (Arduino-compatible)

Hello readers

Today we continue to examine Arduino-compatible products by assembling an interesting kit from Modern Device Company – their “Bare Bones Board” (to be referred to as BBB). The BBB kit is an inexpensive way to take advantage of the Arduino Duemilanove-compatible platform, and also fills some gaps in the marketplace. Unlike the usual Arduino and compatible boards, the BBB does not maintain the recognisable form factor – that is, you cannot use the variety of Arduino shields. However, the BBB does have all the input and output connections, just in different positions.

So why would you use this kit? If you are looking to create a more permanent Arduino-based project that did not require a shield, and you are in a hurry – the BBB could be easily integrated into your design. Money is saved by not having the usual USB connection, so uploading your sketch is achieved using a 5V FTDI cable or using another Arduino board as the programmer.

Furthermore, the PCB is designed in a way that allows you to plug the BBB into the side of a solderless breadboard, which allows prototyping more complex Arduino-based circuits very easy. But more about that later. For now, let’s have a look at construction. An excellent set of instructions and a guide to use is available for download here.

In the spirit of saving money, the kit arrives in a plastic bag of sorts:

packagingss1

And upon emptying the contents, the following parts are introduced:

partsss2

Regular readers would know that the inclusion of an IC socket makes me very happy. The PCB is thicker than average and has a great silk-screen which makes following instructions almost unnecessary. One of the benefits of this kit is the ability to connect as little or as many I/O or programming pins as required.

And for the pins A0~A5, 5V, GND and AREF you are provided with header pins and a socket, allowing you to choose. Or you could just solder directly into the board. These pins are available on the bottom-left of the PCB. However there was one tiny surprise included with the parts:

rawinductor

This is a 15uH SMD inductor, used to reduce noise on the analog/digital section. According to the instructions, this was originally required with Arduino-style boards that used the ATmega168 microcontroller – however the BBB now includes the current ATmega328 which does not require the inductor. However, it is good to get some SMD practice, so I soldered it in first:

solder1ss1

Well it works, so that was a success. Soldering the rest of the main components was quite simple, thanks to the markings on the PCB. The key is to start with the lowest-profile (height) components (such as that pesky inductor) and work your way up to the largest. For example:

solder2ss1

As you can see from the PCB close-up above, you can have control over many attributes of your board. Please note that the revision-E kit does include the ATmega328 microcontroller, not the older ‘168. For more permanent installations, you can solder directly into I/O pins, the power supply and so on.

Speaking of power, the included power regulator IC for use with the DC input has quite a low current rating – 250 mA (below left). For my use, this board will see duty in a breadboard, and also a 5V supply for the rest of the circuit, so more current will be required. Thankfully the PCB has the space and pin spacing for a 7805 5V 1A regulator (below right), so I installed my own 7805 instead:

regulators

Finally, to make my Arduino-breadboarding life easier I installed the sockets for the analogue I/O, the DC socket and a row of header pins for the digital I/O. Below is my finished example connected into a breadboard blinking some LEDs:

finishedonbbss

In this example, the board is being powered from the 5V that comes along the FTDI cable. If doing so yourself, don’t forget that there is a maximum of 500 mA available from a USB port. If you need more current (and have installed the 7805 voltage regulator) make use of the DC socket, and set the PCB power select jumper to EXT. For a better look at the kit in action, here is a short video clip:

As you can see from the various angles shown in the video, there are many points on the PCB to which you can use for power, ground, I/O connection and so on. As illustrated at the beginning of this article, a variety of header pins are included with the kit. And please note that the LED on the board is not wired into D13 as other Arduino-type boards have been… the BBB’s LED is just an “on” indicator.

However if you are using this type of kit, you most likely will not need to blink a solitary LED. However some people do use the D13 LED for trouble-shooting, so perhaps you will need it after all. Each to their own!

In conclusion, the BBB is another successful method of prototyping with the Arduino system. The kit was of a good quality, included everything required to get working the first time, and is quite inexpensive if you have a 5V FTDI cable or an Arduino Duemilanove/Uno or compatible board for sketch uploading.

Once again, thank you for reading this kit review, and I look forward to your comments and so on. Please subscribe using one of the methods at the top-right of this web page to receive updates on new posts, and if you have any questions – why not join our Google Group? It’s free and we’re all there to learn and help each other.

High resolution photos are available on flickr.

[Note – this kit was purchased by myself personally and reviewed without notifying the manufacturer or retailer]

Posted in arduino, bare bones board, kit review, learning electronics, microcontrollers, modern devicesComments (4)

Tutorial – Arduino Uno and SM5100B GSM Cellular

Shield is now obsolete. Contact your hardware supplier for support.

Posted in arduino, CEL-00675, CEL-09607, cellphone hacking, cellular, GSM, lesson, SMS, tronixstuff, tutorial

Kit Review – Sparkfun “Simon Game”

Hello everyone

Time for a fun kit review. Aren’t all kit reviews fun? I think so, however sometimes kits can be very practical in use and perhaps not fun – unlike this little monkey. Some of you, including myself, may have childhood memories of the computer game unit from Milton-Bradley called the “Simon”. As demonstrated by the children in this video clip, Simon was a noisy game with four illuminated buttons, your task being to mimic the ever-increasing pattern of flashing buttons and matching sounds:

At first it looks easy, and it is –  however after a few repetitions the length of pattern increases and becomes more complex, forcing you to use your brain and take notice. Some would say it is useful for brain training as well.  This can only be a good thing… which brings me to this kit. The packaging is very good for a change, something you could give as a gift to a non-technical person. That is,  you could give a geek a kit in an anti-static bag, and they would understand, however a beginner may not:

boxss

The contents reveal several pleasant surprises:

partsss1

Finally – a battery-powered kit that actually includes the required power source; and not yum-cha cells, actual Duracells. Nice one Sparkfun. (If you haven’t seen that type of Duracell before, they are “trade-only” versions, generally used to deter theft). The other surprise was the inclusion of an ATmega328-PU microcontroller …

mcuss

… the exact same model as the Arduino Uno and compatible boards. Simon was starting to become more interesting every minute. But more about that later. The final object of interest is a real, live, instruction book. (You can download a copy from here). At this point you can tell this kit is made for beginners (of all ages). There is also a surface-mount component version, which people tell me is great for learning SMD work. Not for me! Good packaging, simple instructions, and a PCB that is solid and well marked out:

pcbrearss

Again, some more interesting things – what looks to be holes that would match up to an FTDI cable, in-circuit programming interface as well as some pinouts for the ATmega328.

[Update – if you’re the hacking type, it would pay to mount the IC in a socket, just in case]

However I will move forward and start the soldering. This was quite simple, just follow the guide and all is well. The instructions make a good note when a component is polarised or needs to be inserted in a certain way, very helpful for the beginner:

bottom-solderedss

and the other side was equally as simple:

top-solderedss

On this side you also need to get those AA cell clips installed. The push into their respective holes on the PCB easily, however they can be a trap to solder. Consider the following photo of one of the clips:

batt-clipss

Although the large hole in the PCB is necessary, it has left quite a gap around the wide pin. The inexperienced may end up melting lots of solder and watching it fall through to the other side; to prevent this, place the tip of your soldering iron under the acute side of the pin, and apply solder on the other side. This will force the solder to melt back onto the exposed ring on the PCB and make a good connection, instead of allowing gravity to take over the situation.

After the soldering was finished, the next task is to place the rubber button-mould over the LEDs, and then the black plastic bezel on top. The included screws go through each corner of the bezel, through the white moulding and PCB, and finally break through to the other side – where you can attach the stand-offs. Which leaves us with the final product:

finishedss1

After inserting the AA cells into their new homes, the power was turned on and the unit blinks the LEDs in a sequence until you press a button to start the game. However at this point one of the LEDs did not come on at at all. A quick check with the meter showed it was being fed almost 2.8 volts, but alas – no blinkiness. After a quick desolder/resolder job a green LED from my stock made a replacement. This would have been the only downfall for a beginner, not everyone has boxes of electronics components laying about – nor the high-intensity versions used in this kit.

However life goes on, and Simon still works just as the originals did all those years ago. Here is an example of him in action:


This is something I will need some practice on. Furthermore, the ability to control the sounds is a bonus as well; however if this Simon is aimed for small children, one could be tempted to not install the piezo transducer at all (mini speaker)! So at this stage we have an easy-to-assemble kit that is colourful, noisy and fun – a good start to help introduce another person to our fascinating world of electronics.

But wait – there’s more! Now it is time to revisit those programming holes and see what other secondary uses we can find for Simon. Seeing one of the LEDs isn’t the brightest, I will keep this one for myself, and experiment further. Therefore, the next thing to do to is solder in some header pins to allow connection to an FTDI cable:

simonftdiss

This cable converts the USB interface down to serial line levels suitable for our Simon, in the same way as the FTDI chip does for the Arduino boards (except the Uno). At this point please note you’re on your own, so if you fritz your Simon don’t take it out on me! With hindsight it would be a good idea to use an IC socket for the microcontroller.

Looking at the schematic, we can determine the pins for the LEDs, buttons and so on. The included ATmega328 has the serial bootloader for Arduino programming, so we can have a lot of easily-generated fun with it. However, note that the board does not have an external crystal or oscillator, so timing may not be as accurate as expected.

Disclaimer  – this worked for me, however your experience may vary. Alter your Simon at your own risk!

Anyhow, to use with the Arduino environment, insert the AA cells, plug in your FTDI cable, and select the board type in the environment:

arduinosetupss

Select the second option Arduino Duemilanove or Nano w/ ATmega328. Now you can upload sketches as you would a normal board. The setup functions for the LEDs are:

and for the buttons:

So armed with that knowledge you could create some  custom interactivity with your Simon hardware. If you are unsure about Arduino programming, there is a small tutorial over here that you will find helpful.

Update – New post from Sparkfun about modding your Simon. High resolution images are available on flickr. You can purchase the kit directly from Sparkfun and their resellers. As always, thank you for reading and I look forward to your comments and so on. Furthermore, don’t be shy in pointing out errors or places that could use improvement. Please subscribe using one of the methods at the top-right of this web page to receive updates on new posts. Or join our Google Group.

[Note – The kit was purchased by myself personally and reviewed without notifying the manufacturer or retailer]

Posted in arduino, games, kit review, KIT-10547, KIT-10935, learning electronics, microcontrollers, simonComments (2)

Upcoming Electronics Industry Documentary

Hello readers

Today I am going to introduce something quite different, yet hopefully interesting to you out there. The renowned director and cinematographer Karl von Muller has just released the trailer for his upcoming documentary titled “State of Electronics” – a discussion on the Electronics Industry in Australia. Although the focus is on the Australian electronics scene, much of the content and discourse within the documentary can be related to by those from many other countries.

However, Karl can explain it better:

After several months of researching, interviewing and filming, I’m excited to present the first public Trailer to my new Documentary “State of Electronics” – A discussion on the Electronics Industry in Australia. Even though the documentary is focused on Australian Electronics Design and Manufacture, much of it applies to all countries from around the world.

The discussion is focused initially on the world of Hobby Electronics and how it’s decline could affect the Electronics Industry in the future. The Documentary then discusses many issues that face industry including the issue of “Repair and Recycle”, “Education”, “Surface Mount Technology”, “Globalisation”, “Opportunities” and many many more off the cuff & candid comments from Industry professionals.

The Documentary features interviews with famous Australians and Industry professionals including Dick Smith, Dave L Jones, Doug Ford, Leo Simpson, Grant Petty, Matthew Pryor, Jonathan Oxer, Andy Gelme, Andrew Griffiths, Eugene Ruffolo & Bill Petreski. In the future, I am planning to interview just a few more before the final release of the Documentary soon.

Shot completely on the Canon 5DMK2, using the Zoom H4N Audio recorder. Directed, Edited and shot by Karl von Moller, this version of the trailer is largely ungraded and only has an FCP sound mix applied. Music track is composed by Karl von Moller also. Enjoy!

Please visit karlvonmoller.com for more on the progress and information on “State of Electronics”

Here is the trailer for your enjoyment, on Vimeo or YouTube (below):

As an Australian, an educator and an electronics enthusiast, I encourage you to view the trailer and share it with as many people as possible. If you have contacts in the broadcast media, please talk to them about this documentary and suggest it for screening.

Posted in education, electronics, historyComments (2)

Education – the Bipolar Transistor – part two

Hello readers

Today we continue with the second in a series of articles about the bipolar transistor. The first section is here. In this article we look at using the bipolar transistor as an amplifier. That is, change a very small alternating-current signal and make it larger, increasing the amplitude of the signal. Although originally it would seem to be rather simple, perhaps it is not. There are many, many ways to construct a transistor amplifier circuit, but I hope this introduction helps your basic understanding of the process.

When we used the transistor as a switch in part one, we were concerned about the amount of current that flowed between the base and the emitter – that it did not exceed the maximum rating for the particular transistor. When a transistor is allowing the most amount possible of current to flow, it is saturated – the point where the transistor cannot handle any more current. However, to use a transistor as an amplifier we need to bias the transistor so that it is passing current, but not saturated. The procedure of setting the output DC level is known as biasing. The procedure for biasing is outside the scope of this article.

When selecting transistors one needs to take note of the hFE (DC current gain), as variations in this will require a complete recalculation of the values for the bias resistors. Even a common model such as the BC548 is available with hFE ranges between 110~520.

exmple2

one transistor amplifier

Consider the example schematic above. The transistor is not saturated, due to the bias being set by the two 10k ohm resistors, which drops the voltage over the base by around half. In this case with our 6V supply this drops to around 3V. When power is applied, the transistor is biased and allows a small amount of current to flow, but it still has a lot more current-handling capacity. In testing this example, without an input the base current Ib is 0.32 milliamps, and the collector current Ic is 19.9 milliamps . These amounts of current are known as the quiescent current values.

The purpose of the 0.1 uF capacitor is to block DC current and only allow AC current to flow. When the AC current passes through the 0.1 uF capacitor, it is combined with the DC quiescent current running through the base and rides the stronger current out of the emitter. At which point the 100 uF capacitor before the speaker stops the DC current and only allows the AC signal through to the speaker, but amplified. The level of amplification is dependent upon the gain of the transistor, and the amount of base current. Let’s have a look at the behaviour of the current as it passes through the example circuit above:

At the end stage of the video clip we increased the input signal greatly. Did you notice the clipping at the output? This occurs when the voltage is too great for the transistor, and therefore it cannot pass the complete signal through to the emitter. In an audio signal situation, this will cause distortion. That is another reason to check the specification of the transistor against your requirements.

Moving along. You can also connect more than one transistor together to increase the amplification, for example:

exmple2

two-transistor amplifier

The left half of the circuit above should be familiar. The 10uF capacitor at the bottom is to stop the DC current being passed through to the base of the BC548 transistor. The second transistor, the BC558 is a PNP transistor, and amplifies the signal at the collector of the BC548. Finally, the 1uF capacitor blocks the DC current from reaching the output. However in using two or more transistors in such a method, you need to ensure the emitter current rating of the second transistor is much higher, as the gain of two transistors is the product of the individual transistors’ gain.

As stated at the beginning, this is only an introduction. There are literally hundreds of thousands of pages of material written about the use of transistors, so don’t stop here – experiment and do your own research and learning!

As always, thank you for reading and I look forward to your comments and so on. Furthermore, don’t be shy in pointing out errors or places that could use improvement. Please subscribe using one of the methods at the top-right of this web page to receive updates on new posts. Or join our new Google Group.

Posted in amplifier, education, learning electronics, lesson, transistor, tutorialComments (9)

Education – Introduction to Alternating Current – part two

Hello everyone

Today we are going to continue exploring alternating current, with regards to how resistors and capacitors deal with AC. This chapter is part two, chapter one is here. Once you have read this article, continue on with learning about inductors. To help with the explanations, remember this diagram:

sin2

That is, note that there are three possible voltage values, Vpp, Vp and Vrms. Moving on. Alternating current flows through various components just like direct current. Let’s examine some components and see.

First, the resistor. It operates in the same way with AC as it does DC, and the usual calculations apply with regards to Ohm’s law, dividing voltage and so on. However you must keep in mind the type of voltage value. For example, 10Vrms + 20Vpp does NOT equal 30 of anything. But we can work it out. 20Vpp is 10Vp,  which is 7.07Vrms… plus 10Vrms = 17.07Vrms. Therefore, 10Vrms + 20Vpp = 17.07Vrms.

Furthermore, when using Ohm’s law, or calculating power, the result of your equation must always reflect the type of voltage used in the calculations. For example:

scan1

Next, the capacitor. Capacitors oppose the flow of alternating current in an interesting way – in simple terms, the greater the frequency of the current, the less opposition to the current. However, we call this opposition reactance, which is measured in ohms. Here is the formula to calculate reactance:


the result Xc is measured in Ohms, f is frequency is Hertz, and C is capacitance in Farads. Here are two examples – note to convert the value of the capacitor back to Farads

 

scan3

scan4

Also consider if you have identical frequencies, a smaller capacitor will offer a higher resistance than a larger capacitor. Why is this so? A smaller capacitor will reach the peak voltages quicker as it charges in less time (as it has less capacitance); wheras a larger capacitor will take longer to charge and reach the peak voltage, therefore slowing down the current flow which in turn offers a higher reactance.

Resistors and capacitors can also work together as an AC voltage divider. Consider the following schematic:

As opposed to a DC voltage divider, R2 has been replaced with C1, the 0.1 uF capacitor. In order to calculate Vout, we will need the reactance of C1 – and subsitute that value for R2:

scan61

 

However, once the voltage has been divided, Vout has been transformed slightly – it is now out of phase. This means that Vout oscillates at the same frequency, but at different time intervals than Vin. The easiest way to visualise this is with an oscilloscope, which you can view below:

Please note that my CRO is not in the best condition. In the clip it was set to a time base of 2 milliseconds/division horizontal and 5 volts/division vertical.

Thus ends chapter two of our introduction to alternating current. I hope you understood and can apply what we have discussed today. As always, thank you for reading and I look forward to your comments and so on. Furthermore, don’t be shy in pointing out errors or places that could use improvement, you can either leave a comment below or email me – john at tronixstuff dot com.

Please subscribe using one of the methods at the top-right of this web page to receive updates on new posts. Or join our Google Group and post your questions there.

Posted in AC, alternating current, education, learning electronics, lesson, tutorialComments (1)

Education – Introduction to Alternating Current

Hello everyone!

Today we are going to introduce the basics of AC – alternating current. This is necessary in order to understand future articles, and also to explain in layperson’s terms what AC is all about. So let’s go!

AC – Alternating Current. We see those two letters all around us. But what is alternating current? How does current alternate? We know that DC (direct current) is the result of a chemical reaction of some sort – for example in a battery, or from a solar cell. We know that it can travel in either direction, and we have made use of it in our experimenting. DC voltage does not alter (unless we want it to).

Therein lies the basic difference – and why alternating current is what is is – it alternates! 🙂 This is due to the way AC current is created, usually by a generator of some sort. In simple terms a generator can be thought of as containing a rotating coil of wire between two magnets. When a coil passes a magnet, a current is induced by the magnetic field. So when the coil rotates, a current is induced, and the resulting voltage is relative to the coil’s positioning with the magnets.

For example, consider the diagram below (exploded view, it is normally more compact):

generator

This is a very basic generator. A rotating coil of wire is between two magnets. The spacing of the magnets in real life is much closer. So as the coil rotates, the magnetic fields induce a current through the coil, which is our alternating current. But as the coil rotates around and around, the level of voltage is relative to the distance between the coil and the magnet. The voltage increases from zero, then decreases, then increases… as the coil constantly rotates. If you were to graph the voltage level (y-axis) against time (x-axis), it would look something like below:

sin1

That graph is a sine wave… and is a representation of perfect AC current. If you were to graph DC voltage against time, it would be a straight horizontal line. For example, compare the two images below, 2 volts DC and AC, shown on an oscilloscope:

2v-dc-cro-small

2 volts DC

The following clip is 2 volts AC, as shown on the oscilloscope:

So as you can see, AC is not a negative and positive current like DC, it swings between negative and positive very quickly. So how do you take the voltage measurement? Consider the following:

sin2

The zero-axis is the point of reference with regards to voltage. That is, it is the point of zero volts. In the oscilloscope video above, the maximum and minimum was 2 volts. Therefore we would say it was 2 volts peak, or 2Vp. It could also be referred to as 4 volts peak to peak, or 4Vpp – as there is a four volt spread between the maximum and minimum values of the sine wave.

There is another measurement in the diagram above – Vrms, or volts root mean squared. The Vrms value is the amount of AC that can do the same amount of work as the equivalent DC voltage. Vrms = 0.707 x Vp; and Vp = 1.41 * Vrms. Voltages of power outlets are rated at Vrms instead of peak as this is relative to calculations. For example, in Australia we have 240 volts:

241vacs

Well, close enough. In fact, our electricity distributor says we can have a tolerance of +/- 10%… some rural households can have around 260 volts. Moving on…

The final parameter of AC is the frequency, or how many times per second the voltage changes from zero to each peak then back to zero. That is the time for one complete cycle. The number of times this happens per second is the frequency, and is measured in Hertz (Hz). The most common frequency you will hear about is your domestic supply frequency. Australia is 50 Hz:

50-hzss

… the US is 60 Hz, etc. In areas that have a frequency of 60 Hz, accurate mains-powered time pieces can be used, as the seconds hand or counter can be driven from the frequency of the AC current.

The higher the frequency, the shorter the period of time taken by one cycle. The frequency and time are inversely proportional, so frequency = 1/time; and time – 1/frequency. For example, if your domestic supply is 50 Hz, the time for each cycle is 1/50 = 0.02 seconds. This change can be demonstrated quite well on an oscilloscope, for example:

In the video above there is 2 volts AC, and the frequency starts from 100 Hz, then moves around the range of 10 to 200 Hz. As you can see, the amplitude of the sine wave does not change (the height, which indicates the voltage) but the time period does alter, indicating the frequency is changing. And here is the opposite:

This video is a demonstration of changing the voltage, whilst maintaining a fixed frequency. Thus ends the introduction to alternating current. In the next instalment about AC we will look at how AC works in electronic circuits, and how it is handled by various components.

I hope you understood and can apply what we have discussed today. As always, thank you for reading and I look forward to your comments and so on. Furthermore, don’t be shy in pointing out errors or places that could use improvement.

Please subscribe using one of the methods at the top-right of this web page to receive updates on new posts. Or join our Google Group and post your questions there.

Posted in AC, alternating current, education, learning electronics, lesson, safety, tutorialComments (0)

Electronic components – the Resistor (Part Three)

Hello readers

Today we conclude the series of articles on the resistor. You may also enjoy part one and twoWith regards to this article, it is only concerned with direct current (DC) circuits.

Pull up and pull down resistors

When working with digital electronics circuits, you will most likely be working with CMOS integrated circuits, such as the 4541 programmable timer we reviewed in the past. These sorts of ICs may have one or more inputs, that can read a high state (like a switch being on) or a low state (or like a switch being off). In fact you would use a switch in some cases to control these inputs. Consider the following hypothetical situation with a hypothetical CMOS IC in part of a circuit from a hypothetical designer:

cir1

The IC in this example has two inputs, A and B. The IC sets D high if input A is high (5V), and low if A is low (0V). The designer has placed a button (SW1) to act as the control of input A. Also, the IC sets C high if input B is low (0V) or low if it is high (5V). So again, the designer has placed another button (SW2) to act as the control of input B, when SW2 is pressed, B will be low.

However when the designer breadboarded the circuit, the IC was behaving strangely. When they pressed a button, the correct outputs were set, but when they didn’t press the buttons, the IC didn’t behave at all. What was going on? After a cup of tea and a think, the designer realised – “Ah, for input A, high is 5V via the button, but what voltage does the IC receive when A is low? … and vice-versa for input B”. As the inputs were not connected to anything when the buttons were open, they were susceptible to all sorts of interference, with random results.

So our designer found the data sheet for the IC, and looked up the specification for low and high voltages:

lowhigh1

“Aha … with a supply voltage of 5V, a low input cannot be greater than 1.5V, and a high input must be greater than 3.5V. I can fix that easily!”. Here was the designer’s fix:

cir2

On paper, it looked good. Input A would be perfectly low (0V) when the SW1 was not being pressed, and input B would be perfectly high (connected to 5V) when SW2 was not pressed. The designer was in a hurry, so they breadboarded the circuit and tested the resulting C and D outputs when SW1 and SW2 were pressed. Luckily, only for about 30 seconds, until their supervisor walked by and pointed out something very simple, yet very critical: when either button was pressed in, there would be a direct short from supply to ground! Crikey… that could have been a bother. The supervisor held their position for a reason, and made the following changes to our designer’s circuit:

Instead of shorting the inputs straight to supply or earth, they placed the resistors R1 and R2 into the circuit, both 10k ohm value. Why? Looking at SW1 and input A, when SW1 is open, input A is connected to ground via the 10k resistor R1. This will definitely set input A to zero volts when SW1 is open – perfect. However when SW1 is closed, input A is connected directly to 5V (great!) making it high. Some current will also flow through the resistor, which dissipates it as heat, and therefore not shorting out the circuit (even better). You can use Ohm’s law to calculate the current through the resistor:

cir3

I (current) = 5 (volts) / 10000 (ohms) = 0.0005 A, or half a milliamp.

As power dissipated (watts) = voltage x current, power equals 0.0025 watts, easily handled by a common 1/4 watt resistor. Our resistor R1 is called a pull-down resistor as it pulls the voltage at input A down to zero volts.

And with R2, when SW2 is open, input B is connected directly to 5V via R2. However. as the IC inputs are high impedance, the voltage at input B will still be 5V (perfect). When SW2 is closed, input B will be set to zero volts, via the direct connection to ground. Again, some current will flow through the resistor R2, in the same way as R1. However, in this situation, we call R2 a pull-up resistor, as it pulls the voltage at input B up to 5V.

Generally 10k ohm resistors are the norm with CMOS digital circuits like the ones above, so you should always have a good stock of them. If you are using TTL ICs, inputs should still not be left floating, use a pull-up resistor of 10k ohm as well. Pull-up resistors can also be used in other situations, such as maintaining voltages on data bus lines, such as the I2C bus (as used in our Arduino clock tutorials).

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

 

Posted in education, learning electronics, lesson, pulldown, pullup, resistor, tutorialComments (12)

Part review – 4541 CMOS programmable timer

Hello readers!

Today we are going to examine the 4541 CMOS programmable timer IC. The main function of this chip is to act as a monostable timer. You are probably thinking one of two things – “what is a monostable timer?” or “why didn’t he use a 555 timer instead?”. A monostable timer is a timer that once activated sets an output high for a specified period of time, then stops waiting to be told to start again.  If you are not up to speed on the 555, have a look at my extensive review.

Although the 555 is cheap, easy to use and makes a popular timer, I have found that trying to get an exact time interval out of it somewhat difficult due to capacitor tolerance, so after some poking around found this IC and thought “Hmm – what have we here?”. So as always, let’s say hello:

hello4541small

As you can see this is a 14-pin package by Texas Instruments. It is also available in various surface-mount options. It is also currently available from FairchildNXP, ON Semi, and ST Micro. Note that this is a CMOS semiconductor, and that you should practice good anti-static precautions when handling it. Futhermore, when designing it into your circuit, don’t leave any pins floating – that is not connected to +5V or ground; unless specified by the data sheet. Here is the data sheet from ON Semiconductor.

This IC is interesting in that it contains a timer that can count to one of four values: 2^8, 2^10, 2^13, and 2^16. That is: 256, 1024, 8192 and 65536. With wiring you select which value to count to, and also the action to take whilst counting and once finished. This is quite easy, by connecting various pins to either GND or +5V. The following table from the data sheet details this:

tables

And here are the pinouts:

The speed of the counting (the frequency) is determined by a simple RC circuit. For more information on RC circuits, please visit this post. You can calculate the frequency using the following formula:

There are two external resistors used in the circuit – Rtc and Rs. Rs needs to be as close as possible to twice the value of Rtc. Try and use 1% tolerance metal-film resistors for accuracy, and a small value capacitor. Also remember to take note of the restrictions printed next to the formula above.

Before examining a demonstration circuit, I would like to show you how to calculate your timing duration. As you can see from the formula above, calculating the frequency is easy enough. Once you have a value for f, (the number of counts per second) divide this into the count value less one power you have wired the chip. That is, if you have wired the chip up for 2^16, divide your frequency into 2^15.

For example, my demonstration circuit has Rtc as 10k ohm, Ctc as 10 nF, and Rs as 20k ohm; and the chip is wired for 2^16 count. Remember to convert your values back to base units. So resistance in ohms, and capacitance in farads. Remember that 1 microfarad is 1×10-6 farads. So my frequency is:

s2

So my timing duration will be 2^15 divided by 4347.826 Hz (result from above) which is  7.536 seconds give or take a fraction of a second. To make these calculations easier, there is a spreadsheet you can download here. For example:

ss

Here is my demonstration monstable circuit. Once the power has been turned on the counter starts, and once finished the LED is lit. Or if the circuit already has power, the reset button SW1 is pressed to start counting. You can see that pins 12 and 13 are high to enable counting to 2^16; pin 6 is low unless the button is pressed; and pin 9 is low which keeps the LED off while counting.

circ2

And my demonstration laid out (I really do make everything I write about):

testboardsmall

 Easily done. Although this IC has been around for a long time, and many other products have superseded it, the 4541 can still be quite useful. For example, an Arduino system might need to trigger a motor, light, or something to runfor a period of time whilst doing something else. Unfortunately (thankfully?) Arduino cannot multi-task sketches, so this is where the 4541 can be useful. You only need to use a digitalWrite() to send a pulse to pin 6 of your timer circuit, and then the sketch can carry on, while the timer does its job and turns something on or off for a specified period of time.

Well I hope you found this part review interesting, and helped you think of something new to make. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in 4541, cmos, education, learning electronics, tutorialComments (6)

Electronic components – the Resistor (Part Two)

Hello readers

Today we continue with the series of articles on basic electronics with this continuation of the article about the resistor. Part one can be found hereWith regards to this article, it is only concerned with direct current (DC) circuits. In this chapter we will examine how two or more resistors alter the flow of current in various ways. First of all, let’s recap what we learned in the previous chapter.

Ohm’s Law – the relationship between voltage, current and resistance:

ohmslaw

Resistors in series:

series

Resistors in parallel:

parallel

 

Dividing voltage with resistors:

divider

However the fun doesn’t stop there. As there is a relationship between voltage, current and resistance, we can also divide current with resistors. For now we will see how this works with two resistors. Please consider the following:

There is a balance between the two resistors with regards to the amount of current each can handle. The sum of the current through both resistors is the total current flowing through the circuit (It). The greater the resistance the less current will flow, and vice versa. That is, they are inversely proportional. And if R1 = R2, I1 = I2. Therefore, I1/I2=R2/R1 – or you can re-arrange the formula to find the other variables.

Here is an example of doing just that:

currdivex2

Our problem here – there is 6 volts DC at half an amp running from left to right, and we want to use an indicator LED in line with the current. However the LED only needs 2 volts at 20mA. What value should the resistors be?

First of all, let’s look at R1. It needs to change 6V to 2V, and only allow 20 mA to pass. R=E/A or R= 4 volts /0.2 amps = 200 ohms.

So R1 is 200 ohms. I1 is .02 A. Now we know that the total current is equal to I1+I2, so I2 will be 0.48A. That leaves us with the known unknown R2 🙂  We can re-arrange the formula R2/R1=I1/I2 to get R2 = (R1 x I1)/I2 – which gives us R2 of 8.3 ohms. Naturally this is a hypothetical, but I hope you now understand the relationship between the current through the resistors, and their actual resistance.

What we have just demonstrated in the problem above is an example of Kirchhoff’s current law (KCL). Gustav Kirchhoff was another amazing German physicist who worked on the understandings of electrical circuits amongst other things. More on GK here. His current law states that the amount of current entering a junction in a circuit must be equal to the sum of the currents leaving that junction. And not-coincidentally, there is also Kirchhoff’s voltage law (KVL) – the amount of voltage supplied to a circuit must equal the sum of the voltage drops in the circuit. These two laws also confirm one of the basic rules of physics – energy can not be created nor destroyed, only changed into different forms.

Here is a final way of wrapping up both KCL and KVL in one example:

The current through R3 is equal to I1 + I2

Therefore, using Ohm’s law, V1 = R1I1 + (R3 x (I1+I2)) and V2 = R2I2 + (R3 x (I1+I2))

So with some basic algebra you can determine various unknowns. If algebra is your unknown, here is a page of links to free mathematics books, or have a poke around BetterWorldBooks.

There is also another way of finding the currents and voltages in a circuit with two or more sources of supply – the Superposition Theorem.

This involves removing all the sources of power (except for one) at a time, then using the rules of series and parallel resistors to calculate the current and voltage drops across the other components in the circuit. Then once you have all the values calculated with respect to each power source, you superimpose them (by adding them together algebraically) to find the voltages and currents when all the power sources are active. It sounds complex, but when you follow this example below, you will find it is quite simple. And a lot easier the th.. fourth time.  Just be methodical and take care with your notes and calculations. So let’s go!

Consider this circuit:

scan1

With the Superposition theorem we can determine the current flowing through the resistors, the voltage drops across them, and the direction in which the current flows. With our example circuit, the first thing to do is replace the 7V power source with a link:

Next, we can determine the current values. We can use Ohm’s law for this. What we have is one power source, and R1 which is in series with R2/R3 (two parallel resistors). The total current in the circuit runs through R1, so calculate this first. It may help to think of the resistors in this way:

Then the formula for Rt is simple (above), and Rt is And now that we have a value for Rt, and the voltage (28V) the current is simple:

scan3

Which gives us a value of 6 amps for It. This current flows through R1, so the current for R1 is also 6 amps. Next, the current through R2:

Using Kirchhoff’s Current Law, the current flowing through R2 and R3 will equal It. So, this is 4 amps.

At this point, note down what we know so far:

For source voltage 28V, Ir1 = 6A, Ir2 = 2A and Ir3 = 4A; R1=4 ohms, R2 = 2 ohms, R3 = 1 ohm.

Now – repeat the process by removing the 28V source and returning the 7V source, that is:

The total resistance Rt:

Gives us Rt = 2.3333 ohms (or 2 1/3);

Total current It will be 7 volts/Rt = 3 amps, so Ir3 = 3;

So Ir2 = 2A – therefore using KCL Ir1 = 3-2 = 1A.

So, with 7V source: Ir1 = 1A, Ir2 = 2A and Ir3 = 3A.

Next, we calculate the voltage drop across each resistor, again by using only one voltage source at a time. Using Ohm’s law, voltage = current x resistance.

For 28V:

Vr1 = 4 x 6 = 24V; Vr2 = 2 x 2 = 4V; Vr3 = 4 x 1 = 4V. Recall that R2 and R3 are in parallel, so the total voltage drop (24 + 4V) = 28 V which is the supply voltage.

Now, for 7V:

Vr1 = 4V, Vr2 = 4V, Vr3 = 3V.

Phew – almost there. Now time to superimpose all the data onto the schematic to map out the current flow and voltage drops when both power sources are in use:

scan11

Finally, we combine the voltage values together, and the current values together. If the arrow is on the left, it is positive; on the right – negative. So:

Current – Ir1 = 6 – 1 = 5A; Ir2 = 2 +2 = 4A; Ir3 = 4-3 = 1A;
Voltage – Vr1 = 24 – 4 = 20V; Vr2 = 4 + 4 = 8V; Vr3 = 4 – 3 = 1V.

And with a deep breath we can proudly show the results of the investigation:

So that is how you use the Superposition theorem. However, there are some things you must take note of:

  • the theorem only works for circuits that can be reduced to series and parallel combinations for each of the power sources
  • only works when the equations are linear (i.e. straight line results, no powers, complex numbers, etc)
  • will not work when resistance changes with temperature, current and so on
  • all components must behave the same way regardless to polarity
  • you cannot calculate power (watts) with this theorem, as it is non-linear.

Well that is enough for today. I hope you understood and can apply what we have discussed today. The final chapter on resistors can be found here. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in education, kirchoff, learning electronics, resistorComments (6)

Seriously – don’t buy a cheap plugpack…

Hello readers

Instead of a normal day involving fun and learning with electronics, I got the scare of my life and a very sore back. You’re probably thinking it was something to do with the bedroom, but (un)fortunately no. It was revenge of the cheap plug pack. (In Australia we call wall warts plug packs).

In the recent past I wrote about a couple of cheap plug packs from eBay – here. Foolishly I kept using the other working plug pack. Not any more!

Consider this photo:

crap2s

Notice how there is the adaptor with the Australia pins – this slides on and off relatively easily. Today I went to unplug the whole thing, by gripping the small adaptor which would pull the lot out at once. However my grip was not strong enough and my fingers slipped, pushed down and pulled at the plugpack itself – just enough to leave a gap and the pins exposed. (see below) At which point my fingers slipped and grabbed the live pins.

crap2as

Although I consider myself to be a large physical specimen (185cm tall, 120kg) the shock was amazing (in a bad way). I fell arse over and ended up flat on the floor, and some strange feelings in my chest. After a few moments I sat up and had a walk around. Luckily my doctor is only ten minutes walk away so she gave me a once-over and told me to relax for the rest of the day.

So – the morals of today’s story:

One – don’t cut corners on safety by using substandard equipment

Two – no matter how familiar you are with electronics or electrical work – ELECTRICITY CAN KILL YOU!

Three – always see a doctor, even for the slightest shock.

If you have a tale of woe to share, please leave a comment below or in our Google Group. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in education, learning electronics, safetyComments (8)

Education – the Bipolar Transistor

Hello readers

Today we continue with the series of articles on basic electronics with this introductory article about the bipolar transistor, and using it as a switch.

What is a transistor?  It is a semiconductor with three leads, with which a small voltage or current applied to one lead can control a much larger current flowing through the other two leads. A transistor can be used as either a switch or an amplifier. Furthermore, there are two main types of transistor – the bipolar and the field-effect transistor. This article will examine and refer to bipolar transistors as transistors. Let’s go!

A transistor consists of three layers of silicon, P- and N-type in fact. Do you recall the diode article? A transistor is basically two diodes connected together in a Y-formation, in one of two ways as shown below:

pic11

Also notice the circuit symbols for NPN and PNP-type transistors. Transistors can be found in many shapes and sizes, the size usually being directly proportional to the amount of current the particular transistor is designed to handle. Thankfully the physical shape or package design has been standardised, and each casing type has a designation. Let’s look at some of the more common ones now:

TO-92 casing. When the flat-side is facing you, the pin numbering is 1-2-3. This casing style is for transistors that usually handle up to 100 mA. Unfortunately there are three varieties with regards to which pin is the base, collector and emitter – so always check your data sheet if in doubt.

TO-220 casing. When the metal tab is at the rear (above), the pin numbering is 1-2-3. The metal tab acts as a heatsink, and the hole enables one to bolt it to a larger heatsink, metal chassis, etc. This casing style is for transistors that usually handle up to around 8 amps.

TO-3 casing. These are all metal in order to dissipate heat – as they can handle up to around 75 amps of current. The entire metal case and ends are pin 2; pins 1 and 3 are the usual leads. Check your data sheet for pins 1 and 3! There are many other types of casing, but the three above are usually the most common.

How do transistors work?

For current to flow from the base of a transistor to the emitter, it needs to be forward-biased by at least 0.6 volts. In other words, there must be a potential difference between the base and emitter by 0.6V. If the base is connected to ground, the transistor will not let current pass from the collector to the emitter:

pic21

The transistors in the circuits above are NPN transistors. The current that flows from the base to the emitter is known as base current or Ib. The current that flows from the collector to the emitter is known as the collector current, or Ic. An interesting property of the transistor is this: the ratio of Ic to Ib is constant, and Ic is always larger than Ib. The ratio of Ic/Ib is known as the gain of the transistor. When reading a data sheet, gain is usually defined as hFE. This formula also proves that if there is no base current, there will be no collector current – you can’t divide by zero.

Using the transistor as a switch

To use a transistor as a switch, we need to know several things to be successful. For example:

To use the transistor to turn on the “load” we need to:

  • know the current drawn by the load. This is also the transistor’s Ic (collector current). Or the load’s resistance, as Ohm’s law can be used to calculate the current
  • know the transistor gain (hFE)
  • calculate Ib (base current)
  • use the above data to find a value for that lonely resistor

Let’s do that now with a contemporary problem… we have an Arduino that needs to turn a relay on and off at certain times. However you can only source up to 20 mA from a digital output on the Arduino, so we want to use it instead to switch a transistor which can control the relay coil. The problem is, what value resistor to use to control the base current?

pic41

First of all, let’s note what we do know. The relay (data sheet) coil requires 60 mA of current to activate, it is a 5 volt relay, and the coil has a resistance of 83 ohms. The transistor (data sheet) is a BC548 NPN transistor, very cheap and easy to find. It can handle a collector/load current of 100 mA, and the hFE (gain) is 110.  That diode is there to loop back pulse current when the relay is switched off. The supply voltage is 5 volts, and the digital output from the arduino is also 5 volts when active. There is also one more thing to take note of – the base-emitter junction is a diode, and therefore has a voltage drop of 0.7 volts. When you are switching large voltages, this is not an issue – however as we are working with a small voltage, the drop needs to be taken into account.

So, let’s calculate Ib, the base current. If hFE = Ic/Ib then 110 = 0.06 A/Ib; which translates to Ib = 0.06/110 = 0.0005 A. Which is basically nothing, so we’ll round it up to 1 milliamp.

Next, the resistor value. Using Ohm’s law (voltage = current x resistance):

Voltage = (5-0.7) = 4.3 volts (we need to take into account the voltage drop over the base-emitter junction of the transistor)

Current = 0.005 A (Will use a slightly higher current just to be on the safe side)

So, resistance = 4.3/0.005 = 860 ohms. For such a tiny current and small voltage, a 1/4-watt resistor is fine. (power = volts x current; = 4.3 * 0.005 = 0.0215 < 0.25)

If we didn’t have an 860 ohm resistor, a little higher is OK. I have used a 1k ohm resistor and it has worked nicely.

And there you have it – a transistor used as a switch. As stated at the beginning, this is only an introduction. There are literally hundreds of thousands of pages of material written about the use of transistors, so don’t stop here – experiment and do your own research and learning! In the next few weeks we will look at using transistors as amplifiers.

As always, thank you for reading and I look forward to your comments and so on. Furthermore, don’t be shy in pointing out errors or places that could use improvement. Please subscribe using one of the methods at the top-right of this web page to receive updates on new posts. Or join our new Google Group.

Some information for this post is from: historical info from Wikipedia; various technical information and inspiration from books by Forrest Mims III;  TO-3 package photo from Farnell Australia.

Posted in education, learning electronics, lesson, transistor, tutorialComments (4)

Electronic components – the Capacitor

Hello readers

Today we continue with the series of articles on basic electronics with this introductory article about the capacitor.

What is a capacitor? A very simple answer to that question is a part that stores electric current for use in the future. How is this so? A capacitor is made up of two conductive plates, separated by a dielectric. The plates can be made from conductive material such as aluminium, and the dielectric is between these conductive plates. Dielectrics can be made from nothing (i.e. be a tiny gap between the plates or a vacuum), paper, plastic film, glass, a special kind of fluid, or ceramic material:

pic1

When a difference in potential exists across the plates (a change in voltage) an electric field is created between the plates, which stores electrical energy – charging the capacitor. When the potential difference is removed, the energy will leak through the dielectric until the potential no longer exists – in other words discharging the capacitor. The amount of energy that a capacitor can hold – its capacitance, is a unit of measure called the Farad.

The term farad is named after an Englishman by the name of Michael Faraday, a genius chemist and physicist that discovered (amongst many other things) the concept of electromagnetic fields. Anyhow, one farad (F) is quite a lot of energy, so capacitors usually store much less. The most common units of measurement are the following:

  • picofarads – pF – 10^-12 – 0.000 000 000 001 F
  • nanofarads – nF – 10^-9 – 0.000 000 001 F
  • microfarads – uF – 10^-6 – 0.000 001 F

As well as the capacitance value, the other common parameters of a capacitor are:

  • the voltage (never exceed your voltage!)
  • leakage current – capacitors are not perfect and do leak a very tiny amount of current, usually in the micro-ampere range
  • tolerance – similar to resistors, actual versus manufactured values can vary – sometimes up to 20% either way
  • working temperature – always check this if your project involves extreme temperatures

It is always interesting to read component data sheets, and this is no exception for capacitors. You can learn a lot about the individual parameters and design your project accordingly. Here is a typical example of a data sheet for an electrolytic capacitor from Vishay. And here are the schematic symbols for non-polarised and then polarised capacitors:


At this point let’s have a look at the various types of popular capacitors:

Electrolytic Capacitors

electrolyticsmall

These are used when very high values of capacitance are required, for power smoothing, spike suppression and so on. They consist of two sheets of aluminium foil, one sheet covered with an oxide coating, separated by paper soaked in electrolye – this is rolled up and inserted into a cylinder, with two wires inserted. As the electrolyte is a liquid, it is affected by ambient temperature. Therefore as temperature increases, the capacitance increases – and vice versa. Therefore temperature extremes need to be taken into account, and perhaps other types of capacitors used. The capacitors in the photo above are radial capacitors; you can also find axial capacitors with one lead at each end. Note that electrolytics are polarised! They have a positive and negative lead – the negative is normally indicated by the striped-arrow line (see above).

V-chip capacitors

These are surface-mount electrolytic capacitors, for example these two on my Arduino (below):

smtelectrosmall

Ceramic capacitors

These are very small, constructed from layers of aluminium and ceramic material:

ceramicsmall

tinypolyestersmall

Their capacitance is also very low, the lowest I have seen is 0.015 picofarads. Typically used in situations that have high frequencies, such as spike protection for integrated circuits. Reading the value is quite simple, the first two digits are the significant figures, and the third is the multiplier. The result is always picofarads. For example. 121 is 120 picofarads, 8.2 is 8.2 picofarads, 12 is 12 picofarads. If there is a letter suffix, this indicates the tolerance:

  • C = +/1 0.25pF
  • D = +/- 0.5 pF
  • J = 5%
  • K = 10%
  • M = 20%
  • P = +100%/-0%
  • Y = -20%/+50%
  • Z = -20%/+80%

If there are numbers after the tolerance, they normally state the maximum working voltage. If your capacitor does not have a tolerance printed on it, assume it is between 10 and 20%. Or better yet, replace it with a better capacitor that states the tolerance.

Polyester capacitors

 

greencapsmall

newpolyestersmall

These are also very popular for high-frequency circuits, as they can discharge very quickly and have a very low leakage. The older styles (green/brown above) – read their values is the same as the ceramic capacitors (above), with a slight difference – sometimes (!) the voltage rating is before/above/below the value code. So using the green example above which reads “2A683J”, this breaks down to the voltage rating 2A, and the value 683, then the tolerance J. Voltage ratings are:

  • 2A – 100V DC
  • 2E – 250V DC
  • 2G – 400 V DC
  • 2J = 630V DC

So the 2A683J will have a voltage rating of 100V, a tolerance of 5%, and a capacitance of 68000 picofarads (0.068 uF or 68 nF).

Please note – this coding does seem to vary by manufacturer. Some will actually have (e.g.) 630V printed on them, and some even have their own coding. If you are unsure of the voltage rating, one has to really examine the circuit the capacitor is located in, or hunt down the data sheet. When buying new parts, it pays to get the data sheet from the distributor, then file it away indexed with your stock control database.

The newer styles (blue above) are different again. This one is 0.47 uF 63 volts 10% tolerance.

Variable capacitors

variablesmall

There are two main types – trimmer capacitors (above right) used for fine-tuning; and normal variable (or mini-tuning) capacitors (above left) used for applications such as radio tuning. Usually have a set range, for example the tuning capacitor’s range is 60 to 160 picofarads. The schematic symbol for trimmer capacitors is:

and for variable capacitors is:

Tantalum capacitors

Can be used as a replacement for electrolytic capacitors where space is at a premium, and a more accurate and less leaky (electrically that is) solution is required. Tantalums are also polarised (see the tiny ‘+’ in the photo above).

Surface-mount capacitors

There are many types of capacitor in surface-mount packaging. Hover over the images below for descriptions:

Mathematics of capacitors

Working with capacitors is easy, however some mathematics may be required. If you recall the formulae associated with resistors, you will find this quite easy.

Capacitors in parallel

This is simple – the total capacitance of parallel capacitors is the sum of the lot. However – the voltage parameter of the group is the minimum value used. Furthermore, do not mix capacitor types.

For example – C1 is 10 uF, 63V; C2 is 470 uF 25V; C3 is 1000 uF 16V. With these three in parallel, the capacitance is 1480 uF; and the maximum voltage is 16 volts.

{Thank you readers for checking my maths! – John :)}

Capacitors in series

This is somewhat complex, but can be done!

pic8

Again, always use the same type of capacitor, and the lowest voltage rating applies to the entire group.

Smoothing DC current with a capacitor

When AC current is converted to DC current using a bridge rectifier (four diodes) the resulting DC current is not very smooth… that is the actual voltage changes between zero and the maximum over very short periods of time. A capacitor can be placed between the positive and negative rails immediately after the bridge rectifier to solve this problem. It does this by charging to capacity when the DC current is above zero, then when the voltage from the rectifier drops the capacitor supplies current, acting as a reservoir. This in turn maintains the supply voltage:

beforeafter

Using the circuit above, we will demonstrate the smoothing process in the video clip below. The first part shows the AC current on the oscilloscope; the second part shows the noisy DC current at the points 4 and 8 on the circuit above. Then a 470 uF electrolytic capacitor is inserted across points 4 and 8 – you can see the difference and how smooth the current has become. There is still a slight ripple, but I cannot show this due to the low resolution of my oscilloscope. When building a power supply, one would place the linear regulator after the capacitor in our example.

Some information for this post is from Wikipedia; various technical information and inspiration from books by Forrest Mims III;  tantalum and SMD capacitor photos from element14 Australia.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in capacitor, education, learning electronics, lesson, tutorialComments (10)

Electronic components – the Resistor

Hello readers

Today we continue with the series of articles on basic electronics with this introductory article about the resistorWith regards to this article, it is only concerned with direct current (DC) circuits.

What is a resistor? It is a component that can resist or limit the flow of current. Apart from resistors, other electronic components also exhibit an amount of resistance, however the precise amount can vary. The unit of measure of resistance is the Ohm (Ω), and named after the clever German physicist Georg Simon Ohm. He discovered that there was a relationship between voltage (the amount force that would drive a current between two points), current (the rate of flow of an electric charge) and resistance (the measure of opposition to a current) – what we know as Ohm’s law – which states that the current between two points in a conductor is directly proportional to the potential difference (voltage) between the two points, and inversely proportional to the resistance between them.

Or, current = voltage / resistance. You should remember that formula, it can be useful now and again.

But I digress.

There are many types of resistors, each with a different application – but all with the same purpose. Let’s have a look at some now…

Fixed-value leaded resistors

These are the most common type that you will come across. The larger they are, the great amount of watts (the amount of power dissipated by the resistance) they can handle. More common varieties can vary from 0.125 watt to 5 watts. For example, here is a 0.125W resistor, the  length of the body is 3.25 mm.:

The body colour of these smaller resistors usually indicates the type of resistor. For example, those with a beige body are carbon resistors. They are usually the cheapest, and have a tolerance of 5%. This means that the indicated value can vary 5% either way – so if your resistor read 100 ohms, the actual value could be between 95 and 105 ohms. Resistors with a blue-ish body are metal-film resistors. They are usually a little bit more expensive, but have a 1% tolerance. Unless you are really trying to save a few cents, use metal-films. Another example is this one watt resistor:

They are much larger, this example is 25mm long and 8mm in thickness. The size of a resistor is generally proportional to its power handling ability.

Do you see the coloured bands around the resistor? They are colour codes, a way of indicating the resistance and tolerance values. And for colour-challenged electronics enthusiasts, a royal PITA. Resistor values can vary, from zero ohms (technically not a resistor… but they do exist for a good reason) up to thousands of millions (giga-) of ohms.

Let’s learn how to read the resistor colour codes. First of all, have a look at this chart:

resistor-colour-codes-small

Some resistors will have four bands, some will have five. From personal experience, new resistors are generally five band now. So you just match up the first three bands from left to right, then the fourth band is your multiplier, and the last band is the tolerance. For example, the three resistors below are labelled as 560 ohm resistors:

560rsmall

So the bands are: green, blue, black, black, tolerance – 5, 6, 0 = 560, then 1 for multipler = 560 ohms. The carbon-film resistor (top) has a gold tolerance band – 5%, the others being metal film are brown for 1%. This is why it is much easier to have a nice auto-ranging multimeter. Now if you need a resistor that can handle more than one watt, you move into ceramic territory. Thankfully these are large enough to have their values printed on them. For example:

There are literally scores of varieties of resistors in this physical category. If you don’t have the time or penchant to visit an electronics store, browse around online catalogues with images such as Digikey, element14/Newark (USA), Mouser, etc.

Surface-mount resistors

These are the becoming the norm as technology marches on. Even electronics hobbyists are starting to work with them. They consist of two metal ends which make contact with the circuit board, and a middle section which determines the resistance. They are tiny! The smallest being 0.6 x 0.3 mm in size. The smaller sizes may not have markings, so you need to carefully keep track of them.

As an aside, here is a interesting article on how to solder SMD parts at home. Moving on…

Resistor Arrays

You may find yourself in the situation where you need multiple values of the same resistor in a row, for example to limit current to a bank of LEDs or an LED display module. This is where a resistor array can be convenient. You can usually find arrays with between four and sixteen resistors in a variety of casings which speeds up prototyping greatly – however they do cost more than the individual resistors. For example: (hover over image for description)

Variable resistors

As expected there are many types of variable resistors, from the tiny to the large. Just like fixed-value resistors you need to ensure the power-handling (watts value) is sufficient for your project.

Variable resistors normally consist of a surface track that has resistive properties, and a tiny arm or contact that moves along the track. There are three terminals, one at each end of the track, and one to the arm or wiper. You would normally use the wiper contact and one of the others, depending on which way you want the variable resistor to operate (either increasing or decreasing in resistance). For example:

So as the wiper moves clockwise, the resistance increases…

Starting with the small – a variety of trimpots, used more for refining settings and not general everyday user input. Here is a small range of PCB-mount trimpots:

trimpotssmall

The two on the left are not sealed, exposed to dust and other impurities that can interfere with them. The two on the right are enclosed, and have a smoother feel when adjusting, and are generally preferable. These trimpots are single-turn, which can make getting finite adjustments in high-value resistances rather difficult. However you can purchase multi-turn trimpots allowing you greater detail in adjustment. Trimpots are usually labelled very well, depending on the manufacturer. For example, the black one above is 10k ohm, easy. Some will have a numerically coded version. Such as the one on the right. It is labelled 501, which means 50 ohms with 1 zero after it, so it is 500 ohms. Another example is 254, that is 25 with four zeros, i.e. 250000 ohms or 25 kilo ohm.

Next up are potentiometers – the garden variety variable resistor:

potssmall1

Apart form the resistance and wattage value, there are two major types to choose from: linear and logarithmic. The resistance of linear ‘pots’ is equally proportional to the angle of adjustment. That is, if you turn it half-way, its value is (around) 50% of the total resistance. Ideal for adjusting voltage, brightness, etc. Logarithmic are usually for volume controls. Here is a very crude example of the logarithmic VR’s resistance value relative to wiper position:

loggraph

When identifying your variable resistor, units marked with ‘A’ next to the value are logarithmic, and ‘B’ are linear. For example, B10k is a 10 kilo ohm linear potentiometer. These types are also available as doubles, so you can adjust two resistances at the same time – ideal for stereo volume controls. If you are going to build a project with these and mount them into a case, be sure to check that the knobs you want to use match the shaft diameter of the potentiometer before you finalise your design.

Light-dependent resistors

These can be a lot of fun. In total darkness their resistance value is quite high, around 1 mega ohm, but in normal light drops to around 17 kilo ohm (check your data sheet). They are quite small, the head being around 8mm in diameter.

Great for determing day or night time, logging sunrise and sunset durations, or making something that buzzes only in the dark like a cricket.

Digital potentiometers

Imagine a tiny integrated circuit that contained hundreds of resistors in series, and could have the resistance selected by serial digital control. These are usually classified by the total resistance, the number of potentiometers in the chip, the number of divisions of the total resistance offered, and the volatility of the wiper. That is, when the power is turned off, does it remember where the wiper was upon reboot, or reset to a default position. For example, Maxim IC have a range of these here.

Thermistors

Think of a thermistor as a resistor that changes its resistance relative to the ambient temperature. Here is a thermistor as found in the Electronic Bricks:

thermistorsmall

And the circuit symbol:

There are positive and negative thermistors, which increase or decrease their resistance relative to the temperature. Within the scope of this website, thermistors are not an idea solution to measure temperature with our microcontrollers, it is easier to use something like an Analog Devices TMP36. However, in general analogue situations thermistors are used widely.

Mathematics of resistors

Working with resistors is easy, however some planning is required. One of the most popular uses is to reduce current to protect another component. For example, an LED. Say you have an LED that has a forward voltage of 2 volts, draws 20 mA of current, and you have a 5V supply. What resistor value will you use?

First of all, note down what we know: Vs (supply voltage) = 5V, Vl (LED voltage) = 2V, Il (LED current = 0.02A). Using Ohm’s law (voltage = current x resistance) we can rearrange it so:

resistance = voltage / current

So, resistance = (5-2)/0.02 = 150 ohms.

So in the circuit above, R1 would be 150 ohms

Resistors in series

pic2

If you have resistors in series, the total resistance is just the sum of the individual values. So R = R1 + R2 + R3 …Rx

Resistors in parallel

Using resistors in parallel is a little trickier. You might do this to share the power across several resistors, or to make a value that you can’t have with a single resistor.

Voltage division with resistors

If you cannot reduce your voltage with a zener diode, another method is voltage division with resistors. Simple, yet effective:

pic41

Always check that the resistors you are using are of a suitable power handling type. Remember that W = V x A (power in watts = volts x current in amps)!

Update – “The resistor – part two” has now been published, with more information on how resistors divide and control current, and much more. Please visit here.

Well that wraps up my introduction to resistors. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in education, learning electronics, lesson, resistor, tutorialComments (12)

Electronic components – the Diode

Hello readers

Although my posts have generally been about microcontrollers, kits and related items, I have been rather lax in writing about electronics in general, and that magical world of wonder known as analogue electronics… i.e “Before Arduino” 🙂 So let’s go back to some of the basics. Starting with the diode

What is a diode? It is an electronic component that allows current to only flow in one direction. Before the advent of semiconductors, vacuum tube diodes were used. Thankfully no more…

A diode is comprised of two types of semiconductor crystal (usually made from silicon or germanium) that are highly refined then doped with an impurity. Depending on the impurity, the crystal can either be called an “N-type” or “P-type”. When you put an N-doped region next to a P-doped region, a diode or PN junction is formed. In our diodes, the P-region is called the anode, and the N-region is called the cathode. As you can imagine, these properties are useful, allowing current to flow only in one direction.


The basic symbol for a diode in a circuit diagram or schematic is this:


So in a circuit, the current only flows in one direction, for example:


When a diode is connected in this way, it is said to be forward-biased, that is the anode is connected to a higher voltage than the cathode. If the diode was reversed, with the cathode connected to the higher voltage, it would not allow current to flow, and therefore would break the circuit. A forward-biased diode is considered to be a closed switch, as the voltage does not drop as the current passes through the diode. However that is assuming the diode is perfect. And like many other things in life, it is not perfect.

All diodes are not perfect, and have what is called a forward voltage drop, this is the amount by which the voltage decreases as the current passes through the diode from anode to cathode. For silicon diodes, this is ~0.7 volts; for germanium diodes ~0.3 volts.

Diodes are also manufactured to handle a certain amount of power. Recall that:

power (watts) = current (amps) x voltage (volts)

As the voltage drop with our normal diode is 0.7V, the power dissipated by the diode can be calculated by simply multiplying the current by 0.7.

For example, if we have a 1 watt diode, how much current can it handle?

1 = current x 0.7; current = 1/0.7

Current = 1.42

So the 1 watt diode can theoretically handle 1.42 amps of current.

What happens if you use a diode the other way, that is attempt to allow current to flow from the cathode through to the anode. Ideally nothing will happen – to a point. Diodes have a breakdown voltage, when a reverse-biased (backwards) diode starts to allow current to flow through it. The breakdown voltage of each type of diode is different, it depends on the manufacturer. The best way to find out what the breakdown voltage of your diode is to check the data sheet. For example, a popular diode is the 1N4001. From page two of the data sheet (pdf), comes the following table:

pic4

So for the 1N4001 diode, the breakdown voltage is 50V. Peak repetitive means that the diode can sustain doing this more than once. Excessive voltage will not usually destroy a diode. Excessive current will destroy a diode. This is interesting, as you can use a diode as a voltage regulator, provided that you don’t exceed the maximum current it can handle. Refresh your memory about voltage division with resistors. The disadvantage of using two resistors is that it can be difficult to purchase precise values.

So let’s use a zener diode instead. They are manufactured with a much more precise (and lower) voltage; and handle less power. Zener diodes have a slightly different symbol:


Zener diodes will usually (hopefully) have their breakdown voltage within their part number. For example, an NXP 4.7V zener diode’s part number is: BZX79-B4V7. The 4V7 is the breakdown voltage, with a V for the decimal point. It can handle 500 mW, but this is not obvious – once again, you will need the data sheet (pdf). Below is a photo of a typical zener diode. It is very small, the grid paper beneath it is 5mm square. The ring or dark band around one end of the diode always indicates the cathode end:

1n750a

And now for an example. We have a tiny Zilog ePIR that requires a nice smooth 3.3v DC, and only draws 10mA, however the power rail on our prototype is 5V. This is a job for a 3.3V zener diode. Here is our schematic:

pic6

We need to calculate the appropriate resistance to limit the current through our zener diode. We are using a Fairchild BZX55C3v3 (data sheet pdf). Maximum power is 500mW or 1 watt. To calculate the value of the resistor, we will need the maximum current for the diode, calculated by

current = power / voltage

current = 0.5 watts / 3.3 volts

current = 0.150 A or 150 mA.

Using Ohm’s law, resistance = voltage /current

resistance = 1.7 volts / .15 A

resistance = 11.333333 = 12 ohms

So we would use a nice metal film 1% tolerance 12 ohm resistor, rated at 500 mW. Easy, 1.2 cents from RS or element-14.

Another type of diode is the signal diode. They handle much less current, usually around 100 mA, but are more suited for high-frequency signals, or semiconductor protection.Signal diodes can have a high breakdown voltage, but low power handling ability. A very popular signal diode used is the 1N4148 (data sheet), an example of which is below:

1n4148

For example, a signal diode may be places across the coil of a relay that is being controlled by a transistor – as it allows the current produced by the change in magnetic field when the coil is deactivated to head through the coil instead of the transistor. For example, when using an Arduino to control a relay coil:

 

pic7

Our next diode type is the germanium diode. They have a very small voltage drop of 0.2V, and are mostly used in crystal radio sets. They are very fragile, but are ideal for putting across a radio wave signal to convert it from AC to DC, which can then be amplified. If you are interested, here are some guides to making a crystal radio.

Another type of diode is the Schottky diode (named after the German physicist Walter Schottky). The symbol for a schottky diode is this:

There are two main differences between a schottky diode and a normal diode. One – a schottky diode does not have a discernible recovery time between conducting and not conducting a current. For example, a normal diode may take around a few hundred nanoseconds; whereas a schottky does not. This makes them useful in situations that involve very very high speed switching of current (for example, DC-DC converters such as Limor Fried’s mintyboost). Two – a schottky diode has a smaller forward voltage, a typical example (data sheet) is 0.55v.

Finally we come to rectifier diodes. Their main feature is the ability to handle large amounts of current, from 1 amp upwards; and higher breakdown voltages. For example the 1N4001 (data sheet) diode is 50V at 1 amp; the 1N5401 (data sheet) is 100V at 3 amps. The main purpose of these diodes is to protect against incorrect polarity from power supplies, and to convert AC to DC. For example, if you were designing a childrens’ toy that used a 9V battery, you would use reverse-bias a rectifier diode between 9V and GND in case the child forced the battery in the wrong way.

But how can rectifier diodes convert AC to DC power? Very easily – through the use of a bridge rectifier. A bridge rectifier is basically four rectifier diodes connected together, for example:

pic8

 

 

When the AC power is between 0 and maximum wave, the positive DC rail is fed by the path: 1,2,3,4; the negative DC rail is 8,7,6,5. When the AC power is between 0 and minimum wave, the positive DC rail is fed by the path: 5,6,3,4; the negative DC rail is: 8,7,2,1.

Bridge rectifiers come in various shapes and sizes, for example DIP packaging for 1A 100V models:

right through to 300A 1600V models…


Last but not least is the light emitting diode (LED). An LED is a special kind of diode, when it is forward-biased and a current applied, it releases energy in the form of light instead of heat. Here is the common schematic symbol for an LED:

When using an LED it is critical to ensure you have the correct voltage, otherwise your LED will overheat, burn your fingers when you touch it then eventually break. Always consult your data sheet. Calculating the correct voltage is quite simple. Using a bog-standard 5mm RED LED as an example (data sheet), you can use the following formula:

R = (Vs-Vled) / A

where:

  • R = value of resistor to use in ohms
  • Vs is your supply voltage in volts DS
  • Vled is the forward voltage of the LED at the recommended current
  • A is the recommended operation current of the LED

So for our example, we will use a 9V battery, and the LED from the data sheet above, Vled is 2V and A is 20 mA or 0.02 A

That gives us R = (9-2)/0.02 = 7/0.02 = 350 ohms.

Therefore, place a 350 ohm resistor between the positive of the battery and the anode of the LED. The most popular value of resistor to use would be a 390 ohm, 1/4 watt.

You can find LEDs in many different colours, and also units with two or more LEDs in the one housing, example red, green and blue. Some LEDs also create light in non-visible wavelengths, such as infra-red – these are used in remote-control applications and night-vision equipment. However if you are reading this, you would know by now where to find LEDs.

Well that wraps up my introduction to diodes. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

 

 

Posted in bridge rectifier, diode, education, learning electronics, schottky, twitter, zenerComments (6)

Subscribe via email

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: