Let's Make Robots!

8 ADC inputs Need Slave Chip

****UPDATE****

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.

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.

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!

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.

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.

Are you sure you want to give up on the ADS7830? Did you post anything on the issues you ran into? The chip doesn't look to shabby, and could be quite useful if you could get it going. Aside from that, an MSP430 chip might work out.  :D ...but I digress.....I hesitate to recommend using a proc actually for doing this sort of thing, I'd just get that support chip working....

EDIT: I haven't looked, but you really can't do spi with the new chips? You could always do it bitbang style, they have the source in the manual for it....shiftin/shiftout I think it was...

There are many ADC chips available these days that can communicate by either I2C, serial etc. One advantage is that as well as having many inputs they can come in 12bit, 14bit and even 16bit resolution. To use an MCU to do the job would be a waste of a good MCU and money.

I am all ears, my friend --I can't seem to find any. I have dug into the deepest corners of Digikey and Mouser as well as some pretty major googling. I have found a lot of chips that are close to what i need, but not a single one that fits the bill (with the exception of the 7828, which I am not very fond of). I2c is nearly impossible to find and 8 channels is even harder. I am open to anything you happen to know of though.

There is actually a bit a method to my madness on the idea of adding a brain to this problem:

Any ADC chip I am going to find will probably be in the $2-3 range, with the atmega328/multiplexer set-up running around $4 or $4.50. This one dollar increase actually gets me a lot in terms of function. I can run the transistor (for the IR leds) off the slave brain, thus freeing up a pin on the main brain. All the ambient light calibration routines, read-->LED's on-->read routines, etc. can be handled by the slave chip. I can also set threasholds and thus translate these 8 ADC readings into one nice, clean byte to be sent off to the main brain. I could even run the LED's off of a PWM to deal with different surfaces. --Lotta handy stuff!

I dunno man, that one dollar sure free's up a lot of thinkin' space/time on the main brain and with SMD parts, there will be no increase in board size.