Tag Archive | "and"

Adventures with SMT and a POV SMT Kit

Introduction

There’s a lot of acronyms in the title for this article – what I wanted to say was “Adventures with surface-mount technology soldering with the Wayne & Layne Blinky Persistence-of-vision surface-mount technology reprogrammable light emitting diode kit…” No, seriously. Anyhow – after my last attempt at working with hand soldering surface-mount components couldn’t really be called a success, I was looking for something to start again with. After a little searching around I found the subject for today’s review and ordered it post-haste. Delivery from the US to Australia was twelve calendar days – which is pretty good, so you know the organisation is shipping quickly once you paid.

The kit is by “Wayne and Layne” which was founded by two computer engineering graduates. They have a range of open-source electronics kits that look like fun and a lot of “blinkyness”. Our POV kit is a simple persistence-of-vision display. By using eight LEDs in a row you can display words and basic characters by waving the thing through the air at speed, giving the illusion of a larger display. An analogy to this would be a dot-matrix printer that prints with ink which only lasts a fraction of a second. More on that later, first – putting it together.

Assembly

Like most other kits it arrived in an anti-static bag, with a label clearly telling you where the instructions are:

Upon opening the amount of items included seemed a little light:

However the instructions are detailed:

… and upon opening, reveal the rest of the components:

… which are taped down to their matching description on the cardboard. When cutting the tape to access the parts, do it slowly otherwise you might send them flying off somewhere on the bench and spend ten minutes looking for it. Finally, the PCB in more detail:

After reviewing the instructions, it was time to fire up my trusty Hakko and get started. At this point a few tools will come in handy, including SMT tweezers, some solder wick and a piece of blu-tac:

Following the instructions, and taking your time are the key to success. When mounting the two-pad components – put a blob of solder on one pad, then use tweezers to move the component in whilst keeping that pad of solder molten, remove the iron, then let go with the tweezers. Then the results should resemble capacitor C1 on the board as shown below:

Then a quick blob at the other end seals it in. This was easily repeated for the resistors. The next step was the pre-programmed PIC microcontroller. It is in the form of a SOIC package type, and required some delicate work. The first step was to stick it down with some blu-tac:

… then solder down one pin at each end. Doing so holds it in place and you can remove the blu-tac and solder the rest of the pins in. I couldn’t solder each pin individually, so dragged solder across the pins then tried to soak up the excess with solder wick. I didn’t find this too successful, so instead used the solder sucker to mop up the excess:

suckersmall

If you solder, you should get one of these – they’re indispensable. Moving forward, the PIC finally sat well and looked OK:

Next was the power-switch. It clicks neatly into the PCB making soldering very easy. Then the LEDs. They’re tiny and some may find it difficult to identify the anode and cathode. If you look at the top, there is a tiny dot closer to one end – that end is the cathode. For example, in the lineup:

Soldering in the LEDs wasn’t too bad – however to save time do all the anodes first, then the cathodes:

At this point all the tricky work is over. There are the light-sensor LEDs and the reset button for the top:

And the coin-cell battery holder for the bottom. The battery is also included with the kit:

Operation

Once you’ve put the battery in, turn it on and wave it about in front of yourself. There are some pre-programmed messages and symbols already loaded, which you can change with the button. However you’ll want to put your own messages into the POV – and the process for doing so is very clever. Visit the programming page, and follow the instructions. Basically you enter the text into the form, set the POV to programming mode – and hold it up against two squares on your monitor. The website will then blink the data which is received by the light-sensitive LEDs. Once completed, the POV will inform you of success or failure. This method of programming is much simpler than having to flash the microcontroller every time – well done Wayne and Layne. A pin and connector is also included which allows you to wear the blinky as a badge. Maybe at a hackerspace, but not in public.

Once programmed some fun can be had trying out various speeds of waving the blinky. For example, here it is with the speed not fast enough at all:

… and a little bit faster:

And finally with me running past the camera:

Furthermore, there is an ‘easter egg’ in the software, which is shown below:

Conclusion

