Posts | Comments

Planet Arduino

Archive for the ‘Uncategorized’ Category

Hello readers

Today you can follow making a simple 5V DC power supply from initial idea to finished product. This is not an exercise in making a flash power supply, just solving a problem with the parts at hand.

When writing my Arduino tutorials, or generally experimenting with the breadboards – and more often both – I have needed 5V DC to power something, or in the case of working with two Arduinos at once, having to run USB cables all around the place just to power them. Some may say “Oh, just get another couple of wall warts/plug packs”. True, but good ones are over Au$20 here… and buying cheap ones have not been so successful in the past. However, I do have a collection of odd-voltage plug packs from old cordless phones and so on.. 12V AC, 15V DC etc. And to be honest, right now the bbbooost project is in pieces in a box as I’ve run out of breadboards at the moment working on other things.

So while at my desk I thought “How can I combine my need for 5V, my cheapness and use one of these plugpacks?”. Easy!

After perusing my stock database it turned out that all the parts were already around me to make a simple 5V supply using an LM7805 voltage regulator. It is quite versatile, can accept voltages up to 35V, and I have some in the drawer. Here is the data sheet: LM7805.pdf.

Following this it occurred to me that it would be nice to not have to worry about the type of current from the plug pack – AC or DC. So my circuit needs a bridge rectifier. That can be made with four 1N4004 diodes. And it would be nice to have a power-on indicator that isn’t a tiny speck of light. Thankfully I bought some 20mm red LEDs when Farnell had a crazy sale last year. Perfect.

And finally, a nice enclosure. Or anything really, to hold it all together. A small semi-opaque jiffy box was hiding in the cupboard with some veroboard, so they will be used. How? Here is my schematic: (click to enlarge)

Oh – the resistor is 560 ohms. And here are the participants in this project:

The black stuff at the top-right is heatshrink. The next though was how to mount the board in the box – I don’t have any standoffs, but the box does have some slots to hold the board. So this tells me how much space there is to use on the board, as I will trim it down to fit the space available:

But before hacking things up with the tinsnips, it pays to see if your circuit will actually fit in the board space available. (However my circuit was quite small, so I knew it would fit). This can be done by laying out your parts on a sheet of paper that has a grid of dots at 2.54mm intervals. Next was to measure the internal dimensions of the box in order to cut the veroboard. Then out with the tinsnips and chop chop chop. When using tinsnips or a saw of some sort, try and cut a little outside of the line – as the PCB material does flex a little .This means that you may lose 2~3 mm at the edges, so make allowances for that.

Moving on, I now have the board sized for the box and can start component placement:

The parts just fit in together nicely. I will have to drill the holes for the 7805 regulator so it can fit, however it doesn’t really leave room for the 0.1uF capacitor. However it is not really necessary, the output will be ok without it. The leads from the power socket, and to the switch and output lead will feed from the bottom of the PCB.

Now for one final visual check, and then to solder in the components.

After doing so, then it was time to put the link in and cut the tracks. I use a sanding bit on the drill to cut the tracks, completely removing the copper. :)

After cutting the tracks on the solder side, it was a good time to use the continuity function of the multimeter to check for shorts between tracks and other errors. The soldering proved to be fine, and the track cuts worked. Now it was time to position the DC socket and switch in order to wire them in, then drill their holes. The output wire is to come out of the top:

Now all there is to do is solder the connecting wires from the DC socket to the rear of the circuit board, and the output wire via the switch. At this point the unit was also tested. Naturally my eyesight had failed me and a short had appeared. However it was sorted out with the solder sucker:

Notice how I tied a know in the output lead before it passes through the lid – this is to stop accidental damage to the board caused by someone pulling the wire out. Here is the finished product, with a nice red glow for a power-available indicator:

Hooray – finished. What else was there to do on a Tuesday night? The LED indicates power is supplied to the box, and the switch just controls the load. Not too happy about that 5.05V reading… but then again, that meter was somewhat inexpensive.

I hope you enjoyed peering into my electronic life once again. The purpose of this post was more of a confidence-builder than anything, but hopefully someone out there read this and thought “Yes, I can do that”. So go for it!

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. High resolution images can be found on flickr.

Otherwise, have fun, be good to each other – and make something! :)


This is part of a series titled “Getting Started with Arduino!” by John Boxall – A tutorial on the Arduino universe.

The first chapter is here.

Welcome back fellow arduidans!

This week we will minimise an Arduino Duemilanove board, use time to control, and then mix all of that up. The hardware, not the readers… :)

So let’s go!

