Let's Make Robots!

Picaxe as an I/O expander for Arduino

As I was thinking of new features for my robot, I realised how painfully short I was on pins! The Arduino Mini just doesn't have enough! I'm not thinking of upgrading to a Mega, seeing how pricey it is and also because it's pretty huge. That's when I though of I/O expanders. Unfortunately, most are designed to be shields for anything but the Arduino Mini, so, again, I didn't know what to do. That's when I thought of using a Picaxe for expanding! I'm thinking of using a PWM or an analog pin from the Arduino as an output to a Picaxe input pin. Different ranges of PWM/Voltage the pin issues correspond to different pins on the Picaxe being turned HIGH or LOW. Let's say 1 to 10 PWM means Pin 1 and a 255 PWM signal following in the next milliseconds signals HIGH, while a 0 PWM signal means LOW. Just a basic idea of a communication protocol using 1 pin. 

Also, why Picaxe? I think Picaxe boards are very cheap and small, which gives them an advantage over the bulky and more expensive I/O expanders I've looked at. 

This is just a thought I wanted to share, and I also wanted to get some comments on the feasability of such a thing. If it works, I end up saving LOTS AND LOTS of pins on the Arduino.

Also, I can't recall seeing a method like this used for any robot I've seen. Is it because there's a more convenient way of expanding? Maybe is there something obvious I missed?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thanks a lot guys! I think I really like the 1$ MCP23017 and the Ti launchpad. Will definetely check them out!

If you just need some more digital inputs/outputs why not use an MCP23017 or similar. It costs only 1$ and has 16 input/outputs. It uses I2C and so needs 2 pins of the Arduino. http://www.taydaelectronics.com/mcp23017-16-bit-i-o-expander-with-i2c-interface-ic.html

I have found these two solutions quite handy and cheap:

 

1. Buy a I2C LCD driver module from ebay, I found the cheapest are $3.38. Although they dont say it and the information on the chip  is rubbed off, they work like I2C PCF8574 I/O expander. These modules are tiny enough for me.


2. Ti MSP430 launchpad. $4.3+ free and fast postage (not everywhere). You can program these like an arduino with Arduino Energia IDE, what i do all the times. Its hard to find 16 General purpose I/O and timers, i2c, spi hardware UART and stuff like that any cheaper. You can cut the USB emulation side off if the board is too bulky.

You are talking about the soft serial library and yes, it will add extra serial connections, but there is no reason you could not just use the regular serial pins. There are a ton of advantages serial gives you. More data, faster, is a start. But there are also ways to be sure your data is not corrupted, you can receive data in the background and buffer it for later,  you can even talk both directions. A ton of other stuff (LCD's and the like) also use serial comms --it is wicked good stuff to know.

You could also use regular ol' serial communication to talk to that picaxe as well. Much faster than reading a pulse-in all day, and you could send as much data as you wanted.

I know there's a library to turn two random pins on the Arduino into Tx Rx, but isn't that sort of intensive considering I already have a Serial set up? Also I save one more pin if I go the Picaxe way :) . Anyways, if serial is faster and less ressource-intensive, I'll be glad to do it that way.