Show Posts
Pages: [1] 2 3 ... 6
1  Using Arduino / General Electronics / Re: (4051) Analog Multiplexer / DeMultiplexer library update on: February 18, 2013, 05:54:18 am
Okay that makes more sense now.

So if you have 2 4051s and you want 16 inputs then there's pretty much only one way to attack this.

You have the 4051s separately and run each of them into a separate analog pin (if you want an analog reading on your button. If it's a push button then you can just attach it to a digital pin for reading as you're only checking on off statement).

Now you'll need to look at your data sheet for your pin out but essentially you end up with Vcc and GND, Vee you attach to ground as well.

Then you have what might be marked as INH or E - This is the input/output selector pin. This is USUALLY attached to ground if you want the 4051 to work as an INPUT. If you push it HIGH then it will work as an output instead.

Beyond that you'll have two sets of pins, one set of three usually marked as A, B and C and then another set marked 0 - 7.

The 0-8 are your inputs or outputs (depending on whether you set INH LOW or HIGH). They are what you connect your buttons to. I'm just going to call these pins inputs from now on for simplicity.

The 3 control pins are used to select which of the 8 inputs you want to switch to and then measure. These work as three binary values which collectively work together to create a 3 bit integer (providing the range 0-7).

Your data sheet will have the details of which pin represents each bit.

The last pin we haven't looked at yet, usually called Z or Out/In, is the one you connect to the arduino that you are going to read.

So once you know what your IC looks like, grounded the pins that need grounding, added +5v to the Vcc and wired up your buttons, and put the Z line to an Arduino input, you just need to set up your A, B, C pins to three digital outs on the Arduino to control the switching.

At this point I'll point you to this example in my library: which uses potentiometers on three inputs to demonstrate connecting and reading the value.

Replace the pots with buttons, and make it 8 instead of 3 and you've pretty much got what you need. The library I built makes this dead simple and means you don't need to worry about the bit manipulation etc.

Really the key is to check your data sheet to orient yourself to the pin out and then use the concepts I've described above.


2  Using Arduino / General Electronics / Re: (4051) Analog Multiplexer / DeMultiplexer library update on: February 18, 2013, 05:14:07 am
HI John.

What are you trying to do? I couldn't really understand from your post.

Are you just using a single 4051 to mux some buttons coming in or are you trying to chain them so you can have like 64 buttons off one analog input.

If you give me some context / explain how you're using it I can probably give you some more firm direction.

3  Using Arduino / General Electronics / (4051) Analog Multiplexer / DeMultiplexer library update on: September 23, 2012, 08:03:56 am
Hi all,

I had some time this weekend to hit off a task that had been sitting on my TODO for a while and @spoocter asked me  nicely as well so I decided to update my 4051 Analog Mux/Demux library.

Besides a stack of clean up after having written a lot more Arduino code over the last 18 months, it's now got the ability to use multiple multiplexers in a daisy chain. Just wire them up, call a constructor with the master and slave pins and then just index away to read or write to the pin (up to 64 now with 9 4051s daisy chained).

There's also some new and updated examples including the multi multiplexer set up.

If anyone is keen to wire up 64 LEDs and write a demo for doing that I do accept pull requests ;P

As always any feedback greatly appreciated and feel free to fork (and pull request!) and log any issues over on GitHub.

4  Using Arduino / LEDs and Multiplexing / Re: Problems with a 4051 multiplexer on: September 23, 2012, 08:02:58 am
This library has now been updated with some better examples and the lib now supports daisy chaining 4051s as well.

5  Development / Other Software Development / Re: "Correct" method for migrating libs to Arduino 1.0 on: December 04, 2011, 10:10:48 pm
Thanks for that.

I was sort of leaning towards the #if arduino < 100 option however the readability suffers a lot when you have code that is making use of the changes (eg .write instead of .print changes etc).

I think as there appears to be no real "correct" method that a combination of the below is probably the way to do it with the git branches + downloads being the way to deal with the most "messy" of cases where there's a lot of changes.


6  Development / Other Software Development / "Correct" method for migrating libs to Arduino 1.0 on: December 02, 2011, 11:45:18 pm
HI all,

Apologies if this has been covered elsewhere but couldn't seem to find something specific about consensus for migrating libraries to 1.0.

I have several libraries that I'm now looking to move to 1.0 given the official release recently. Given that there will probably be a lag on people upgrading (eg currently no binary upgrades in Debian or Ubuntu for auto-upgrading) I want to ensure I have a version that will work in Auduino 0023 (and similar) for at least a period of time.

My current thinking is to simply take my current code, move working versions across to a pre-1.0 folder or preface the files with that and then the default code will work in 1.0


Old lib was:


This would change to:


This code can then be retired at a later stage in a few months etc.

Other options include branches in git but it's probably not wise to assume familiarity with git to understand what's going on.

Has there been much consensus on the right way to approach this for best compatibility and maintainability whilst the population upgrades.


7  Using Arduino / Installation & Troubleshooting / Re: might have crashed my arduino during setup() on: August 03, 2011, 06:05:45 am
JohnWasser - don't ever let anyone tell you different. You Sir, are a genius.

Pure gold - worked first time... I now have good old blinky back. So I can try and nuke it again later.

Thanks again.

8  Using Arduino / Installation & Troubleshooting / might have crashed my arduino during setup() on: August 02, 2011, 08:49:31 am
Hi all,

Am after some advice on how to resolve this one.

So I've been building a library that has been working totally fine so far but after a rogue bit of code got uploaded (me being an idiot and not being careful with pointers to memory I shouldn't have touched) I am worried that I'm now crashing the arduino during the call to setup(). This crashes, restarts and then crashes again etc.

The result of this is it's happening so fast I can't upload anything to my arduino.

First off has anyone ever experienced this before?

Second has anyone got any clever ideas on how to fix it?

For reference I'm using a Freetronics 2010 and regarding background:

- I have nothing plugged in except the serial cable. The code I'm writing is heavily serial based and I am just blinking LED on D13 to satisfy myself it's working (as well as pushing and pulling all the serial data back and forth).
- Up until my dodgy single line of code everything had been working perfectly normally right up until that moment, dozens of uploads tonight and many more before then.

So if anyone can help I'd be rather grateful...

9  Using Arduino / Programming Questions / Re: Make Serial.Print() and Client.Print() interchangeable on: July 22, 2011, 06:46:22 pm
@PaulS thanks for that - I was trying to figure out what the common parent object was. That should do nicely.

@David - thanks for that, yep that's pretty much what I was doing which works nicely but adds some weight to the whole thing.
10  Using Arduino / Programming Questions / Make Serial.Print() and Client.Print() interchangeable on: July 22, 2011, 05:52:43 am
Hi all,

To give some context as to what I'm doing (if anyone's interested I'll publish all the code), I am writing a command line server for Arduino. This basically works as <instruction> <params> type thing and designed to establish a generic method for passing info in and out of a running arduino primarily via telnet but should work under serial too for debgugging.

I have this largely working for either Serial and over the network however what I would LOVE to do in order to either thin down my code or not have to maintain two libraries is to make Serial.print / println and Client.print / println totally interchangeable.

What I'd like to do is when I start up my CommandServer object it should take in a parameter which determines whether to use Serial.print() or Client.Print() (and ideally a reference to either one) and then in all of my functions I use this reference.

Serial and Client print functions are identical in function so for what I'm doing they are totally interchangeable so I'd like to be able to just use the defined one in all the functions which will then make that a lot more maintainable.

If anyone can give me any pointers or something in this respect I'd be greatly appreciated.


11  Using Arduino / Project Guidance / Re: Pro Mini + Ethernet on: July 10, 2011, 02:56:15 am
I actually need to check that because I'm not sure how the voltage is set coming from the PoE switch but I know it can vary based on the device. Irrespective; for the first version I'm going to use a PoE injector which outputs a nice even 9v so presumably a simple voltage regulator should be sufficient to drop that down to 3.3v - I haven't used the pro mini before so not really had to play with regulated 3.3v with an Arduino.

12  Using Arduino / Project Guidance / Re: Pro Mini + Ethernet on: July 09, 2011, 08:20:40 am
Power over Ethernet - makes use of the spare lines in cat 5 to give you up to I think 48V of power. Pretty cool stuff actually - we have all our phones at work powered and networked with only a single cable and I've really taken to it as a result of playing with the Freetronics EtherTens (An Uno + Ethernet shield + PoE onboard so no need for batteries or wall plugs!) as often I'm happy to go with a network cable as WiFi is still a bit expensive and patchy with Arduino for quick projects.

If you could do that with a pro mini I'd have all sorts of very tiny network pluggable devices (network points I have plenty of, it's power I'm short on).

13  Using Arduino / Project Guidance / Re: need guide on Arduino LCD&amp;KeyPad Shield (SKU: DFR0009) on: July 09, 2011, 07:53:33 am
What LCD & KeyPad shield are you using (as I think there are a few different variations on that theme).

Conceptually this is what you want to do though:

1. Wire up the LCD and get that working. In the LCD library in the examples in the Arduino IDE there's a good test example. Also see Adafruit example on how to rig one up and test it ( )

2. Once you have that set up and working then look at your keypad.

If you're using the one that seems like there are lots of clones of ( then basically the buttons work by using a single input line on an analog pin. When you press one of the buttons, it varies the amount of resistance on the line, thus your input voltage and you then get your 6 different button "presses".

Pages 9 - 12 in the dfrobot shield manual has a good example of how to display and interact simply with the detection of the button presses:

That should get you started.

14  Using Arduino / Project Guidance / Re: Pro Mini + Ethernet on: July 09, 2011, 06:40:12 am
Yep well standard ethernet only uses I think 4 or 6 of the 8 wires in cat 5 - I guess I could supply the power from a PoE switch or injector then splice the cat 5, taking whatever is needed network wise through the wiznet for Ethernet connection then use the powerline pair to juice the arduino... that might work. Would be relatively easy to test as I have a PoE injector and I could splice some cat5 easy enough to see if I can continue to get a decent network connection without the power pairs easily enough.

Definitely got something to try now...

15  Using Arduino / Project Guidance / Re: Pro Mini + Ethernet on: July 09, 2011, 04:04:18 am
Thanks CrossRoads, that's looking quite interesting and uses the same module as all the ethernet shields are built from so libraries will be a doddle once it's connected. Consistent 3.3V as well means this should work quite nicely.

Now if I could get a PoE one that does the same thing I'd be laughing as there'd be no need for separate power supply or batteries....

Pages: [1] 2 3 ... 6