Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Microcontrollers / Re: capacitive touch using atmega32 on: April 11, 2014, 05:18:14 pm
The main software library is QTouch.  Your job is to find or produce a QTouch implement library for Arduino.  The Google search terms are: Arduino QTouch to begin and then start drilling down.  Good luck.

Its been a few months, has anyone actually managed to use the Atmel QTouch stuff from within the Arduino IDE?  I have a project  that needs some capacitive sensors, and this would seem like it should be a good method without having to resort to something like an MPR121 breakout board.
2  Using Arduino / Microcontrollers / Re: How to choose cheapest AVR for a task on: April 10, 2014, 09:10:26 pm
"Cheapest" in monetary terms overlook your investment in time which directly translate to the probability of greater frustration.

Consider the Atmega328P-PU for projects..., same uC as the UNO.  In 25 qty, these are just $2.10 and will support anything code-wise that an UNO, Nano, or Mini will.  Clones of the Mini are easily found on eBay for $3-$4 and will save you construction time and the need to stock 16MHz crystals, load caps, voltage regulators...

So one of the reason's I'm looking at the ATTiny's is that I'm trying to fit this into as small as space as possible and will be imbedding it into a PCB I'm working on.  I've got some Atmega328P-PU's I've used elsewhere and could just copy the appropriate bits from my Eagle sketches for those, but the ATTiny84 is half the size.  One day I'll get around to learning to use SMDs and setup a reflow toaster, at which point a SMD ATMega328 would be an obvious choice.

I develop on the UNO or Nano and then, if the project warrants, I move the code to a naked 328 or Mini clone.

I hadn't seen how cheap the Mini clones were on eBay.  Looking at them, once I've added a crystal+capacitors and a reset switch to the attiny it would probably take about the same amount of space as the Pro Mini.  I'll order a few of those and try it out.
3  Using Arduino / Microcontrollers / How to choose cheapest AVR for a task on: April 10, 2014, 05:25:29 pm
Are there any good resources out there for choosing the cheapest AVR that fits a set of requirements?

I'm currently working on a project that requires 4 PWM outputs, 3 other outputs, 1 analog input, and probably 8kb of program memory (it seems I'd have to write some existing libraries in order to get <4kb, and I don't really have the time for that).  Right now I'm testing this out with an ATTiny84, but these seem to be relatively expensive, the cheapest I see them is for ~$2.50 on Ebay vs $3 for a full ATMega328.
4  Using Arduino / Programming Questions / Re: Analysis of per-library memory usage on: April 06, 2014, 03:06:55 am
My code is (I believe) pretty thoroughly optimized.  All strings are within F() statements, all print statements are #def'd out (see, etc.  If needed I can go through all the included libraries and inspect the code, but I'm hoping that someone can point me to a method of determining library memory usage via tools.

At this point I'm sort of suspecting that these don't currently exist, at least within the generic Arduino IDE ecosystem.
5  Using Arduino / Programming Questions / Re: Analysis of per-library memory usage on: April 05, 2014, 08:43:01 pm
Sorry, by "Arduino 2" I mean the Arduino beta IDE.
How do you get 2 out of
Arduino 1.5.6-r2 BETA (with support for Arduino Yún and Arduino Due boards)

Apparently through the magic of MacOS automatic naming.  I left Arduino 1.X installed, when I installed Arduino 1.5.6-r2 BETA the app was installed as "Arduino 2".
6  Using Arduino / Programming Questions / Re: Analysis of per-library memory usage on: April 05, 2014, 05:52:29 pm
Sorry, by "Arduino 2" I mean the Arduino beta IDE.

The actual hardware I'm using is an Arduino Nano, so ATMega328P.  This is for a project where I'll be producing my own PCBs with ATMega328's on them, so the final thing won't be on a standard Arduino.

I'd rather avoid changing chips at this point.  While I could move up to ATmega1284P's for the much larger RAM, I'd rather optimize things within the 2K limit as the bigger chips are also much more expensive and the final project will involve at least a dozen of the modules I'm working on.
7  Using Arduino / Programming Questions / Analysis of per-library memory usage on: April 05, 2014, 03:49:32 pm
For more traditional unix based C compilation there are ways to determine where statically allocated memory is being used, is there some way to determine this for Arduino code?

I have a project that has become fairly complicated code wise due to using a number of libraries, both ones I've written and some 3rd party ones (such as RS485 communication, the Adafruit LED pixel library, MPR121 cap sensor library, and some others) and I've run up against an issue I suspect to be due to hitting memory limits.  The compiled code leaves only 495B free and I know at least another 3-400B are allocated by the pixel and RS485 libraries at run time.

Are there any tools (other than manual code inspection) to determine how much statically allocated memory is being used by the various modules or cpp files being used here?

(I'm currently using Arduino 2 if that makes any difference to the available tools)
8  Using Arduino / Programming Questions / Re: Options for command line compilation on OSX Maverick? on: January 20, 2014, 04:52:14 pm
I can explain if needed, but the Arduino IDE is pretty limited for someone that writes code professionally
Well, you need to, then. I write code for a living, and I haven't had any problems living with the IDE.

Well, besides being a horrible editor (but I use emacs as an external editor and switch back and forth to the IDE for compiling), it doesn't provide options for more restricted compilation options.  I'm a strong believer that all compilation warnings should be considered errors, however since you can't set GCC options via the IDE you can't enable that.

But beyond the generics of wanting a more customizable compilation experience, in my current case I've built a module with a PCB that has an integrated Arduino and a number of generic outputs that could be connected to number of external devices.  I'm going to have a number of these modules talking to each other, all running off the same code base.  To configure these modules the code needs to know which device is attached to which set of outputs, as well as some metadata about those external devices (their relative geometry is the main one currently). 

As these devices are all different, my current method for configuring them is that I have a config.h file that has a #define'd constant indicating the module number, and then a config.cpp that has a #if/#elif  chain to do the configuration based on the module number.  When I make a code change I then have to connect each module, set the current module number in the config.h and upload the value.  Clearly this isn't a very elegant approach nor will it scale well as the number of modules I'm working with begins to grow (I currently have about half a dozen, but expect to have several dozen when I'm done).

If I could do the compilation and uploading via command line (and I was hopeful that the ino tool would let me, its just not working for me for some reason, possibly due to not being updated since Maverick came out), I could script out the entire configuration process and just have module.conf file for each module.  The configuration process could be simplified to:
* Requests the module # from the module
* Locates the conf file for the module, injects it appropriately into the C code
* Compiles and uploads the module-specific code
9  Using Arduino / Programming Questions / Options for command line compilation on OSX Maverick? on: January 19, 2014, 10:33:09 pm
Are there any good options for compiling and uploading from the command line on OSX?  I'm working on a project that would be easier if I could muck with make files (I can explain if needed, but the Arduino IDE is pretty limited for someone that writes code professionally).

I've tried out ino (, however I'm having no success converting from an existing Arduino sketch.  It just doesn't seem to recognize either the libraries I've installed for Arduino (which include a number of personal ones) or even ones placed in the ino projects lib directory.
10  Using Arduino / Programming Questions / Re: How to read a register value using the Wire library on: January 18, 2014, 09:57:12 pm
Here is some code which reads a register on a freescale accelerometer.
You need to add the extra parameter  "false" on the endTransmission() call,   and then the extra parameter "true" on the requestFrom() call.    The effect of these is not very well documented or explained.

Cool, between the two responses I can at least start messing with it.  The info that the first byte sent sets a register pointer that auto-increments makes a lot of sense, and was the key bit I wasn't seeing on my own.
11  Using Arduino / Programming Questions / How to read a register value using the Wire library on: January 18, 2014, 01:30:54 pm
I'm playing with my first I2C device, an MPR121 cap touch sensor (  with the Sparkfun breakout board, and started from the code in this blog (

I have this up and working, but have determined I'd like to know how to read from specific registers.  Writing a register is simple enough, just begin a transmission to the device's address, send the register number and the value to be set:

void MPR121::set_register(int address, unsigned char r, unsigned char v) {

However what I'm not seeing in the Wire library is a method of requesting to read a register value.  Can anyone give me a pointer here, I'm sure this should be a similarly trivial operation but I'm not quickly finding the answer via google.
12  Using Arduino / Project Guidance / Re: Alternatives to ATMega328 with more SRAM? on: November 13, 2013, 03:56:35 pm
There was a concern voiced about the speed of PROGMEM access. From what I understand, access requires one extra clock cycle per byte (62.5 nanoseconds @ 16MHz). Usually, this is not enough of a difference to matter. An extra 27 clock cycles to read 27 bytes is an extra ~1.7 microseconds if I'm calculating it right. So how tight are your timing requirements? I'm looking at the WS2801 datasheet and it appears to be a synchronous (clocked) protocol, so unless you have to maintain a high refresh rate, the WS2801 won't care if the clocks come in a little more slowly.

II can't really say what the timing requirements are going to be, as I'm still building this out.  At a guess this will be good enough if it can refresh the entire LED array at ~30-50hz (say 20ms per refresh).  Worst case scenario for an animation would require fetching the entire geometry from PROGMEM, so if your calculations are accurate that'd be around 170µs.  That's probably fine.  And the geometry is actually only around half those 27B, so it would actually be a good bit less than that.

Also, if you're building custom PCBs for Atmega328 chips anyway, slap a 20MHz crystal on your board. Free 25% speed boost to help counter the PROGMEM speed drag!

This is also another good point.  This would muck with everything involving timing, is there an easy way to set the clock speed used by millis()/etc?  A quick google search implies this may involve changing the bootloader, but I can probably handle that.
13  Using Arduino / Project Guidance / Re: Alternatives to ATMega328 with more SRAM? on: November 13, 2013, 01:10:49 pm
Also you may try to work with Arduino Mega 2560 + RAM expansion. There are two little different types:
QuadRAM 512KB - 16 x 32KB banks
SRAM expansion shield 512KB - 8 x 64KB banks

I own second one and this shield works fine (but shield has not R3 pinout and comes unassembled).

I don't think something like this is necessary, I really only do need ~4K RAM for the current implementation.  However that second one looks interesting for other purposes, is there any particular reason those are limited to ATMega's (I mean, other than the shield based arrangement)?
14  Using Arduino / Project Guidance / Re: Alternatives to ATMega328 with more SRAM? on: November 13, 2013, 02:12:22 am
Is there anything (other than the additional complexity) that would prevent you from using multiple Arduino Nano boards, daisy-chained together (perhaps in-line with the strips serial connections)?

I'm sure it would be possible, but ultimate that would cost more than just using one of the larger RAM ATMega chips someone mentioned above.  I can change my PCT to use a larger footprint easily enough.
15  Using Arduino / Project Guidance / Re: Alternatives to ATMega328 with more SRAM? on: November 13, 2013, 02:10:42 am
As the last two posts hinted, information that does not change while the program is running (presumably, the neighbor configuration) can be put into program memory instead of SRAM.

The geometry probably could be put into program memory (I assume you mean whats referenced here -, but it is something which is being constantly accessed so I'm hesitant to make that switch as I believe there is a performance hit for pulling stuff out of program memory.

(I didn't post the code earlier as theres a lot of it, but you're welcome to look at
Pages: [1] 2 3 4