We had a lot of fun with this simple little kit, and learned a thing or two about hand-soldering SMT. It can be done with components that aren’t too small – however doing so was an interesting challenge and the results were quite fun. So it met our needs very well. Anyone can do it with some patience and a clean soldering iron. You can order the Blinky POV SMT kit directly from Wayne & Layne. Full-sized images available on flickr. This kit was purchased without notifying the supplier.

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 blinky pov, kit review, review, SMT, soldering, tutorial, wayne and layneComments (1)

Arduino Game: Tic-Tac-Toe

[Updated 19/02/2013]

Let’s recreate the game of Tic-tac-toe with our Arduino systems. This game is also known as Noughts and Crosses or Three-in-a-row. Whatever we call it, I’m sure you will be familiar with the game from your childhood or general messing about. For the uninitiated, there is an excellent explanation of the game over at Wikipedia.

tttboard

In the following examples, a human will play against the machine (Arduino). The demonstration sketches are almost identical except for one function – machineMove();. This function contains the method of deciding a move for the machine. By localising the machine’s decision making into that function we can experiment with levels of intelligence without worrying about the rest of the sketch. In writing this article it is assumed the reader has some basic Arduino or programming experience. If not, perhaps read some of my Arduino tutorials indexed here.

However first we will examine the hardware. I have used my well-worn Freetronics Eleven board, which is equivalent to the Arduino Uno. For a display, the Sparkfun LCD shield is used. For user input we have two buttons connected to digital pins 6 and 7, using 10k pull-down resistors as normal. The buttons are wired via a ScrewShield set. To save time I have used my generic button-board, whose schematic is below:

example12p3schematic

 

If you were to construct a more permanent example, this could be easily done. One could possibly use a DS touch-screen over their LCD. Perhaps for mark II? Nevertheless, time to move on. Now to explain how the sketch works – please download a copy from here so you can follow along with the explanation.

I have tried to make the sketch as modular as possible to make it easy to follow and modify. The sketch itself is relatively simple. We use an array board[] to map the pieces of the game board in memory – board[0] being the top-left and board[8] being the bottom-right position. We create a graphical representation of the board by drawing rectangles for the horizontal and vertical lines, lines to form crosses, and circles for … circles. The function drawBoard(); takes care of the board lines and calls drawPiece(); to place the players’ pieces. drawBoard(); reads the board[] array to determine if a position is blank (zero), a nought (1) or a cross (2).

The flow of the sketch is easy to follow. First the function introScreen() is called – it displays the introductory screen. Then drawBoard() is called to draw the initially-blank game board. Then the main function playGame(); is called. We have a global variable winner, whose value determine the winner of the game (0 – game still in play, 1 – human, 2 – machine, 3 – draw). playGame(); and other functions will refer to winner throughout the sketch. Within playGame();, the human and machine take turns placing their pieces. The function humanMove(); accepts the human’s choice in piece position, storing it into board[], and not allowing false moves. The function machineMove(); controls the decision-making process for the machine’s moves. In the first example, the machine moves by randomly selecting a board position. If the position is taken, another random position is selected (and so on) until a valid move can be made.

After each instance of humanMove(); and machineMove();, the function checkWinner(); is called. This function compares the contents of the array board[] against all possible scenarios for a win by either player, and calls the function drawTest(); – which checks for a draw – and stores the result in the variable winner as described earlier. Checking for a win is simple, however checking for a draw was a little more complex. This involves counting the number of 1s and 2s in the board[] array. If there are five 1s and four 2s or four 1s and five 2s ( in other words, the board is full) there is a draw. Easy!

If, after the function checkWinner(); is called, the varible winner >0 – then something to end the game has happened – either a win or a draw. This is determined using the switch…case function at the end of checkWinner();. At this point a function relative to the game status is called, each of which display the outcome and wait for the user to press button A to start a new game. At the end of each of these functions, we call the function clearBoard(); – which resets the array board[] and winner back to zero, ready for the next battle of wits.

Now for our first example in action. The function machineMove() is an example of the simplest form of play – the machine randomly selects blank positions on the board until the game ends. In the following video clip you can see this in action:

For the forthcoming examples, we will allow the choice of who moves first. This is accomplished with the function moveFirst(); which sets the variable whofirst to 1 for human first, or 2 for machine first. This is read by playGame() to determine the first move. Now let’s inject some strategy into our machineMove(); function to give the machine a slight edge above sheer randomness.

In the following example, the machine will first only use the centre or corners until those positions have been taken. This is accomplished by placing the position numbers into another array strategy1[]={0,2,4,6,8} which the machine will randomly select from until those positions are used.  Once all those positions have been filled, the machine will revert to random positioning to attempt a win. You can download this example sketch from here. Do you think the machine can win if allowed to move first? Let’s see what happens in the following video clip:

In the second example the player who moves first will generally have the advantage. From this point, how could we strengthen the machine’s level of intelligence to improve its strategy? If you have a better method, and can integrate it into the example sketch, and are happy to publish it under Creative Commons – email the sketch to john at tronixstuff dot com.

So there you have it, some variations on a classic game translated for our Arduino systems. I hope you found it interesting… or at least something different to read about.

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, education, games, LCD-09363, lesson, microcontrollers, tutorialComments (4)

Breaking up an automatic room deodoriser – round two

Again we attempt to break down an automatic room deodoriser.

Updated 18/03/2013

Today we are going to tear down another automatic room deodoriser. Why? Well the first attempt beat me, so it was time to even the score and try again with another type. The supermarket had the following units for $7.99, which seemed a little too cheap:

brandnewss1

The “satisfaction guarantee” gave me a chuckle, the thought of writing to SC Johnson complaining that their products were not that hackable would be interesting. But would it be hackable at all? Let’s find out. The packaging promises a squirt of scent when the unit detects motion, then holds out for 30 minutes until the next release. The word motion hints that there would be a PIR inside the unit. However the instructions mention that the unit does not work that well in dark or bright rooms – which is odd, as PIRs usually work in the dark. Hmm. This unit is somewhat smaller than the previous attempt, yet still offers us a pair of alkaline AA cells:

insidess

Moving on, time to start the disassembly process. The rear shows four screws, easily removed:

backss

revealing the fun things:

gearsss

The motor drive is reduced twice, which then has a geared arm which causes the vertical motion to pressure the cylinder to release the scent. The whole mess of gears was lubricated generously, the whole lot literally came out with the touch of a finger. Removing the gears and goop reveals the motor and control boards, which clipped out easily:

motorpcbss

Interesting – a labelled motor. Very good, what looks like to be a 3V DC motor. The control board is made up of two PCBs, a smaller module that holds a control IC of some sort, and the larger, lesser-densely populated board with the button, status LED and “motion detector”. Let’s have a close-up of that PCB:

pcbaloness

So we have the button, which causes the motor to run; a yellow LED which blinks once every five seconds; and out motion detector in the black casing. The motion detector seemed rather familiar, so I removed the black housing around it with some pliers, which revealed this:

lightsensorss

Huh – that looks just like an LED. The metal object inside the clear casing was even identical to what you would see inside an LED. However, foolishly I broke it off the PCB when removing the housing, so could not get any voltage to it. From reading the instructions earlier on – that mention the light/dark issue, causes me to ponder if this is some sort of light-dependent sensor?

No – it is a photodiode! However the motor looked quite worthwhile. Curious to see what is driving it, I hooked up Mr Fluke to see what happens:

No surprises there, almost three volts DC forward voltage. After applying forward current the circuit applies a quick reverse current to release, thereby causing the gears and arm to ‘squeeze’ down on the scent cylinder. So now we have a circuit board that runs on 3V, which can output 3V for a few seconds every 30 minutes – or at the press of a button.

With regards to current, another measurement was taken:


When free-running, the motor draws around 45 milliamps – and the stall current (that is, the current drawn when I force the spindle to stop) is around 675 milliamps. That is quite a strong little motor, and worth the effort. In general, this has been a good tear down, we scored some AA cells, a good motor and gears, some stink spray, and a timing circuit that could have uses elsewhere. So overall a win – the score has evened with the deodoriser world! High resolution photos available on flickr.

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 electronics, hardware hacking, room deoderiser, tutorialComments (4)


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: