Cheap prototype perfboards came in

These 50×70 cm protoboards seem to fit perfectly in the $0.24 case. My idea is to mount them to the cover, but they can almost fit anyhow you want them.

Let’s say you have 2 boards for a particular project.  Total cost of box + boards will be $1.50, add a MCU (ATMEGA328) and it’s ~$5.50.  Lets add regulation and bring it to a total of $7 (estimate),  That gets you 2 boards + processor + voltage regulation + well built case to hold it all.  You can make 4 of these for the price of 1 Arduino Uno.  While it may not be as pretty, it is very cheap and let’s you explore new and strange ideas, because all you’d be risking is $7, not a $30 board + $15 breakout board.

First board I’ll make will be a XBee adapter, to bring XBee to any breadboard in need.  I’ll also put a ISP programming pins on there, since my current ISP programming setup is kinda strange.


Moving main code to Arduino…

I’ve been thinking about this for about a week or two.  My typical dev cycle for something complicated, like writing to a SD card, is to try to find a working library out there.  I have found many good working libraries out there for various things, but after spending a few hours this morning trying to get my previously working SD code, working again (changed hardware), I decided to see if I could get it working using Arduino Environment code.  I got it working with the SDFat library, and by looking closely at Ladyada’s logger shield Schematic.

I then tried to port my software servo library, the one I was boasting about a few days ago.  Well I tried out the Servo lib in Arduino, and it works too.  You can specify the pin, and the uS that you want to be there. Pretty awesome.  So today I have a Fat32 reader/writer, and a servo library that let’s me make any pin into a PWM output easily.

If I’m going to be in the Arduino environment, I might think about how to connect different modules.  You could go with the Arduino Shield system, although it can get pretty pricy.  I’m leaning more towards the JeeNode way of organizing pins (There is a RBBB board from in the second picture, pretty small).

I’m going to be making an XBee shield (since I have many XBee’s) and will be putting the reset circuitry that I use on it (since I have space).

I think with Arduino, the code I write will be much more portable, and the code I find online will be much more usable.  Progress!

Minimal 6 servo software PWM with ATMega328

I’ve been doing some testing to find out how big each of my features are,  so I took many of them out.  I reduced it to the Uart library, Timer functions, and software PWM, and the size comes in at 3767 total, including 44 bytes of characters for the uart.  The software PWM library itself is 1060 bytes, which includes initialization of Timer1, creating the ISR, and managing up to 6 servos, which can be on different ports. With 16 bit resolution.  I put it here, since I didn’t want to create a new project for this.

The next thing I’ll be looking into is how to reduce the power requirements of the ATmega328/ATmega168 and XBee.

Using 3.3V PWM to control a servo

This didn’t exactly work, but it was fun to play with this BJT 2N3904.  Ideally one should have 2 BJT’s back to back to switch a load with the same polarity that you trigger it with.

For the first picture, I noticed that the peak to peak voltage was pretty low (about 1V), so I decreased the resistor connected to the collector.  Which is the second figure.

The third figure showed a pretty high, but noisy, PWM.  But once I connected the load (a servo), it went down to about 2.5 peak to peak (with noise gone), which is the forth picture.  Last two pictures show my setup, with my 100 MHz oscilloscope (an unlocked DS1052E hehe).

I do have some optoisolators that I may use for this, although I will try to find the “proper” solution to the 3.3V-> 5V control logic.

… $5 LCD is a graphic LCD

Looks like that LCD is a graphic LCD, kind of a bummer.  It may have more features, but it won’t have the simplicity of a character LCD.  I might hunt for a library to test it, but I’m kind of tired of doing LCD things (been doing it for the past 3 days :P)

I did get the order of Atmega48pv’s today, so I think I’ll wire one up and program it.  With only 4K of space, it can’t store too much.  Perhaps an LCD library? Maybe some simple i2c interfacing?  Considering that these are almost half the price of an Atmega168, I’m sure I’ll find many useful places to put them.  I’ll just have to include an ISP programmer connector on these boards.

Display… that was just $5

This is a display that I picked up at a local electronics shop for $5, sold AS-IS.  I intend to use this as the display for Remote 2.0.

Here’s a feature list of remote 2.0:
2 analog joysticks
Energy Efficient
Xbee and RFM12B wireless
SD card for logging / transfering logs from remote sensors when close
Maybe 3.3V operation

I should be getting this LCD wired up to my test board to verify that it works.  I will also start planning the boards that I’ll make for my ultimate enclosures.
Boards include:
Processor + XBee board/RFM12B
Servo control connections with voltage regulators

That’s all I need right now with regard to boards.  Build for what you need, not for doomsday, as they say 😛  I’m sure I’ll expand that list.

LCD working on a ATMEGA168!

… But don’t I already have an LCD controller, you ask?  Why yes I do.  That was using an MC9S12C32 processor, a totally different kind of chip than an Atmel.

While I may be able to write my own, there are plenty of libraries out there that mostly work.  I picked this one since it’s the first one that worked for me.  Well, the Arduino environment worked right off the bat, but I’m not interested in running arduino yet. The have a nice tutorial that teaches you how to bit-bang the LCD.  I might redo this when I get the 75HC595’s in the mail later this week.

Ultimate goal of getting the LCD working on the Atmel platform: Remote 2.0!  My idea is to make a remote that can display the statistics of my car, when I am close enough to it.  Statistics like engine temp (in multiple regions), engine coolant level (I have a leak), and other things.  Hopefully I can capture the OBDI and integrate it with my logging, and displaying 😛   Imagine driving down the freeway with a little wireless display that shows all of those statistics…

Ideas and ISP programmer problems

A few nights ago I was having trouble connecting my Pocket AVR programmer to a fresh ATMEGA328p that I was going to burn.  I realized that my Bus Pirate can also double as a programmer, so I updated the firmware, and told avrdude:

avrdude -p m328p -c buspirate -U flash:w:Wireless_Bootloader_ATmega328.hex -U lfuse:w:0xE2:m -U hfuse:w:0xDA:m -U efuse:w:0x05:m

and it burned!  I eventually got it working by getting the fuse settings correct, so all is well.

While shopping for parts from digikey, I found that the ATMEGA48PV-10PU-ND was listed as Non Stock, and its price was $1.91 for each.  For comparison, ATMEGA168’s go for $3.33.  So I had to pick up 25 of them, since they can be used as great interface chips.  Once I get them, I’m going to use one as an interface chip for a LCD.  Will have to be careful about space, since there is only 4k of flash with no bootloader (no remote boot 😦 )

Currently I’m wanting to put microcontrollers everywhere I can, for as cheap as I can.  Looking at this Instructable: Inspired me to delve into the arduino-less area of microprocessor design.  Designing everything yourself, for as cheap as you can.  Instead of spending $30 on an Arduino, you can spend $7 or less on just the processor and wire it up for your application.

Early last year I took my arduino from my Traxxas Slash RC car to use on something else.  Now I want to put it back, but I have to gather everything again.  I’m going to make a perfboard atmega328 circuit to control it with xbee + have remote wireless updates with LScreamer.

That is what is happening at Mecharobotics 🙂

Case of the future

They often say that you should pick a case before you design PCB’s, so that you know where it will fit, and how. I believe I have found a very cheap, DIY case, that you can go and pick up from your hardware store.

Insert, the 1 Gang Electrical Box. Typically used for housing electrical connection in your walls, these cases are about 0.24 a piece. Lids for them run an additional $0.60, bringing the total cost of this case for your microprocessor to under a dollar. I picked up the case and lid from both Home Depot and Lowes. Home Depot has a blue 1 gang box that has a little more flat space at the bottom. Both cases have punch outs where you can have your wires come out, perfect for a robotics project 🙂

I’ve been a big proponent of getting PCB’s designed, particularly with Kicad. But doing hobbyist electronics shouldn’t be about making the prettyist PCB wiring with the optimal spacing and clearances. It should be about getting your prototyping board with wires out, wiring it up so your project works. Once it works, you can expect it to continue working.

Documentation is important (especially if you want to come back to it), but your main goal is to accomplish your project without going broke.

You may make mistakes, so if you make them, try to make them as cheaply as possible. That is where my interest is headed right now. I’ll try to post more often now, maybe even daily, just to keep me focused on what I’m working on, and to share my ideas 😛

One last comment: RadioShack Prototype board Fits in this case as well as DipMicro’s 70mm x 50mm If you get the grey 1 gang box from Lowes, RadioShack’s protoboard won’t sit flat on the bottom unless you take out a tab. Or you could do as I will do, and mount it to the top 😛