As time goes by, you will want to build projects to use away from the bench, or that are permanent. Although doing so is infinitely fun, it can become expensive if you keep buying Arduino boards for each project or proof-of-concept prototype, or even finished products. However, as always, the Arduino team have solved this problem for us as well. The actual microcontroller integrated circuit (e.g. ATmega328P-PU) can operate with a lot less circuitry than that is contained on your Duemilanove or compatible board. In fact, you can have a functioning Arduino system with three components and a 5V power supply.

How?

To start, please download the Duemilanove schematic from here. Upon glancing at it for the first time, there seems to be a lot of things required. However if you just want to use the digital and analogue pins, you can cut that schematic down to a lot less, however you need to make a couple of changes to how you upload the sketch. Here is what you can get away with:

X1 is the 16 MHz resonator. Using only the main circuit on the left, to upload your sketch you need to place the ATmega chip in your Arduino board, upload the sketch, then very carefully remove the chip and place it into your circuit, breadboard, etc. Please make sure to observe anti-static precautions, and always use a chip puller (below).

Furthermore, if you only have one chip, it would be very wise to have a second or third as a backup. A programmed ATmega with the Arduino bootloader can be had for less than US$6. Below is a shot of my barebones Arduino system at work. It is setup to run this basic example: example 10.1.pdf

The blue and yellow wires run off to a 5 volt power supply. And here is it working:

To recreate this at home, you will need:

A note about the resonator. Your Arduino board will most likely have a metal crystal, however a resonator is a little cheaper and easier to use, as it has the capacitors in built. If you look at the Arduino schematic, they use a crystal and two 22 picofarad capacitors. So if you use the resonator, pins 1 and 3 go to chip pins 9 and 10, and resonator pin 2 goes to GND. Here is the data sheet for the resonator. They should be easily available, for example from here or here. The USB cable option will make life a lot easier. The cable is called an FTDI cable, and contains the electronics within to interface between the USB port on your computer and the TX/RX pins on the microcontroller. The wiring details are in the schematic above. Inside the cable can roughly be described as this part of the Arduino board:

The cable contains the FTDI chip circuitry and so on. It also supplies power whilst programming, or leaving the cable plugged in. Here is my board with the extra wiring connected:

So if you have this kind of setup, you can just plug the cable into the computer USB port and upload sketches as normal. However there are some modifications that may need to be done with your computer’s operating system to make it work. If you are running Linux or MacOS, please visit here; if you are running windows of some sort, go to device manager, right click the USB serial port you are using, select properties, port-settings tab, advanced, and turn on set RTS on Close.

When purchasing an FTDI cable – make sure you get the 5 volt version! :) So now you can integrate the Arduino chip into your prototypes much easier and cheaper. However, if you are going to use SPI or I2C devices, more circuitry will be required. We will examine creating these interfaces in more detail later. A good compromise in this situation may be a barebones Arduino product such as a Boarduino, or Arduino Pro Mini.

Next on the agenda is a small project to consolidate some previous learning. At the end of chapter nine, we made a (relatively) user friendly clock with an alarm. And in chapter three, we controlled a relay with our arduino. So now we have the ability to create our own on/off timer of which possible uses could be limitless.

