0
\$\begingroup\$

I'd like to design a board for Lego Mindstorms NXT/EV3 that has many I/O ports.

The board, like the original "smart" bricks, would have 2 kind of ports:

  • sensor ports (two modes: analog, and I2C)
  • motor ports

However, unlike the original "smart" bricks, which are quite limited, it would have at least 8 motor ports and 8 sensor ports.

I'm asking help to find a suitable board, or a suitable design for this large number of sensors/motors.

Each sensor port requires an ADC (for sensors operating in analog mode, like temperature and touch sensors), and requires two digital I/O ports for the I2C protocol (SCL, SDA).

So, the sensor ports put a requirement of at least 16 I/O ports, and 8 ADCs.

Each motor port requires two PWM lines thru a motor driver like L293D, and two digital inputs for reading the quadrature encoder output, with programmable interrupts.

So, for at least 8 motors, there is a need for another 16 PWM ports, and 16 I/O ports with programmable interrupts.

In total: 48 I/O ports (16 output ports with PWM, 32 input/output ports with programmable interrupts), 8 ADCs.

Now this requirement is a bit beyond the specs of popular amateur boards like Arduino, Galileo, etc...

How would you recommend to design this solution? Are there boards with this number of ports at a reasonable cost?

Would be more cost effective to attach further ICs to one of such boards? In detail:

  • a PWM driver like the TLC5940 would satisfy the PWM requirements (and it is daisy-chainable, in case one would like to double the number of motors)
  • external ADC, or perhaps simple analog multiplexer ICs can satisfy the requirement of ADC ports

However, the number of IO ports with interrupts is quite high... I'm not sure if each port needs dedicated ports with programmable interrupts. Maybe there exist a solution to shrink this number of ports to a minimum, by using some kind of multiplexer or other trick..?

Could you comment on this project? Which board would you choose? How would you design it? Which ICs would you add?

I said 8 motor ports and 8 sensor ports, but the more the merrier :)

\$\endgroup\$
  • \$\begingroup\$ The sensor ports is the hard part; I don't know of too many MCUs that have 8 I2C buses. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 7 '14 at 19:35
  • \$\begingroup\$ @IgnacioVazquez-Abrams he only needs 2 I2C buses \$\endgroup\$ – KyranF Oct 7 '14 at 21:57
  • \$\begingroup\$ @KyranF: shrug I know nothing of the NXT sensors, so I was just covering my bases. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 7 '14 at 22:08
  • \$\begingroup\$ @IgnacioVazquez-Abrams ah, actually I might be wrong there, I misread the question with reference to the part about I2C buses. Indeed [some] of the NXT sensors use I2C and you have no way to change the address in hardware (or software) so annoyingly you need one bus per sensor. If the OP wants 8 totally interchangable sensor ports (ADC or I2C option) then they will have to do some magic \$\endgroup\$ – KyranF Oct 7 '14 at 22:12
  • \$\begingroup\$ Some idea's here: sparkfun.com/products/12732 \$\endgroup\$ – RJR Oct 7 '14 at 23:21
2
\$\begingroup\$

As an Atmel FanBoy, I can give you some biased feedback.

First of all, I'll refer you to @Ignacio-Vazquez-Abrams 's comment: Getting 8 simple to use separate I2C busses is going to be the most challenging. You are probably going to end up having to find a way to multiplex one bus, if that becomes a problem, I advice a trip around google and if that doesn't help a separate question, because all of it is a bit much to cover for me right in this one answer.

Then, many of the Atmel MCU's (of which quite a few different ones are used in fact by Arduino) have enough pins and ADC channels to do what you want. If you want to start development with Arduino tools, you can probably find quite a few Arduino posts and/or instructables about getting your own board design working with the Arduino tooling. I'm not sure if you are going to want to stick with the sketch stuff once you have to handle this many interrupts, though.


EDIT1: I forgot to add, 9 out of 10 of the 8bit AVRs have PinChange Interrupt on all the I/O pins, to my knowledge all ATMega (the larger chips with more than 20pins) devices do. Again to my knowledge all ATXmega 8/16bit devices have even a more advanced PinChange interrupt system, but at least a PinChange interrupt on all pins.

EDIT2: But PinChange interrupt will, depending on device, usually go per 8pins, so you will have to check yourself which pin was the culprit, but running at 12MHz or more, that'll take virtually no time, so if they stay asserted about 1ms, and you know or learn how to write a good interrupt routine, it should be easy. (12000 clock cycles at 12MHz in one ms, so to an MCU 1ms is a WORLD of time!


If you want to find and use an appropriate Atmel 8bit/16bit MCU, go here:

Atmel 8/16bit selector

They have all these options that you can select limits in and then it will just show you which devices fit your requirements. Some are even specifically geared towards PWM motor control with advanced dead-time generation.

I think with your 16PWM channel requirements you are going to end up with an Atmel XMEGA though, not a big problem, they are affordable enough, they are amazingly powerful, they already have hundreds of example uses out there on the web, but... To my knowledge there isn't an Arduino board with one, so I don't know (not an Arduino fanBoy) if the tools can support one.

Alternatively you can use similar tools to select other devices with other vendors. Atmel (and others) also make very extensively equipped ARM Cortex-M processors, such a Cortex-M could get you very high performance from your system, allowing you to, over time with development and such, to approach NXT2.0 or even EV3 software complexity, if you wanted.

\$\endgroup\$
  • \$\begingroup\$ I was thinking the ATxmega64A1U or ATxmega128A1U myself. As an added bonus they have USB device support and more SPI and UARTs than most people will ever need (not to mention a monstrous amount of flash and a decent amount of SRAM and EEPROM). \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 7 '14 at 22:13
  • \$\begingroup\$ @IgnacioVazquez-Abrams All XMega's are awesome ;-). But if they have the pinning and processing power required for the purpose in the OP's mind, the added interfaces do help a lot. \$\endgroup\$ – Asmyldof Oct 8 '14 at 5:07
  • \$\begingroup\$ The ATxmega128A1U is only AUD$7.8 for the 100TQFP package, that is really awesome. I swear I looked up the XMEGA's before and they were like $18+. \$\endgroup\$ – KyranF Oct 8 '14 at 8:24
  • \$\begingroup\$ @KyranF Yup, the Xmegas have become quite affordable recently. Mouser has several types starting at $3 or below even. Seems there's not often reason any more to get the Mega's and risk just missing that one high speed PWM at the end. \$\endgroup\$ – Asmyldof Oct 8 '14 at 9:32
1
\$\begingroup\$

A reasonably simple Cortex M3 design with the largest possible package size (like a 100LQFP or similar size) will give you enough IOs, ADC inputs, PWM outputs, individual I2C buses, and very good control over interrupt vectors. They are very cheap, less than USD$6-8 for a decent one. The clock speed is also extremely awesome for what you get, from a simple 12Mhz ceramic resonator you can get 50+ Mhz core speeds usually (depends on the device of course!).

You could try for the MBED open source designs for setting up a simple Cortex M3/4 processor based system.

I also highly advise you to avoid the L293D for robotics based adventures with NXT/EV3 kits. The motors when hardly working already equal or exceed the rated specs of the L293D drivers. It makes me sick when I see all these Arduino and NXT based motor driver boards with the terribly old L293 series motor drivers on them. You must be very careful, or you will have nice fancy fireworks.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.