Let's Make Robots!

8 ADC inputs Need Slave Chip


It looks like I am going the brain/ multiplexer route here and will make the ultimate line-follow sensor of death. Led's will be off of PWM for brightness control, white/black threasholds will be adjustable and now I have decided that adjustable pull-up resistors would be handy too. I figure that a simple trimmer pot connected to the common of my resistor array would do the trick, but I would not mind some feedback on the issue. I have added a second video with an explaination. Thanks in advance.


**Original Post***

I have been plugging away at my line follow sensor and my related I/O expander issue and have hit a bit of an impasse. My original idea of using a digital I/O expander to keep an eye on all 8 sensors has fallen-through and in hindsight, was probably not the way to go in the first place. As it stands now, I have a simple problem of reading 8 IR sensors via ADC without using 8 pins on the main microcontroller. I simply need a support chip to sit on the line follow board itself and communicate with the main brain. Here are my requirements:

  • Must speak UART serial or preferably I2c
  • Must have a minimum of 6 ADC's preferably 8 --I really want 8
  • Must be smaller than a 28-pin dip (a full-size arduino will not fit --I can use a SMD atmega 328 though)

The main options in my mind are an Arduino 328 or a Picaxe 18m2 (or something else). The arduino, even in SMD form, is a little cheaper than the picaxe but only allows for 6 ADC inputs. There are 8 ADC pins on the SMD version, but I have yet to figure out if I can get a hold of them. Whether I can or I can't, I am still going to loose 2 of them if I want to use the I2C lines (my preference).

The next choice is the Picaxe 18m2 which has a ton of ADC's (more than I need) and is only about $.50 more than the Arduino. This so far, seems to be the option I want to use, but alas, the picaxe has no provisions to become a I2C slave. It can actually, but unfortunately  only to access it's memory functions (when in I2c slave mode, the picaxe becomes a fancy EEPROM really). This puts me back to using UART serial again which I would prefer not to do.

One more: I cannot use any of the MCP320x chips (which would solve all my problems) as they are SPI and the new Picaxe chips don't speak SPI. Arrggg.

At this point, I open the floor...

Comment viewing options

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

Tackling the problem from another angle...why use 8 sensors?   wouldnt 5 be more than enough?   I realize you already have the board made, but sometimes we have to go back to the drawing board.    especially if you have another smaller ADC / I2C chip that would be easy to comm with, that can handle 5 or 6 channels.   you could even dry-run the idea by using 5 of your 8 sensors.    however, if all the ADC chips are a bear to comm with, then I agree with the MCU approach.

I agree that 6 sensors are probably enough.

Doing a parametric search of Microchip, got me about 87 possible PICs w/ 8+ ADC and I2C. They ranged from $.71 to $5.87 direct from MIcrochip. The 18F24J50 that I looked at could be found at Newark for $2.79 in singles with 10 10bit ADCs. I was specifically looking for chips that would work with a newer release of JAL, because I am yet to be proficient in C which also can be used for free with the PIC chips.

I saw the same, Bird. Actually, I was quite amazed at how many different flavors of pics are out there --I had no idea. I was/am VERY temped to go this route but I wimper to myself a bit when I think about learning yet another language (even if it is just enough to make one of these guys a slave). To be more honest with you, after seeing all those options for features and packages, I thought for a moment of actually learning PICs well enough to use them in projects. Then I looked at my current to-do list and thought again. I will look into it but I think the Pic option may be a bit over my head at this point.

Oddbot --Yup, SPI SPI SPI --and it's killin' me! The Gareth chips are quite familiar in Prop world. MCP320x chips are awesome... and SPI. The issue here is that this one line follow board has to fit 3 identical platforms --one Prop, one Picaxe and one Arduino and might be also sold as a stand-alone unit to be added to other robots. I2c is simply the most universal to all three. I have no idea why Picaxe decided to eliminate this feature on the new M2's. On that note, I dislike the fact that they removed the reset pin as well! --Silly. It really sucks that this one brain is gumming up the whole works here but alas, its a deal breaker. You are really spot-on with your thoughts on overdoing it with a whole brain for this one simple task but man, I really seem to be running out of options and like I said above, if I have to do it, I can get a lot of bang for my buck when I do.

Voodoo --I am not totally apposed to the 7830. It really is an amazing chip. Tiny, 8 high-res channels and I2c but you have to use a different address for the read of each channel, the data comes in as mulitple bytes that have to be put back together etc. etc. I personally like the chip really, but with the Picaxe version of the robot being a super-simple beginner model, I fear that I am going to scare the crap out of newbies with all the binary. Maybe with some very clear, commented example code and a tutorial video I could pull it off, but as I think back to my blinking-led days and then look at the code used to talk to this chip, I would have been very intimidated. I will look again into doing the spi manually with the picaxe but as far as I can find, it is just not an option.

Paul --I thought of that as well, and re-doing the board isn't really a problem. You are actually spot-on with the "why 8" question. It is/was set up this way due to my initial arrangement when I was using the digital I/O expander. Everything was just sorta set-up for 8. 8 inputs on the I/O chip, and a nice clean 8-bit byte came out. 8 bits, 8 sensors and all was simple. Oddly enough, during testing, I discovered that it almost worked better with an odd number of sensors when working with an electrical-tape-width line. The one center sensor was always on the line, with the 2 flanking sensors being the "small adjustment" guys and the outer sensors being the "hard turn" sensors. I actually based my design and spacing on a sensor from Pololu (or was it solarbotics?) figuring the "professionals" must have gotten it right. I may actually reduce the total number on the final product, but really, it will be due to the fact that even in bulk, the QRD1114's are more than $.50 a pop. I appreciate your thoughts my friend.


Alright boys,

Again, I can't tell you (as always) how much I appreciate your help and brainstorming on this one. Back to the ol' drawing board for me.

Chris, I see that you're opening a busines here, very good! I don't have the time to do it, although I wanted to add sensor boards to my products, so I'm glad someone else is doing it. Coupled with the LMR marketplace it will be a blast.

I don't have ideas on a chip that will suit your needs, but I just wanted to share my thoughts on this project:

- use I2C. do not give up on this protocol, is the best way to go

- use an odd number of sensors, just like you found in your experiments

- use digital reflective sensors instead of analog - this will let you use a chip like http://www.i2cchip.com/pcf8574.html

Good luck on your project!

The arduino, even in SMD form, is a little cheaper than the picaxe but only allows for 6 ADC inputs

The SMD packages of the ATmega328P are equipped with 8-channel ADCs while the DIP package is 6-channel.  The hardware is there but I'm not sure if the Arduino library supports it.

I re-read your post. I came into a similar situation recently with my own line follower. I started out using ADC for the output of 3 LDRs. The 256 shades of gray (literally) that I got were overkill for something as basic as high contrast line following. All you really need is a 1 bit digital response from each sensor. "Is there white (1) or black (0) beneath me?", the sensor should ask itself. I was about to redo my line following board to add some comparators in the circuit that would enable me to send the output of the LDRs straight to digital pins, thus freeing up the ADC ones. Then Ignoblegnome suggested that I keep the board as is and incorporate the comparating function into the code. And I did. As an example: if the value coming from a LDR is <185, I read it as zero. If it is =>186, I read it as one. I have kept that solution and it is working. I am not about to consider it done. There are other problems that I need to address. But I am happy with the processing of the sensors´ output.

Besides, if you have 8 sensors it´ll work even better. If I can get away with it, with only 3, you most certainly can.


I would have to agree and would go with something like this.

Digital input from a QRD1114 is simple and still effective, I have opted not to use ADCs in the past with good results... http://letsmakerobots.com/node/22452