Skip to content

Archive for December, 2014

31
Dec

Wii – or not to Wii

Seems like the Nintendo Wii is about 90 years old, well, in dog years any way. Both my daughter and I have one although she’s the only one to use hers. Ours has become a paper weight. Of which it is doing an excellent job.

The kicker with the Wii is the controllers and those batteries that it seems to eat. We’d all bought the rechargeable controller packs that fit in a base station. The Wii fits into the base station, a fan circulates air up through the Wii itself from the base station.

IMG 0244

To power the base station, there is a short USB cable from the back of the Wii to the base. It powers some blue LED’s, which do nothing more than “glow”, and provides enough power to charge the two controllers.

Which is where the first problem comes in. The fan in the base unit is your typical piece of junk. At best. Probably designed to fit in some power supply, provide some sonic icy blast of air and sound like a jet turbine all at once. I suspect sleeve bearings in these things because they sound like a muffler-less John Deere tractor when the bearings go.

As in LOUD! Real loud. The daughters fried last year and I tried replacing the fan and gave up. Who has 5V supply fans that are quiet? Not me. So I gave her my base and away she went. Until this week. And then, well, the bearings in my unit happened to go south.

In the meantime I’d been playing a lot with Arduino’s so I have built up a stock pile of parts. One is a 5V 14dba fan (40mm), the other is a DC to DC buck converter.

Take apart the base and you find a single circuit board and fan. I’ll warn you now. Getting that old fried fan out without enlarging your vocabulary is impossible. I finally took my side cutters and literally cut it out.

I wired in the BUCK converter, took leads for 12V to fan.

IMG 0240

Since I was going to run the base off a standard 12V adapter, I wasn’t going to worry about the 5V coming out of the Wii. The LED’s still work as well since the 5V output of the buck converter is supplying the charge part and the “uber” LED’s. Insert BIG WHOOP here…:-)

IMG 0242

Everything fits back in, I measured the “current” the whole thing draws. Charge and LED’s, 100ma. The buck converter is capable of 1A so got LOTS of headroom. The AC adapter doesn’t even get warm so…I charged up two controllers and the thing works like a hot damn. Not ready for the landfill yet…

28
Dec

Coin Sorting Bank – Arduino

The second project I made for Christmas this year was for my son. I got a piece of slot machine glass and he’d expressed interest in the sort of steampunk slot machine I’d made for Carol earlier this year.

However, with Arduino’s and the stuff I build with them, I try to do “one ups”. I.e. each one is unique in its own way. For Andrew I knew it was going to be a bank of some sort and therein was the clue as to what I was going to make. A bank that sorted the coins per denomination.

I spent considerable time looking at coin sorting methods on the internet. From spinning wheels, ramps and slots to commercial sorters that cost about $10 less than my last vehicle. The initial criteria was it had to be reasonably reliable and it didn’t have to sort a high volume of coins in a hopper or something. Hence, not a lot of stress was going to be put on it.

For the “proof” of concept I picked up some 1/4″ corrugated plastic and cut some slots in it that would match the coin size. I put a piece of wood trim along the bottom edge (about 14″ in length).

IMG 4886

Stood it up, laid it over at an angle and rolled some coins down it. Worked perfect every time once I found the right amount of lean and downslope. The trick is exactly that. Too much lean and the coin rubs against the plastic too hard and you need a considerable downslope to make it roll.

Too little back lean and the coin tends to roll off the front edge of the trim. I put a second piece of wood to stop it from doing that and immediately found that as the coin tried to flip back through its slot it wedged itself against the channel it was running in. Therefore my advice if you make one of these, don’t do that…

Once I had the plastic working the way I wanted, I picked up some 5/16″ birch subflooring to make a wood one out of. Plastic would have worked but wood was easier to glue to. I used a Dremel saw to cut the slots. I deliberately made it oversize so I could cut it down later.

IMG 4890

I designed it to work with Canadian coins, so in the left to right order of the slots; dimes, nickels, quarters, loonies, and toonies. I glued a trim piece on the bottom for the coin to run along and really, once you get the coin slots right, it’s simple to build.

Time to start on the main box housing. Overall size, because the display glass was so large, is 20″ x 20″ x 8″. Made out of 3/4″ knotty pine, joined with Festool Domino’s (because it’s just such a fun tool to use).

IMG 4922

Cutting the gussets to fill in the corners at the top of the glass proved to be the hardest part of the build. I think I cut about 3 or 4 sets before I finally got the indent and angles right even after measuring twice and cutting once. Which begs the frustration pix…

IMG 4923

None the less, lots of cuts and cusses later, I got the two fill pieces to fit.

IMG 4926

