I've gone over this several times and can't make a good decision. I hope the forum members can help me here.
I am making a design of a data logger for teaching physics. I have my prototype in ATMEGA328P-PU and -AU but I need some more pins and functions to make it more useful to teachers and students.
Here are some general requirements:
Need more IO pins than 328P-PU, 6-8 more would be enough
Prefer one more hardware serial port to run dedicate connection to bees (zigbee, bt bee, digi xbee wifi ect.). Software serial is very inefficient with all the delays that can be used sensing inputs.
Need minimal modifications to arduino IDE so teachers with only basic understanding of arduino and programming are not intimidated with the mods
Hardware:
parallel LCD - 6 pins
3 sets of analog input channels, with 2 analog inputs per set (one sensing one other with pullup resistor for easy sensor identification or resistive sensor sensing) - 6 analog channels
I2C needs to connect to RTC and external ADC for optional high-precision sensing and other I2C sensors.
rotary encoder with clickable shaft for user interaction - 3 pins
SD card - 4 pins (SPI)
Serial for sketch upload and data link to PC - 2 pins
Serial for bt bee or zigbee or xbee wifi etc. - 2 pins
Maybe one buzzer - 1 pin
Total pin count is 25. My current prototype has no separate serial for bt bee etc. It also uses two analog pins one to sense rotary encoder (poor) and battery voltage.
Here are the processors I've considered:
ATMEGA32U4. I had high hope for this. But the processor "bricks" too easily if you don't write your program correctly. I had to re-flash its bootloader. I heard that you can get around that but that is too much for teachers that just want this device to teach. Plus, I will need an expensive USB vendor ID. Pass!
ATMEGA644. I thought about this one. I was a bit hesitant since the modification to the IDE seems extensive just to get this one to work. Hope someone can convince me otherwise. I have no macs and I expect may teachers to have macs. I have no idea how to make a modified install package for macs or linux. For windows it's just unzip and run. That I can do.
What other chips are out there that have been made compatible with Arduino that need some moderate to minimal IDE mod to run?
I've also thought about just using an I/O expander to run the LCD. But then it requires either a special library or IDE mod. Either way it will be very slow, having to share DS1307 on 100KHz bus etc. Maybe I should just do this. Forget about speed.
I also thought about using a second ATMEGA328P-PU to control lcd and rotary encoder but that will need some way to talk with the main arduino. I read about I2C and SPI. Neither is good at async comm that UART is good at. Too bad.
The main thing is the extra hardware serial port. So it is out with the most common ATmega328P.
Then we have two choices: ATmega32u4 and ATmega2560.
The ATmega32u4 is a good solution. It has a spare hardware serial port (Serial1). Why does it brick too easily ? I have not heard of that before. It is a little harder with the serial ports and the driver on the computer and uploading a sketch.
You can use the bootloader of the Arduino Leonardo or Arduino Micro. The vender ID has been solved for those.
Since you already use the I2C and SPI bus, you could use those for more devices. Or use a simple shift-register as I/O-expander. It is very common to add some kind of I/O-expander, it's just one extra single chip on your board.
There is nothing wrong with I2C LCD.
They are common at Adafruit and Ebay. You can use the Adafruit library.
A 16x2 LCD display has only 32 characters and you think the I2C bus is to slow
The I2C bus might be too slow for a pixel display, but not a simple 16x2. Those display are very slow anyway to show a change in the display.
The ATmega2560 has everything, but needs an extra chip for usb-serial.
Have a look at this: Cross Roads Electronics
That gives a few ideas how to design a custom board.
Another good option is to design a shield and still use the Arduino board. The Arduino Mega 2560 solves everything, or you can use the Due, or a Teensy board. You can add an I/O-expander on the shield for more pins.
C'mon Liudr, just jump right to a '1284P.
Core files are being maintained by Jack Christensen, adding it into the Arduino path is a piece of cake.
2 hardware serial, 32 IO, 128K memory, 16K SRAM, 4K EEPROM.
And I think they're less expensive than 644P also! Look at mouser.com
Add an offboard FTDI Module, or CP2102 Module, for serial downloading, keep it modular so it can be repaired after your students zap something.
You can use my Bobuino2 as a starting point, add your buzzer and other components to a piece of perfboard stuck on top while you develop your shield.
Will need fat16lib's SDFat.h library for the SD card.
Designed to be flexible: onboard FTDI or offboard FTDI/other, onboard RTC, RS232 buffer or pull jumpers and don't, add screw terminals, or don't. Got some free buffers for driving 3.3V signals too (Xbee)
Lots of pads for connecting stuff up.
I also thought about using a second ATMEGA328P-PU to control lcd and rotary encoder but that will need some way to talk with the main arduino. I read about I2C and SPI. Neither is good at async comm that UART is good at. Too bad.
Rethink SD: You need a logger, so build a logger that logs anything over serial. These can be easily constructed as a shield for an UNO/Mega.... select the host Arduino for I/O pins and connectivity. sd-card-serial-logger
Now, once the data is in ASCII on the SD card, you can import that into Excel for the real fun graphing, sorting, analysis, etc.
OR, you can really go far-out and just capture raw digital and analog signals and import that directly into Excel. For elementary physics, this allows a very cheap, inexpensive shield to work over HID and type directly into Excel. From there it is fun time. Arduino Digital and Analog Directly into Excel
But, if you want to continue down the road you are headed, the Mega2560 is great as is the Bobduino1284. I use both and love each (the Bobduino has 2x the SRAM which is very nice for this sloppy programmer).
The design is enclosed in a box and would not need a separate arduino so the cost is down. I'm shooting at $60 or less for all these functions and still be able to find manufacturers to profit from making them.
Peter,
I was saying slow because the pin flipping rate for I2C extender is clamped at around 5KHz at best, if you send two bytes to flip a pin (register address, and then register value). Maybe that is the wrong bottleneck, the right one being the slow speed of character LCD. I didn't look into the delays in liquidcrystal library. I'm sure it's not interrupt driven so once I enter print command, it will delay until the print is over. This is too slow if a teacher wants to detect photo gate activities. Maybe I should just write on the manual that they should keep lcd quiet when acquiring data from photo gates that need sub-millisecond timing accuracy. I might just use port extender then.
CR,
I was hoping that you would jump in So are we talking about the pico power version ? 1284P-PU or AU that is supported, right? Where do I look for the core files? I'll get started with google first. The memory amount is really useful when you program a device for beginners such as teachers and students. You can do all the text strings without F() or PGM manipulation and store values in SRAM. Only those few that are aiming at larger projects need to know how to preserve PGM and SRAM properly The price is acceptable $5+ for 100+ MCUs price cut.
I will have two versions, one with plugs that work with some existing sensors and one with screw terminals for exploring. My current version is with plugs and SD card on board. I need to add RTC and xbee footprint and just use spare voltage converter channel from the one for SD card. I'll use your design as a reference for pins. The symmetric pin arrangement of the chip is neat.
mrburnette,
I am not assuming everyone to have a computer and proper driver installed to log data. It's a handheld device for physics labs. You could do labs outside lab rooms where having the device tethered to a computer is cumbersome. The least thing I want is to call IT every semester after they wipe the computers to install drivers. So you can log to SD and later let computer read the file. The 2560 chip is an overkill and also is too expensive for my project.
liudr:
Maybe that is the wrong bottleneck, the right one being the slow speed of character LCD. I didn't look into the delays in liquidcrystal library. I'm sure it's not interrupt driven so once I enter print command, it will delay until the print is over.
I'm sure it isn't interrupt driven. But why would it need to be?
So - write your own! You are writing the software, aren't you, and I doubt you have to use ridiculously complex formatting, so just make it a separate task in the loop() and feed it your data in a buffer. Co-operative multi-tasking code need not cause delays. No penalty in code space if you do not use a particular library.
Thanks CR! I'll try it out once I get a few DIP 1284P.
Paul,
Yes, I can write libraries and use interrupt-driven state machines. That's a lot of time. I think I'll try the 1284P route to avoid having to use additional hardware. Simplicity is what I need.
It's really weird that 324P, 644P and 1284P are about the same price. I guess I'll just get the 1284P and a couple of the other two for prototyping. If Jack's modded IDE handles 1284P, then adding 644P and 324P will just be a new boards description etc, maybe need new bootloader right?