Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: USB Shield + EOS control on: June 28, 2013, 01:34:02 am
I could not get to the link to the blog as posted under "SOLVED", but I did find a solution. There are a couple of things that have to be done to get the PTP examples to compile and work under newer Arduino versions. The answers are all in the comments on this page:

Among other things, don't use the latest version of QP - use 4.3.00 instead. That plus the other changes listed in the OP's first post did the trick for me, I now have a working version of EOSRemote.


2  Using Arduino / Sensors / Re: Strain Gage Amplifier for Arduino Uno on: July 04, 2012, 12:41:12 pm
You told us you measured the voltage on pin A0 but not what the values were.

I have experimented with INA125, I found it more than I needed for this and changed to INA126.  Can you post a schematic of your current setup?
3  Using Arduino / Motors, Mechanics, and Power / Re: motor control on: April 10, 2012, 09:54:32 pm
The '328 can run 16MHz, and the timers can run at CPU frequency. By definition this gives you 1/16th of a microsecond precision. 1/16 is .0625. If you could run at 20MHz, you could pull off .05us. Depending on speed requirements, you may be able to to get significantly more precision by oversampling.

I would think that 8Mhz is the limit of timing resolution for a 16Mhz MCU - Nyquist theory anyone?
4  Using Arduino / Motors, Mechanics, and Power / Re: SSR and Arduino on: April 10, 2012, 09:46:05 pm
I found a 40A SSR on Amazon for $11.50 and the matching heat sink for $7.59.  Under $20 for both.

I hope you are planning on using a heatsink. 

I got the SSR to use for developing a controller for my hot tub, but I will be upgrading to a Crydom DW2450-10 (50A random) and a much larger heat sink.
5  Using Arduino / Motors, Mechanics, and Power / Softub controller on: April 09, 2012, 11:44:41 pm
I have a Softub 300 that is about 10-12 years old.  For those that haven't ever seen one, this is a hot tub that uses the heat from the motor to heat the water.  I like it, it's simple and very comfortable.

Last week the digital controller died.  The failure is in one of 2 circuits; one costs around $300, the other around $400, and right now I don't have the $$$.  You can already tell where this is going, but you knew that already given the forum I'm posting in...  I grabbed a spare Uno, a proto shield, and an LCD shield.  I picked up a 40A SSR and heat sink from Amazon for under $20.  A few lines of code and I now have a pretty decent replacement controller for well under $100 (although it's not quite done yet).

This is a temporary lashup - I am working on adding some protection circuitry to limit the maximum water temp and I will also be replacing the SSR with one that has better specs once I have figured out which one to get.

I'm just wondering if anyone else has gone down this road and has any insights to share or anyone has any interest in this project.  As I see it the key issues are:

1) use an SSR or mechanical relay?  Each has advantages.  The SSR is more efficient and simpler to drive from the 'duino, but it needs a proper heat sink.  If I put the SSR inside the hot tub "heater package" I will need a pretty expensive heat sink.  With the old controller, which used a relay, the motor drew around 12A; with the SSR I'm seeing closer to 15A now, and the water heats up faster as a result.

There are some pretty scary stories out there of SSR's catching fire when used in hot tub controllers.  I have been discussing this with a very helpful gentleman from Crydom and he tells me this is because some SSR's use epoxy encapsulation.  Crydom has stopped using epoxy and he says this makes a big difference.  Having enough heat sink is also important.

2) protection circuits - the old controller used 2 temperature sensors.  I'm guessing one was a safety backup - it looks like one was connected directly to the MCU inside the heater package and the other was connected to the MCU in the display panel.  Either one can shut the motor down if the temperature gets too high - redundancy.  I am thinking of adding a button-type overheat sensor and killing the power if it trips.  That will shut down the pump unless the SSR fails shorted.  I could also use a second 'duino inside the box and use a second temp sensor.  I don't know what happens if the tub develops a leak and the pump runs dry - I could certainly test that at the next water change.

3) This is not a PID application, that would be overkill here.  It's a simple on/off thermostat with a small amount of hysteresis.  I'm already finding that my little controller has better temperature control than the original one from Softub.  I can tell by the data from my power monitor when the tub is on and for how long, especially at night when there isn't much else in the house using power.  The Softub controller would turn on for much longer periods, which resulted in wider temperature swings.  The total run time is pretty much the same, I'm just turning it on for shorter periods more often.  With outside temps around 45-50 F at night it's running for on average 25-30 minutes every couple of hours (a Softub is VERY well insulated, much more so that a normal hot tub).

6  Using Arduino / Programming Questions / Re: How to use serialEvent ? on: March 21, 2012, 10:55:19 am
Allocing and copying data slow? .reserve helps with the allocing.  copying at machine level isn't all that slow.  But in any case none of this matters because it finally dawned on me that there are bytes of zeros in the data and that won't work with strings.  So I'm back to a byte array.

I'm getting closer.  I'm pretty sure I understand what is happening now - the original code in Arduino ISP is really dependent on the larger serial buffer of the older IDE because it isn't reading the data as it arrives, but rather when it needs it.  That worked fine as long as all of the request block fit in the buffer but with IDE 1.0 that's no longer true.  I've made changes to improve this but I still have one timing issue.

More to come...

7  Using Arduino / Programming Questions / Re: How to use serialEvent ? on: March 20, 2012, 11:12:21 pm
The code was originally written using a byte array.  I changed it to use the string as that is the example given on  I'm not sure that one method is actually that much faster than the other though.  It seems intuitive that a byte array would be faster but then you have to keep track of the pointers and check for overflow...

In this case it does not matter what avrisp() does.  Since it is only called when an EOP is receiveed, it never gets called for the long request.  It does get called for all of the short requests, there are several of these and they are all run and responded to.  I have a port monitor report showing all of this working.  Then AVRDude sends the 133 byte string, and only part of it gets thru, the rest is lost.  Since the EOP is the last character, it is never seen, and the request times out.  At this point the only thing running is the Serial Event loop.

With Arduino IDE 22 I can read all 133 characters without a hitch.  With 1.0 it's getting truncated.  I am very surprised by this, I would have expected to be able to easily keep up with the data at 19200 bps.  The size of internal buffer should not be an issue but it appears that it is.

I know I can edit something in the IDE so that the buffer is larger, and I will try this to see if it helps, but I really don't want a solution that involves modifications to the Arduino IDE that will get wiped out by an upgrade.

Thanks for all the suggestions, it's all helpful and I appreciate your taking the time.

8  Using Arduino / Programming Questions / Re: How to use serialEvent ? on: March 20, 2012, 03:46:13 pm
FWIW - I'm using a serial port monitor to try to debug this.  It captures all of the traffic nicely.  The data sent by AVRDude definitely has the EOP (x'20') character. 
9  Using Arduino / Programming Questions / Re: How to use serialEvent ? on: March 20, 2012, 03:43:27 pm
Why not? You should be able to read serial data far faster than it arrives.

One would think so, but it's not working that way.  I am trying to fix the sketch for the "Arduino ISP" programmer so it works with IDE 1.0 (runs fine with 22 or 23).  AVRdude is trying to send a 133 byte string, and it's getting truncated.  The code is pretty simple:

String sBuffer = "";
void setup() {

void loop(void) {
  // light the heartbeat LED
  // have we received a complete request?  (ends with CRC_EOP)
  if (EOP_SEEN) avrisp();

void serialEvent() {
  while (Serial.available())
    char ch = (char);
    sBuffer += ch;  // add it to the buffer
    if (ch == CRC_EOP) EOP_SEEN = true;

"avrisp" is the sub that handles all the requests.  All of the short ones work fine.  When AVRDude tries to write a page, the string is 133 chars - 4 bytes of descriptor, 128 of data, the EOP.  The EOP character is never received.

10  Using Arduino / Programming Questions / Re: How to use serialEvent ? on: March 20, 2012, 01:34:43 pm
serialEventRun() is only called after each execution of loop().

It does appear to work this way, but then one wonders, what's the point?  With the present implementation I cannot reliably send any significant length of data to an Arduino UNO at even 19200 bps without over running the fixed length internal serial buffer.  I would have thought that the point of having an event for this was to make serial communication more reliable, but this seems like a step in the wrong direction.  I did not have this problem with Arduino IDE 23.

11  Using Arduino / Displays / Re: GLCD library version 3 on: June 12, 2011, 09:28:50 pm
Makes perfect sense, glcd is amazingly fast.

What is the driving need?

I2C on A4,A5.  Everything else I can move.

12  Using Arduino / Displays / Re: GLCD library version 3 on: June 12, 2011, 03:18:18 pm
Is there some way to change pin assignments without editing the .h files?  I tried doing a #define in my sketch but it doesn't seem to make any different.  Also tried #undef and #define.

13  Using Arduino / Displays / Re: GLCD library version 3 on: June 12, 2011, 03:16:06 pm
this code
creates a vertical line not a horizontal
from the reference doc:
>void    DrawLine (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t color=BLACK)

As I read it, the second pair of values for DrawLine are coordinates not sizes, so I would expect the given code to draw a vertical line.

14  Using Arduino / Storage / Re: proper use of EEPROMWriteAnything ? on: May 27, 2011, 12:18:50 pm
One thing to be aware of - eeprom_write_block actually writes 1 byte at a time in a loop.  So if your structure takes up 8 bytes, for example, that's 8 writes.  It can be pretty easy to go over the 100,000 write limit if one is not careful.

15  Using Arduino / Programming Questions / Re: How to save structure in EEPROM on: May 27, 2011, 11:54:49 am
You can use the avr-libc call, just put the include in your sketch:
#include <avr/eeprom.h>

But - both routines write 1 byte at a time, so keep this in mind.  The Arduino's EE is only rated for 100,000 writes, you can use that up in a hurry if you aren't careful.

Pages: [1] 2