I’d previously used “six coin” accepters from SparkFun and I was going to use one again on this project. I have a template I use for cutting out where it goes but the mounting bolts for it aren’t long enough to get through 3/4″ pine. I ended up using a bottoming drill from the inside to make the mounting holes only 1/4″ deep. Worked perfect.

IMG 4939

Because the front glass is designed to be lit I put a backing piece of wood, 1″ behind the front glass. I mounted LED’s all around the outside (they are affixed to the frame of the box. This is the backlighting and works well.

Then it was into the shop to figure out the coin slot lean and downslope mounting inside.

IMG 4927

I used a couple of clamps to hold blocks and rested the coin ramp on it. I could then adjust it up or down as need be. A good way of doing it “before” you glue the whole thing in place. This is the first test run and I found that coins coming down out of the acceptor would bounce off the ramp.

IMG 4928

Therefore a slight coin debouncer was needed. I tried with a small piece of wood.

IMG 4930

The small piece stopped the LARGE coins from bouncing but I think the CDN dimes contain some jumping beans or something. They bounced like crazy. In every direction. Obviously a larger piece of wood was needed.

IMG 4931

The larger piece of wood worked perfectly. I also cut the top edge at an angle that matched the drop “zone” from the bottom of the coin acceptor. This dampened the bounce effect and settled the coin right down so it would begin it’s roll. I used a protractor to find the angle and I cut a wedge piece to attach to the inside back plane that would hold the coin ramp.

In the previous picture you can just see the foam board piece by the left clamp. That’s the angle piece I had measured and used as a guide.

Then, time to build the drawer. Made it out of 1/2″ plywood with the 5/16″ sub flooring for the dividers. Used a router to make the slot holes for a relatively neat fit. And no, I’m not a wood worker by anyone’s definition. More of a wood butcher.

IMG 4932

The coins in the “bank” tend to fall straight down off the coin ramp so I had to build some deflectors to get the coins to the right slot in the drawer. I probably over built them but hey, they work perfect.

IMG 4935

From the front, the project, “Lucky Larry” was starting to take some shape.

IMG 4934

For finishing, I’m not much of a stain guy. More of a glossy guy. Polycrylic is one of my favourite finishes to use so out came the masking tape and gloss Poly. The secret to working with Polycrylic is not to over work it. Put it on, let it level. Don’t go back over it, even if you see an area that “needs” it. Better to wait for it to dry, then sand lightly and recoat. I usually use 3-5 coats of the stuff and once it starts to harden, which it will do over a period of months that finish gets rock hard.

IMG 4938

After the paint was dry (couple of days I let it cure), it was back to the shop to start adding Arduino stuff. I planned for the LED’s inside the front glass but I also added TWO displays to the front. More or less to fill in the same areas on the glass that reported how much you just lost (or rarely won) in the real slot machine.

I used automotive doubled sided tape to stick them to the glass and then ran all the wires back through the inside false back.

IMG 4941

For “control”, there is an Arduino Pro MICRO (32U4), DS3231 RTC, DC-DC buck converter for 12V to 5V, MOSFET power control board for the LED’s behind the glass, 1.8″ TFT and a 2004 LCD, reset button and a piezo speaker. If you’re wondering why a Pro Micro, it’s because it has two serial ports. The coin acceptor works best on a real serial port with an Arduino, not the “SoftwareSerial” library. So I can have debugging serial and dedicated coin serial. Happy!

IMG 4945

While the front glass is from a slot machine, my “lucky larry” is simply “lucky” when you feed him. The two displays show different information. The LCD shows the date and time, plus the coin count for each of the denominations in the “bank”. So when it comes time to roll up the coins, you know how many of each type you have.

The TFT display just shows whether “Larry” is “hungry” (no money in the bank) or a running total.

Andrew had made a request before I started the project in saying that he didn’t want the glass back lighting on all the time. The best way to do that is with a lighting schedule. Therefore the reason the DS3231 clock is used. On weekdays the backlighting comes on at 5pm and shuts off at 10pm. On weekends it comes on at 10am and shuts off at 10pm. Of course it’s programmable so it can easily be changed.

Ultimately, it’s not as bright as I thought it would be. I was thinking like a lighthouse, when it fact it’s far more subdued.

IMG 4948

When he opened it at Christmas it didn’t take him long to snap a photo of it and send it to all his friends. Who replied with a rather resounding approval. I’m going hazard a guess he likes it..:-):-):-)

26
Dec

Word Clock – Arduino

Now that Christmas is over I can finally post a project I made for my daughter for Christmas. The idea started some time ago when she causally mentioned she’d like a clock for the “movie” room downstairs. At the time I said I’d see what I could come up with.

Laura knows I love bright flashy LED lights so there wasn’t a whole lot of “gee dad, that’d be nice”. More of a repetitive “has to be dim” message…LOL

I’d already built scads of Arduino clocks but I wanted something different so I had a look at Dougs Word Clocks. While not a Doug original concept, he’s done an admirable job of making finished and kit projects available to people.

As I read of how it all works, I could appreciate the fact that they are all inclusive, designed on a PCB, very neat and efficient. Albeit somewhat expensive but you also get a very stylish looking clock. Since I decided to build my own so that I could maintain or reprogram it if need be, a kit was out of the question.

The more I looked at the circuitry, I could see a number of ways to build the LED matrix for lighting up the words. Where the main stumbling block I hit was, designing the face. Laser cut acrylic would have been expensive, same for etching glass, so I opted for something simple. Essentially I laser printed two sheets of words, so basically a lot of “black” with white letters. I built a test jig for a “cell” and it worked fairly well.

The local Michaels had a big sale on shadow boxes and I was off. I picked up some 1/4″ foam board for backing, printed off the front display template and a backplane template. The backplate (foreground in the photo) shows the 1/4″ outlines where I have to fit in the foam board to make the word cells. The whole thing has to fit in a 12″x12″ frame.

IMG 4830

I glued the backplane onto the foam board to start with double sided tape.

IMG 4831

For the LED’s I decided early on I wasn’t going to use a PCB or poke them through the foam and then solder from the back. Nope, I was going to use addressable LED’s, a string of WS2812B’s. I’ve built two of these clocks so far (and I don’t have plans to make any more), and I used 110 WS2812’s in each clock face.

If you’re doing some calculations for the cost, 5 metres of these LED’s cost about $65 USD. I’m using about 2 metres per clock (60 LED’s per metre).

IMG 4832

The LED’s have a self adhesive backing so that’s what I used. I stuck them right on to the laser printed template. I tried to get the LED’s away from the cell borders but sometimes, I ended up moving the cell border a smidgen. No big deal really.

The LED’s have a direction that the signal has to pass and three wires to get it done. Vcc, GND and Signal. I ran the LED’s starting from the top left to the bottom right in a back and forth direction. So even lines all run right to left, odd lines run left to right. You can see the wires in the photo.

IMG 4833

I cut 1″ strips of foam board to act as the cells and the outside of the box. Glued it all into place with silicon, flipped it over, added a weight to it and left it to cure>

IMG 4834

If you notice the back looks oversize, it was done that way on purpose. After it was all dried, I could cut the back to size with a box knife.

Once cured, I flipped it face side up, used double sided tape on the all cells and taped the laser printed face plates to the cells. Effectively sealing them I know, but so be it. When that was done I had a working word box wired and ready for the next phase. Putting it in the shadow box.

I started with another piece of foam board, cut out the side of the clock face, and then glued the two together. I also cut a MASK of black cardboard to cover the cut so when you view it from the front it’s like the matte on a poster. Worked quite well.

IMG 4850

The Arduino bits and pieces easily fit in the space inside the shadow box. Pro MINI, HC-05 Bluetooth, DS3231RTC, buck converted for 12V to 5V, and an LDR for automatic dimming.

IMG 4852

The sketch I wrote is mostly my own. I only borrowed from other word clock sketches for one section that handles the time checking increment. I had trouble wrapping my brain around that so I looked at how some others did it and then it suddenly made sense.

IMG 4838

I tested it all out and wrapped it up for Christmas.

The Bluetooth interface let me write a Mac application that can customize how the clock works. The clock is DST aware (has to be in our area), sets the colour of the daytime LED brightness, the nighttime LED brightness, the trigger point for the LDR to signal a DIM condition. For the dimming, I only check the LDR once a minute to cut down on the “flashing” brightness changes when the light is dimming or the sun is coming up. Works well.

The sketch I wrote (uses AdaFruit Neopixels) can be downloaded from this LINK.

The Mac application requires that you first pair the HC-05 with the Mac, and then run the Word Clock software you can download from this LINK.

You’ll see two sections. One to get the Bluetooth going, the second is for the basic brightness settings, the other is for the LED colours.

Word ClockScreenSnapz001

You’ll get the current sensor reading on the bottom, and you can set all the brightness attributes you want. In real time.

Apart from that you can see the time and either a list of predefined colours or, define you own custom one. These are saved so even if your clock loses power, it remembers what it was doing.

Word ClockScreenSnapz002

So how’d Laura and Keira like the Word Clock? Apparently quite a bit and but when she first started to open the package and looked at it, I managed to snap a photo:

IMG 5086

You can almost see the thought that would mirror the look on her face. It’d be, “What in the world has dad done now…”

But as she well knows, you just never know…

24
Dec

iSniffer – 433Mhz Arduino Sniffer

While the Arduino is truly a great tinkertoy, it also allows you to build some pretty handy test gear.

I work a fair bit with those 433Mhz RF remotes. Everything from remote AC control outlets to a simple RF communication between two Arduino’s.

433mhz transmitter and receiver kit arduino project 8cfa54de 800x800

These aren’t “transceivers”, the module on the left with “ant” spelled backwards is the transmitter, the one on the right is the receiver. The best library to use with these is the RCSwitch library. Using the library has saved me countless hours of time so…use it, it’s worth it!

As it happened I had installed an RF wireless setup in my brothers truck with some LED’s hidden under the running boards. Turn them on as you approach the truck and they light up the ground around the truck. They look very nice. But we had some issues with the RF mounted in the engine compartment that still haven’t been resolved at this point (on the todo list), but I wanted to check out the remotes.

MINU BI00055 2

And since I end up briefly wiring up an RF sniffer more than a couple of times, time to build something a little more permanent. My starting list of what I wanted it to do was, as usual, more elaborate than what I was going to end up with. Again, as usual. The usual, “start big”, downsize to make it work syndrome.

First order of business, find a project case I can fit it all in. Which is actually harder than it sounds. Why? Well I wanted some smaller. So I got one of these:

IMG 5014

It splits into three pieces and I have a few of them. I figured I could put in a small display, Arduino MINI, the RX and TX, some switches, and maybe, a battery (9V). Well, I had to add some case spacers eventually but it all worked.

For the display I had just gotten some OLED .96″ displays. These are FLAT and SMALL but very easy to read. The single drawback to them is they only run off 3.3V. My Arduino’s all run off 5V. But I had some 3.3V power boards that are quite small so I used one for the power.

Usually before I start drilling holes in cases, I breadboard the whole idea and write the sketch to make sure the thing is going to work. Every wonder what that looks like? Wonder no longer. Here it is in the complete ugly that it can be.

IMG 5015

Notice that’s an UNO, not a MINI Pro? Yeah, both 328P chips so if it works on one, it’ll work on the other. Interestingly, the compiled code on the UNO is 23K, whereas on the Pro MINI, it’s 18K. I think it might be because the MINI Pro has no UART/USB interface on it. Maybe. Could be. Sorta.

You can see the TX on the breadboard, the OLED barely standing up, the RX on the bottom right. Yep. Proof of concept.

I also wanted to incorporate IR decoding as well. That wasn’t to be. It drove the RF unit nuts. I’m guessing the interrupt pins. So it got removed. Another project…:-)

For a custom faceplate, off to Google Images, find some picture, laser print it, laminate it, cut it out.

IMG 5017

Then put double sided tape on the front of the project box.

IMG 5019

Then stick it to the front of the project box:

IMG 5020

Inside the box, the layout of parts, cramped sort of because there’s no PCB board to hold all those bits and pieces… at some point when all the wires in there it looks like what’s left following two drugged crazed spiders mating ritual. But you make it fit.

IMG 5022

As noted, I did have to add two 1/4″ spacers in the box. While all the Arduino parts fit, it’s the battery (a single 9V) that uses all the room. Durn. Batteries. A pair of AA’s or even a couple AAA’s on an Arduino running at 3.3V wouldn’t help much. Batteries simply take room.

IMG 5026

There’s the finished project. Kind of looks like an alien with the two antenna out the top… Controls are equally simple. A power switch and a rotary encoder. If you look closely you can see a good example of one of those two colour OLED’s. Yellow on the top, blue below. And no, you can’t specify the colour, it’s the way they are built.

So in operation, the iSniffer sits there waiting to detect some RF. When it does it decodes it, tells me the decoded number, bits, and protocol. It also saves up to the 10 last codes it received so you can use the rotary knob to select one, then click it and it will transmit that code. Really handy for testing since you now have TWO remotes to work with.

One of my concerns when running on battery is “how much power”, as in how long will the battery last before it drops dead. So I always measure the current drain. With just the heading on the OLED, the draw is 26ma. When I get the RF information the draw is 33ma. Why does it change? Simple. OLED is an LED display that lights up some LED’s and the more you have on, the more current is required. Which in the great scheme of things isn’t much, but still, be aware of it.

So what happens when I key the transmitter? I had prepared myself for a huge power drain. I have some other RF units and some Wifi ones that pull upwards of 200-300ma when transmitting. A 9V battery would last, oh, in full transmit on those heavy draws, probably if it didn’t over heat, perhaps an hour. Tops. Maybe.

For iSniffer, what happened caught off guard. The current draw went from 33ma to 39ma. Typical 9V battery likes draws of about 15ma and has a capacity of 500ma. So you get a few continuous hours out of it. At my 30ma, if I get 9 or 10 hours out of a battery I’d be pretty estate. I’m only using it for minutes at a time so…this is all good news.

20
Dec

Lite_Mate – LUX Meter

Something that I have needed for a while is a decent LUX meter. I have one of those off shore jobs that’s supposed to measure something, not exactly sure what that would be but I’m going to hazard a guess it’s not LUX.

I ordered two AdaFruit sensors. The first is a TSL2561 and it senses light in both the IR and visible spectrum therefore it responds more accurately to the light us bipeds are accustomed to. Plus the reading given is calculated LUX. Perfect!

I’m not sure why, but I ordered two of these sensors and it’s a good thing because one was defective and Adafruit stepped right up and replaced it. I know, Adafruit’s products are not exactly as cheap as some of the stuff off eBay, but I’ve been making more of a point to purchase from them when it’s not a large difference. I like the fact they stand behind their products.

The second sensor is a UVA/B sensor. It’s a simple analog sensor where you simply read the voltage out to find the “UV INDEX”, or at least that’s what I thought. I was close, but no cigar.

Turns out you need to do some math to get the UV index that we’re used to in the media. And the formula is simple enough:

 sensorValue = analogRead(0);//connect UV sensors to Analog 0  
 UVindex = (sensorValue*5.0)/102.4;// needs to be scaled to the supply voltage (5.0)

Simply put the sensorValue * (working Vcc of the Arduino) / 102.4 and it works just fine. Took quite some time to figure this out too, would be been a lot easier if Adafruit had mentioned it or written up a sketch for us mere mortals.

For the remainder of the project I used an Arduino Pro MINI, the 0802 LCD that I wrote about in a previous blog entry, an I2C interface for the LCD, pushbuttons and a power switch. I run the whole thing off a 9V battery and it draws 20ma. I wired one of the pushbuttons onto the LED pins on the I2C board attached to the 0802 display. Normally on these backpacks there’s a jumper so the LED has power and you control the backlight with software.

IMG 4997

I decided that I’d enable the backlight right off in my sketch but use the pushbutton to actually deliver the power. Works nicely this way and only increases the current drain by about 12ma. The green jumper in the photo is where the N/O pushbutton is connected.

When building projects, I like to do finished projects. At one time I was just mounting the Arduino’s on breadboards and jumper wires galore. But that gets messy and it doesn’t feel right. I try to finish off my projects with a box and nice face plate.

Therein lies one of the issues with projects. Namely that faceplate. I’ve tried water slide decals, REPRO film (laser print colour on it and it has adhesive on the back), which means I have to spray paint the faceplates with some background colour then decal them up. Then clear coat them to protect the decal.

My experience with water slide decals is I don’t like them. The self adhesive transparency does work, pricey, but it’s prone to bubbles and you kind of get one chance to align it. Unless you have a white background colour, getting any printing to show up is tough…

What I’ve ended up doing was printing via my colour laser (I’m not an ink fan either) on 24lb Xerox super bright (98) stock, cutting out what I want, then using 1/4″ thin double sided tape to stick the paper on the project face. Looks fairly decent.

But…and this is a big but, it’s still just printed paper and can tear, cut or whatever and then it’s ruined. Obviously something better had to be done.

Tonight that got me thinking and for a lark, I thought I’d print the same way I’d be doing but this time I use my document laminator to cover the paper in a plastic jacket. Then I’d cut out what I needed and see how it looks.

Well, this is what I’m going to do from now on. It’s easy to see in the photos of the cutouts I made so I didn’t have to disassemble the face plate to put the printing on. I just cut around the controls and none too neatly at that since this is more of a proof of concept.

The photo doesn’t do it justice but the picture looks great, the plastic gives it a glossy finish, easy to label, and with the plastic laminate on it, protected from tears and so on. I used the same thin double sided tape to affix the “decal” to the face plate.

Now that I know this works and looks very presentable, I’ll be designing and building face plates like this for the future.

IMG 5009

16
Dec

LCD 8 x 2 – Arduino

When working on Arduino projects I tend to like to use some sort of display to indicate the state of things, as opposed, say, to a bunch of LED’s that might perform the same job.

Thus, LCD’s are great at presenting information in a way that is easy to absorb. The standard Arduino LCD’s are the 1602, 1604, 2002, 2004. Where the first two digits are the characters on a line of the display and the last two are the number of lines on the display. Generally there is a backlight on these displays and depending on the size of the display, those LED’s they use for backlighting can take some sizeable milliamps.

Alternately, sometimes even a 16 x 2 LCD is too large or not required for a project. While surfing eBay a couple weeks back I came across some 8 x 2 LCD displays. That’s 8 characters by 2 lines. Not a lot of course, but adequate for a little light meter project I was working on.

IMG 4985

IMG 4986

You can see from the photo’s these are your typical 16 pin parallel connection LCD’s. So yeah, a whack of wires between them and the Arduino. While I was pondering whether or not to press one of them into service, I received some OLED displays. The .96″ blue ones.

OLED

Took me a little bit to get the OLED working with I2C (address turned out to be 0x3C not 0x3D as the normal libraries use), but once working it’s obvious they are TINY but very legible.

I am building a LUX meter so battery operation is a must. I, incorrectly, assumed that the OLED display would be far more efficient than the plain old 0802 LCD I was contemplating. Notice I said, incorrectly. I connected up each of them to an ammeter and checked them out. Turns out the OLED current demands varies about 30 ma depending on how many LED’s are lit up. Where as the LCD, if you turn off the back light and just use reflected light, actually draws less current. Never would have seen that one coming.

So I had to weigh out some pros and cons of each. The OLED was easy to see in bright light (tended to wash out a bit), printing was extremely SMALL (but clear), the LCD in bright sunlight was easy to read (just turn off the back light) but it was parallel so a billion wires.

If the LCD had a I2C backpack on it, that would have made it more appealing. But wait…I had recently found a bunch of I2C backpacks on eBay that were mislabeled (advertised as keyboard interfaces) and being sold for peanuts.

IMG 4988

What would it be like if I took all the headers off the backpack and put my own headers on plus added all the pins for the extra I2C so I could also connect in the TSL2561 light sensor. Yep. That’s exactly what I did.

IMG 4996

First I did a “trial” run to see if the pin out on the LCM0802C was the same as what a backpack expected. I started at pin 1 on both and just ran jumpers from the backpack to the LCD. Then I noticed that it took 12 wires (middle four on the backpack don’t go anywhere). So the backpack uses 4 bit mode.

IMG 4992

A quick tweak of the contrast control on the backpack, I used an LiquidCrystal_I2C.h library, defined as 8×2 for this display and I was looking at:

IMG 4991

The Arduino UNO, backpack and LCD was drawing 70ma. Not too shabby! If I wasn’t interested in too many hours I could run it with a 9V battery (they typically put out 500ma but like about 10-20ma of drain). I could save another 20ma with the backlight off.

The wiring looks like this now.

IMG 4997

I have a 4″ Dupont cable, took 12 leads and split those into two groups. You use pins 1-6, and 11-16. Wired in a female header on the backpack and a 90 degree 16 pin on the LCD. So the leads stay flatter against the LCD.

View from the flip side:

IMG 4999

There is about 4″ of wire there but if I want, I can fold it up like a stick of gum to shorten it. And lots of pins for connections to other I2C boards.

It all worked out pretty well but if someone wanted to Fritz a real backpack for the little 0802’s it would be really sweet. For now, this isn’t all that elegant, but it works. First important part.

14
Dec

Arduino HC-11 RF 433Mhz

A few months back I’d ordered some RF modules for a project and after working with them a while, I’ve found they work fairly well. So well in fact that I ordered some more.

If you’ve done any Arduino work with RF at all, you probably noticed the trend that a lot of RF modules are sporting UARTs these days. Why? Well for one thing serial is always easier for most to use than I2C or SPI. Plus when you want to program these things you can use what they call “AT” command set.

That’s right, “AT” like from the Hayes modems back in the early 80’s. Did I just imply progress? Good. Didn’t want to get off on the wrong foot here. The main difference is the “new” UARTs use a MCU with a control pin, not the old “+++” escape like the Hayes did.

The RF modules are called HC-11 and you can find them littered all over eBay where they will generally be advertised as “replace bluetooth”.

HC 11 433Mhz

While replacing Bluetooth is a bit of a stretch because these don’t exactly fit in a computer nor are they really anything remotely like Bluetooth (in operation or protocol), they are close range transceivers with good reliability.

The first batch I got had somewhat of a dog’s breakfast for firmware. From 1.7 to 2.2. I tried to do some of the operations in the manual where you could use them as a remote switch and I managed to cook one. Plus the 2.2 version didn’t work with the commands you can find for the 1.9 versions.

A quick email to the seller and he said in future he’d only get 1.9 from his supplier. Any way, according to my last order of them, every one of the 15 I ordered was version 1.9 and rock solid.

For documentation, there’s a dumbed down version that outlines about 5 of the commands for the modules. However some of the companies like SEEED have better docs, use this LINK.

You can program these directly from a USB to Serial adapter, but I thought I’d write a sketch to do it. Might save someone a bit of headache.

First off the connections:

IMG 4983

It uses +5V so that’s helpful, and I use SoftwareSerial on pins 2 & 3. The “control” pin is pin 4. The sketch tells you which HC-11 pins goes to which Arduino pin.

When the sketch starts up, it polls the HC-11 looking for a reply so it can use the baud rate:

HC Programmer Screen

You can see the Mode, Baud, Channel, Address and transmit power. So now some notes of what I’ve found.

  • Mode 1: Normal serial. Good if you have power for it all the time. This is the default.
  • Mode 2: really a low power mode. Like if you used it for a remote transmitter you woke up once a minute. Max baud rate is 4800.
  • Mode 3: Fast SINGLE character transmit mode! Don’t send any more than ONE character!!!!
  • Mode 4: Lower the baud rate, further the transmit distance. 9600 baud max top end.

Channel: says “000” to “255”. More like “000” to “020”. High baud rates and high channels don’t mix well. I suspect it doesn’t scale up the channel spectrum well. Remember to make at least two with the same channel because it will only “talk”, “listen” to another module with the same channel. And yes, you can reprogram the channel in software to send to different channels as need be. There is no “broadcast” across all channels.

Address: you can “ID” each module. No idea where it’s used. Maybe for the “wireless I/O” control.

Power: Transmit power. Eight (8) is full power 10dBm. In the real world, somewhere between 40 and 100 metres. To save you the work, 10dBm is 10mw. More North America walkie talkies from years ago were 100mw. This is no RC aircraft unit…

The chip that’s doing all the RF work is the TI CC1101.

The HC-11’s sport three antenna connections. You have a U.FL connector, you can solder on a U.FL connector and use a duck or you can solder in a typical helical antenna (aka pen spring). What I have not done is range check those to see what difference they might make. I do have some ducks on order though.

For the Arduino UNO sketch, download it from this LINK. I used IDE 1.0.6 to compile.

As I noted before, I tried the “wireless I/O” control and ended up cooking one of the modules. Good thing they aren’t that expensive.

9
Dec

eMail Buddy – CC3000 – Fail

I’ve been reworking my eMail Buddy that I started on last week. I think I’ve tried just about every configuration with every piece of shield/hardware for networking I own.

The last effort was using Adafruit’s CC3000 WIFI shield. Updated with the latest firmware. Unfortunately it’s a big fail too.

While the CC3000 initializes fast enough, obtaining a DHCP address is glacial in comparison. 10 to 50 seconds and that’s even with my router assigning the IP based on the MAC address of the CC3000. I tried different brands of routers, and regardless of what I tried, DHCP is still amazingly slow.

Couple this with the fact that the CC3000 wants to connect at the lowest speed it can, like 802.11b, which went the way of the dins during the last ice age. Plus the CC3000 will simply drop off the network for whatever reason usually with 48 hours. Getting it back on is more easier if you do a warm reboot, because a cold reboot takes a number of times before it reconnects. It stalls at the DHCP portion.

The library from Adafruit I think I read was subclassed from the print library not the stream library. So until that was addressed recently one couldn’t use TextFinder with the stream. This severely limits the usefulness of the CC3000 so I was happy to see they addressed that oversight. However, it’s not all quite right since I was unable to implement FindUntil for progressive searching. Something is still amiss there.

At this point, I feel much like Edison. I know yet another way WIFI things won’t work…LOL

I finally threw in the towel and dropped in the ages old Wiznet 5100 ethernet board and connected to a nearby wireless bridge. Yeah. IP in a heartbeat, DHCP in half a heartbeat, online in seconds and checking email headers like a champ. Reliable as always.

Of course the ethernet library for the Arduino is extremely mature so it’s not really fair to compare it with the CC3000 library. The ethernet library also works flawlessly with Textfinder on the stream.

There’s been a lot of Wifi “solutions” appear in the last few months but I feel that most of them are WIP (work in progress). I suspect some of them will mature to some point, maybe even to be a valid replacement for that old ethernet board.

I should also mention that I’m hardly upset with the fact that the CC3000 from Adafruit is a dismal failure for my needs. Sure it’s not exactly cheap, but support for it is very good, Adafruit does the best with what they are given by the company who makes the CC3000. The best I could hope for it is that it works. But having said that it’s new technology and when you’re on the cutting edge, sometimes you just need a decent supply of bandaids…LOL

In a limited use, I think the CC3000 would be adequate. Say small data packets, a few times a day.

Maybe the next driver/firmware update will help it some, providing the CC3100/3200 doesn’t push it aside.

4
Dec

PowerCurve

I always seem to have a problem with power bars. And AC adapters. Specifically if I buy a 5 outlet powerbar I can fit 3 adapters in it. And waste two outlets.

So at HomeDepot the other day where I’m shopping for yet another power bar, which incidentally are nothing more than multi-outlet extension cords, I see this:

PB

Where I am putting it, I don’t need the USB outlets, so I noticed a SEVEN OUTLET version. For less than the USB one!

Judging from the ads, the USB version is the popular one, so I might just head back to HD to pick up another “non-standard” one…

At any rate, the outlets rotate so you can fit just about any combination of wall warts onto it you can imagine. Put in the plug, turn it to fit (it clicks as you rotate it) and wow.

A well thought out concept. For a change! I give it a 10, a good solid 10!

3
Dec

Wifi, Arduino and SPI, oh MY!

The email checker I built two years ago, much to my surprise, is still ticking along. Running an ethernet shield, UNO and three LED’s. It checks my email account for specific emails and alerts me if one should appear.

Is it perfect? No. Why not? Well it’s not an Arduino problem, it’s because it checks once a minute, but if my main office computer grabs my mail during the minute lapse time, my little checker never sees it. So I’ve missed a few alerts. Not mission critical.

Of course I could leave the email on the server until I delete from my email program, but I choose not to. That’d be too easy…

But ethernet is one of those, okay it works, but it doesn’t like sharing itself with any other SPI devices because it’s not built to do that. I did find that Elecrow’s Wiznet 5200 would share with other devices on the SPI buss, but it’s kind of hit and miss for connecting, for whatever reason.

For the last year or so I’ve had my eye open for an affordable Wifi thingamajig. And hopefully one that’s reliable too.

Naturally this invoked the old trilemma clause:

  1. Fast
  2. Economical
  3. Reliable

Pick any two.

Earlier this year I ordered a CC3000 from Adafruit. I’m using their libraries and hence I try to support them when I can. At the time I ran their test sketch and it worked perfectly.

But I could never get it to do much else and it didn’t work with TextFinder so parsing a TCP stream was a pain.

Recently Adafruit updated the firmware (twice) so I installed 1.1.3 (I understand that update 1.1.4 might be here in a couple weeks). Before the latest firmware update, the shield would work, for a day or two and then fall asleep or something and disappear into the digital abyss. Buffer overrun, mDNS, or some problem. A MEGA has way more SRAM than an UNO does and I suspect they assume most will use an UNO or something with the 2K limit. Simple matter to change the buffer sizes for a MEGA though.

With the 1.1.3 firmware, I could get a good connection, I could connect via TCP in the main loop, check my email, and do that every minute reliably. And Adafruit managed to get the newest version of their library working with TextFinder. Although if I tried to do progressive searches through the single email header with TextFinder it didn’t work properly as with an ethernet sheild.

According to what I read on the Adafruit forum, their library uses the Print class, not the Serial class and therefore Stream and TextFinder were not there from the onset. But it is now so fabulous!

Always on the lookout for good project boxes, I noticed that eBay sellers had some acrylic cases for their 8x8x8 LED cube matrix kits:

Cube Sheel

Certainly big enough to hold a MEGA and any display I could fit in there… While it would have been nice to have a spiffy looking TFT display in there, the more I tried to do it, the more I could see it wasn’t going to be easy, if at all. Not sure which Adafruit CC3000 I have but I assume it’s the one without the isolating buffer. Which of course means I could have built my own I guess but what the heck, I admit it, I took the easy way out. Just used a 2004 LCD.

I used double sided tape (which in hindsight might not have been the brightest thing to do because the stuff sticks really well) and mounted the MEGA and CC3000 shield on the back:

IMG 4954

That thing at the top right is an I2C backpack for the LCD. I’m a huge promoter of those to make easy connections and save Arduino pins!

To make a nice looking front for the case I use some foam board with a hole for the LCD:

IMG 4959

A little more double sided tape but not the uber automotive stuff, a printed front to make it look like something and presto:

IMG 4962

A good looking amateur project…

IMG 4963

For the email “alert”, I didn’t put in a buzzer or anything, instead I used some NeoPixels. WS2812B and the more I use them, the more I like them. Adafruit has a fabulous library for them. So depending on the email, I can have any colour(s) flashing and even with that full printing on the front, the rest of the box lights up extremely well. Hard to miss anyway.

The finished project sits in the family room, along side some of my other projects. Time will tell if it’s as reliable as the older Wiznet 5100 on a UNO that it’s replacing. But I got my fingers crossed!

IMG 4967

Note: the holes in the front of the display case were from the TFT that I so desperately tried to make work)…better to use foam board….lesson learned.