In doing so, we can start by modifying the sketch from exercise 9.3. It has the ability to set an alarm time (let’s call it a start time from now on), so we can add the ability to set an end time – it just requires some more variable to store the end time data, and another menu function to set these. Finally, another function is required to check if it is time to turn off (basically identical to the checkalarm() function.

The hardware side of things for the example will be quite simple as well, below is my schematic, and the basic board:

I am using 12v relays as currently that is all I have in stock. The 12V power supply is just an LM7812 regulator from a 20V DC plugpack. For demonstration purposes any low-voltage relay would be fine. A 5V relay such as this would be perfect as you could run it from the Arduino’s 5V rail.

Note: From here on you understand that one can use an arduino to switch a very high current and/or voltage with some relays. Please exercise care and consult a qualified, licensed person if you are working with mains voltage (100~250V AC… the stuff that comes out of power points/outlets). They can KILL you!

So for this example, I have modified the sketch as described earlier to accept a start time, end time, and display relevant data on the screen. It will switch on and off the relay, which controls a light globe drawing 100mA – 5 times the current an Arduino digital out pin can deliver. It only operates using 24-hour time, to save user confusion. You could control anything as long as you do not exceed the current and voltage maximums for your particular relay.

So here it is in action. The time has already been set previously, so you can watch the setting of the on/off time, and watch it in action. You can skip ahead from 01:03s to 01:48s to save time.

and here is the sketch for your perusal: example 10.2.pdf.

As as example the user interface wasn’t that flash, but naturally it can be worked on to be more intuitive. So now it is your chance to do so, with…

Exercise 10.1

Create a timing system for a hypothetical lighting system that controls two independent circuits. Each timer can turn on or off at a specified time, either daily, only on weekdays, only on a certain day of the week (e.g. only Fridays) or only on weekends. The menu system should be easy and quick to use.

For the purpose of the exercise, you can switch on or off an LED to represent each lighting circuit – you already know how to use the relays.

You will need:

  • Your standard Arduino setup (computer, cable, Duemilanove)
  • Two usual LEDs of your choice
  • 2 x 560 ohm 0.25 W resistors. For use as current limiters between the LEDs and ground
  • 1 x 10k resistor
  • one push button
  • breadboard and some connecting wire
  • some water
  • DS1307 timer IC circuit components (see this schematic from chapter seven) or a pre-built module
  • one 10k linear potentiometer
  • LCD module as per chapter two

Here are some videos of my interpretation. To save time I have not connected the LEDs, however timer running status is indicated on the second line of the display – an “!” is shown when a circuit has been activated. The first video shows setting the real time, timer data and displaying the results:

and the sketch: exercise 10.1.pdf.

How did you go? With a little more hardware this exercise could become a real product – you could control sprinkler systems instead of lights, thermostats, anything is really possible. Having a larger LCD screen would help with the user interface, perhaps a 20 character by 4 line unit. As long as such a screen has the standard HD44780 interface, you would be fine.

Due to unforeseen circumstances, this week’s chapter has been shorter than usual, and for that – I apologise.

However, kindly subscribe (see the top right of this page) to receive notifications of new articles.

High resolution photos are available from flickr.

If you have any questions at all please leave a comment (below). We also have a Google Group dedicated to the projects and related items on the website – please sign up, it’s free and we can all learn something. If you would like to showcase your work from this article, email a picture or a link to john at tronixstuff dot com. You might even win a prize!

Don’t forget to check out the range of gear at Little Bird Electronics!

So have fun, stay safe and see you soon for our next instalment!


Giu
11

Getting Started with Arduino! – Chapter Ten

Uncategorized Commenti disabilitati su Getting Started with Arduino! – Chapter Ten 

This is part of a series titled “Getting Started with Arduino!” by John Boxall – A tutorial on the Arduino microcontrollers, to be read with the book “Getting Started with Arduino” (Massimo Banzi).

The first chapter is here.

Welcome back fellow arduidans!

This week we will minimise an Arduino Duemilanove board, work with wireless, use time to control, and then mix all of that up. Hopefully not my readers though…

So let’s go!

*****************

As time goes by, you will want to build projects to use away from the bench, or that are permanent. Although doing so is infinitely fun, it can become expensive if you keep buying Arduino boards for each project or proof-of-concept prototype, or even finished products. However, as always, the Arduino team have solved this problem for us as well.

The actual microcontroller integrated circuit (e.g. ATmega328P-PU) can operate with a lot less circuitry than that is contained on your Duemilanove or compatible board. In fact, you can have a functioning Arduino system with three components and a 5V power supply. How?

To start, please download the Duemilanove schematic from here. Upon glancing at it for the first time, there seems to be a lot of things required. However if you just want to use the digital and analogue pins, you can cut that schematic down to a lot less, however you need to make a couple of changes to how you upload the sketch. Here is what you can get away with:

Using only the main circuit on the left, to upload your sketch you need to place the ATmega chip in your Arduino board, upload the sketch, then very carefully remove the chip and place it into your circuit, breadboard, etc. Please make sure to observe anti-static precautions, and always use a chip puller (below).

Furthermore, if you only have one chip, it would be very wise to have a second or third as a backup. A programmed ATmega with the Arduino bootloader can be had for less than US$6. Below is a shot of my barebones Arduino system at work. It is setup to run this basic example: example 10.1.pdf

The blue and yellow wires run off to a 5 volt power supply. And here is it working:

example 10.1.mpeg

To recreate this at home, you will need:

  • One ATmega328P-PU microcontroller with Arduino bootrom
  • solderless breadboard
  • 10k ohm resistor
  • 16 MHz resonator
  • (optional – for USB cable) 6-pin header pin
  • (optional – for USB cable) 0.1 uF ceramic capacitor
  • (optional – for USB cable) FTDI cable

A note about the resonator. Your Arduino board will most likely have a metal crystal, however a resonator is a little cheaper and easier to use, as it has the capacitors in built. If you look at the Arduino schematic, they use a crystal and two 22 picofarad capacitors. So if you use the resonator, pins 1 and 3 go to chip pins 9 and 10, and resonator pin 2 goes to GND. Here is the data sheet for the resonator. They should be easily available, from here or here for example.

The USB cable option will make life a lot easier. The cable is called an FTDI cable, and contains the electronics within to interface between the USB port on your computer and the TX/RX pins on the microcontroller. The wiring details are in the schematic above. Inside the cable can roughly be described as this part of the Arduino board:

The cable contains the FTDI chip circuitry and so on. It also supplies power whilst programming, or leaving the cable plugged in. Here is my board with the extra wiring connected:

So if you have this kind of setup, you can just plug the cable into the computer USB port and upload sketches as normal. However there are some modifications that may need to be done with your computer’s operating system to make it work. If you are running Linux or MacOS, please visit here; if you are running windows of some sort, go to device manager, right click the USB serial port you are using, select properties, port-settings tab, advanced, and turn on set RTS on Close. When purchase an FTDI cable – make sure you get the 5 volt version! :)

So now you can integrate the Arduino chip into your prototypes much easier and cheaper. However, if you are going to use SPI or I2C devices, more circuitry will be required. A good compromise in this situation may be a barebones Arduino product such as a Boarduino, or Arduino Pro Mini.

****************

Must acknowledge use of arduino circuit diagram (These files are licensed under a Creative Commons Attribution Share-Alike license,) and ladyada.net/make/boarduino cc v2.5 attribution share alike, link appropriately to boarduino and licence terms. therefore the circuit diagram for this project falls under the same license (generic non-country specific if possible)

*****************

on-off timer relay on or off at certain time LCD control panel with pot. like the clock from chapter 9

final exercise (2 individual relays) on time, on date, off time, off date or instead of date daily, weekday or weekends – wireless link to relay module.

****************

Wireless

need to be able to switch on and off two digital pins wirelessly.

*****************

Conclusion etc

Conclusion etc


Mag
06

An oscilloscope.

[update: usage photos 12/05/2010]

Since returning to the world of electronics and general gadgetry, an oscilloscope has always been on my shopping list. However, they are not cheap. Sure, I could get a second-hand one from eBay, but here in Australia there are not that many floating around; the used ‘scopes are generally ex-defence or education and looked pretty whipped. However, being an impatient person a kit from JYETech (the same people who make the capacitance meter kit I reviewed in March) really grabbed my imagination – a kit digital oscilloscope! Cheap, low specification, but interesting nevertheless. After thinking about it too much, and after watching all the youtube videos about it… I ordered one.

Let’s see what happens…

After a week my parcel arrived. Once again JYE Tech have not spared any expense on the packaging for the actual kit, just enough for everything to be safe.

The kit has some nice panels, front and rear, and a great solder-masked, silkscreened PCB. Thankfully I ordered the version that had the SMD components already soldered. (This kit is available in three versions: full kit, SMD soldered, and totally assembled [not really a kit...!]).

And time to check all the pieces have been included. There is no list inclued, so you have to check off against the BOM from the JYE Tech website for your particular version of the kit. This is not a kit you can just jump into and solder…

The instructions are very… sparse, confusing and time-consuming. One double-sided A4 piece of paper, one side with the schematic, and the other with a “quick reference”, internet links to support and a photo of the populated PCB. Thankfully, the JYETech website has all the documentation ready for download, and they also run a very well supported Google Group. Phew. They even publish the .dxf CAD files. So after downloading and printing off all of the documentation, it was time to review it and have lunch.

There is an amusing line in the instructions – “you will probably need to make a simple probe”. Yes, indeed. Included are enough parts to make a simple probe – with alligator clips at the end. Let’s call them semi-useful. They will do for the meanwhile, however a real probe set will be ordered shortly.

Anyhow, enough preparation and reading. Time to build. NOTE: There are several versions of this kit – please double-check you have the correct assembly instructions. Look at your PCB – there is a white sticker on the edge with a code such as “06202KP…”  - make sure that you have the correct sheet for your kit. There is no guarantee the correct sheet will ship with the meter!

Thankfully due to the SMD nature of most of the parts, there isn’t that much to solder. Firstly, I wanted to get the 7805 regulator and heatsink in:

… and the rest of the parts – 7 capacitors, a diode and an inductor. You really need to have your wits about you – there are places on the PCB and parts in the schematic for which you are not to use – it is easy to get lost if you don’t concentrate. Just remember to match the physical components supplied against the BOM from the website, and only install those – after considering the assembly instructions. Another caveat is that you need to check you have the correct documentation for your PCB. For example, mine was a 06202KP, whereas the website had something different. Thankfully the Google Group had the correct .pdf file.

Remember that positive pins of capacitors into square pads. There seems to be an ambiguity in the instructions regarding C14 – for the 06202 model, C14 positive is on the right hand side.

Next, the sockets for signal and DC, switches and push buttons. You need to get the switches and buttons flush with the PCB, otherwise you will have issues with the top panel and button caps.

Don’t forget the 2×4 pin header – solder it in before the LCD! Now for the LCD.

Stop now. Make sure you run the power tests as per the assembly instructions. Once that LCD is soldered in, having to take it out again will be a huge PITA.

When you look at the rear of the LCD module, there are two rows of 20 holes – solder the row of pins into the row with markings (GND~NC). I found the easiest way to do this was to sit the row of pins into the main PCB, sit the LCD on top and solder the pins into the LCD module. The solder in the 2 pairs of pins that support the LCD. You may find the heatsink blocks one of the pins – just cut one pin off and use that then.

Now it is seven hours later. To cut a long story short – be very careful when soldering the LCD pins. It is very easy to cause a bridge which will wreak havoc and short out something, which cooks the LCD, 7805 and the microprocessor. If your unit heats up like a stove, unplug it and triple check your soldering under a magnifying glass. Run continuity tests to be sure you haven’t shorted out anything.

But thankfully – after all my time working on it, hunched over a hot iron in a dark room, and staring through a magnifying glass:

Woohoo! We have life!

I had that heatsink on just in case  - didn’t take it off for the photo. Now it is time to assemble the body and make it look presentable:

And of course … I’ll need a set of probes. So I assembled them using the parts included in the kit. They will have to do until my real one arrives.

Finally – I can clean up the desk and wash my hands. Originally I was going to write a whole section explaining how oscilloscopes work and the terminology. But thankfully the good people at Tektronix have done this already and made a nice little e-book for us. So here it is: XYZs of Oscilloscopes (Tektronix) PDF.

Now, let’s spend some time examining what this baby can do. Just a note at this point, if you didn’t install the heatsink, you should install a clip-on heatsink over the 7805. After sitting on my desk for around 30 minutes the 7805 does get warm.

[update] Here are some photos of the scope in use:

14.2 volts AC. The scope should have displayed the minimum and maximum, but for some reason has clipped them.

In order to see half of the full wave, the V.POS was lowered to the minimum. This is indicated by the tiny marker at the bottom left of the LCD

Again with V.POS at the minimum, the time period was altered, and the display frozen to see the maximum.

5 volts DC at 5 volts per division

5 volts DC at 2 volts per division

By dropping V.POS to the minimum, you can increase the maximum amplitude possible. Note the tiny marker at the bottom-left of the screen, indicating the new 0V line.

5 volts DC using 1 volt per division.

2 volts DC at 0.5 volts per division (using x5 and 0.1 settings)

1.25 volts DC at 0.5 volts per division

By default it shows 50Hz as that is the frequency of mains voltage in Australia (probes not connected, it gets the default frequency through the power supply [Australia is 240V 50 Hz]).

And now for a video, a short compilation of various measurements: DC voltage, frequency, FFT and pulse-width modulation.

You can also upgrade the firmware and save screen shots if you attach a cable to the jumpers on the rear of the main PCB. If you were to do this often enough, it would be wise to cut a rectangle out of the back panel.

Conclusion.

To be honest, I found this kit very challenging to assemble, finding the correct instructions the second time around was very frustrating, and the documentation is very poor. This is not a kit for beginners, more of a curiosity for those experienced in electronics work and fault-finding. In saying that, I’m glad I had a go – assembling and getting it to work taught me a lot about my own abilities, fault-finding, and tested my patience. But it gave me a real buzz once I got it working.

It was rather annoying to use such a low screen resolution, you won’t be detecting too much ripple on your DC power supplies with this one. But for the price, it is an interesting piece of gear. I will probably end up giving it away as a prize or something. It has a maximum of 50 volts peak to peak input amplitude, but I couldn’t for the life of me hone the display down to show 12 volts AC without cutting off the minimum and maximum. Will persevere and spend more time with it.

Furthermore, it is a good stepping stone to acquiring a full oscilloscope – if you find yourself using this one and getting frustrated with the limitations, it’s time you bought a full ‘scope!

This kit is available from a variety of sources, and Little Bird Electronics has all three variants available in stock.

Thank you for reading and I look forward to your comments and so on. High resolution photos are available on flickr.

Please subscribe (see the top right of this page) to receive notifications of new articles. If you have any questions at all please leave a comment (below).

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



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook