Show Posts
Pages: 1 [2] 3 4 ... 7
16  Using Arduino / Project Guidance / Re: "Load mapping" SRAM memory use in Arduino? on: November 13, 2011, 06:07:16 pm
Thanks very much wildbill.

Most of the other stuff ya'll are talking about is way above my pay grade.

And please remember, friends, we're sending a few dozen of these out.  Code needs to be bullet-proof.  All our hardware, too -- it really sucks when users have problems, and so far this is rare.

We're not like Microsoft, etc., we don't like users testing our gear; we try to do that, and let them just teach.

Thanks for you help, we need it, it's all for education, very worthy cause, I support six employees and haven't made a dime myself in five years, but almost there!


17  Using Arduino / Project Guidance / Re: "Load mapping" SRAM memory use in Arduino? on: November 13, 2011, 02:05:30 pm
OK everybody, here's the code.

THANKS for your help!  I've put description Exhibition / Gallery  to make things neater:,78866

Should mention programmer X (anonymous pal) wrote some very sweet encoder code; seems to not be enough of that around; it's in there.


PS.  Yes, I know all the "30"'s in hydrographs can be replaced, we eventually want to have other numbers there :-)
18  Community / Exhibition / Gallery / Re: Pump controller/flow meter for river model, with code on: November 13, 2011, 02:00:52 pm
OK, code here.

Mostly written by a professional coder/friend as a favor; he'll remain anonymous.

Thanks for all your help, forum peeps :-)

--Arrrggg, keep getting "9500 characters exceeded...." error here so I'm trying the attachment function...
19  Community / Exhibition / Gallery / Pump controller/flow meter for river model, with code on: November 13, 2011, 01:51:16 pm
In response to questions about coding and memory elsewhere in the forum (,78857.0, I've posted functions and code for a pump controller we have developed at Little River Research & Design.  In a day or two I'll add more, we've developed a very nice PCB to go with this that holds Arduino, LCD, and components to drive a small pump and use the power sent to the pump to measure flow rates.  Description here, followed by code.

(Forum won't let me put all in one post, code in next reply).

Steve Gough

Em2x digital pump controller (Em2x DPC, “Alix Controller”)
software function outline
S. Gough
Little River Research & Design,
Revised Nov 13, 2011 to add “calibrate” function to menu.

Control input:  Optical rotary encoder, quadrature, with push switch.
Interface:  LCD display, 16 x 2, and maybe a small piezo beeper
Power input:  Desktop brick switching regulated 12V, 3.5 A capacity.
Output:  12 volt PWM to pump.

Basic operation

The flow controller controls flow via 12V PWM to a small pump.  We will calibrate
flow output from the pump to the PWM value from the Arduino (Duemilanove until
stock runs out, then Arduino Pro or UNO).  This might have to be done for each
unit.  The controller displays information about flow on the LCD, and also provides a
menu for various functions.  An LED on the PCB board provides verification of
power input, another LED varies in brightness with duty cycle.


1.   States. There are four states.

a.   Startup.  On power up (plug-in), controller displays welcome
message, sets duty cycle to zero (if this doesn’t happen
automatically) and then increases duty cycle to prime the pump and
provide a low flow, which verifies to users that things are working,
and goes to normal operation:
b.   Normal, users simply control flow and read values on the LCD.

c.   Menu, invoked by a press of the switch, in which users can select
from options:

i.   Exit menu (for accidental menu enter of change of mind);
this should have a 20 second or so default time out to return
to normal operation.

ii.   Reset flow and time counter with “are you sure?” verification.

iii.   Run hydrographs; at least six choices, hydrograph 1,2, etc.

d.   Hydrograph run, in which the controller automatically varies flow
making a bell-shaped curve of increasing and then decreasing flow
to simulate floods.  These will last from ~3 minutes to hours.  On
initiation, flow/time counter is reset, and flow values/totals appear
as in normal operation.   There are two options for running

i.   Program six or so hydrographs into the unit using array
values, this is very easy to do.  The method and code I used
for my (Steve’s) stab at it worked very well.

ii.   Allow users to select several hydrograph features from
menus. This would require a rather complicated
menu/submenu system and we should probably stick to the
first option for now.  Features would include:

1.   Total hydrograph time.
2.   Flow peak value (e.g. 180 ml/s)
3.   Time to peak.
4.   Time at peak (i.e. how long the flow remains at peak

2.   User interface -- flow control and display:

a.   Power up and reset are done by unplugging the unit, which resets
the Aurduino and LCD.

b.   Users can increase or decrease flow by turning encoder knob right
or left.  Arduino has a robust encoder library for this, and the optical
encoder we’re using needs no debouncing.

c.   Flow display:  rate is displayed on the LCD in ml/sec, and is
updated at at least 1Hz.

d.   Flow volume and time accumulation: the lower line of the display is
used to show accumulated flow in liters/sec; and time in seconds.

e.   Sound – small beeper (implemented, along with timer tweaking to
enhance volume.)

3.   PWM and flow calibration.

Sketch (what Arduino programs are called) should have a variable tying
PWM value from the Arduino to flow values from the pump.  We’ll test to
determine how PWM values (i.e. “analogWrite”) related to actual flow in
ml/s and change this variable to calibrate the units.  For most pumps
we’ve tested, flow does not start until about 40% duty cycle.
Nov, 2011 update:  “Calibrate” feature in menu allows users to set the
PWM value for “fist flow” or near-zero flow; user adjusts flow until it’s as
low as possible but still continuous; then navigates in Menu to “calibrate”
and presses knob; this sets PWM lookup values so that PWM value is at
3ml per second and adjusts the entire PWM v. flow curve to match
(shifting it right/left, basically, with PWM on the x-axis).
20  Using Arduino / Project Guidance / Re: Dog Stair Detector on: November 13, 2011, 12:41:07 pm
I've spent a lot of time studying and working with dog behavior, mostly as a result of adopting damaged dogs.

My advice, unsolicited:  Be very careful about loud noises and especially attaching anything to the collar; we tried a simple mild vibrator on a dog once (with remote, as mild as a typical cell phone vibrator), designed just to get the dogs attention, and it scared her to death.  Dogs can be very vulnerable that way and sometimes will never get over certain sounds/actions.

Also be aware that using a buzzer/whatever could make the dog wary of all similar sounds.  These things are super variable depending on individual dog and its history.  It's really complicated.

Ours are very highly trained and don't get on furniture, never go through a door while with us until given permission, but I've never been successful keeping them out of certain rooms of the house when they're not being watched, good luck with that!  :-)

I design lift-off gates for rooms like that, or we use child gates.
21  Using Arduino / Project Guidance / Re: "Load mapping" SRAM memory use in Arduino? on: November 13, 2011, 12:31:31 pm

Sorry, should have mentioned I can email your replies to my friend and this may be a big help to him -- he'll know what all that means; he's a high level pro but not familiar with the specifics of Arduino.

He wanted to start from scratch but I wanted to use Arduino to make the project open source and easily modifiable by users.  No good deed goes unpunished, right?  :-)
22  Using Arduino / Project Guidance / Re: "Load mapping" SRAM memory use in Arduino? on: November 13, 2011, 12:27:47 pm
Thanks PeterH.

Using the Pro 328.  We have tons of flash left over, the code's only about 7K; it's the large arrays and lookup tables; my friend has used pointers for some as a help (as I understand it).

Part of the problem is that I want the code to be hackable by students using our models (from grade 5 on up to PhD); and the code is now still barely accessible because it's pretty complex.

And I think my friend did use C, I don't really know the difference, just that it compiles and runs fine, sorry, again, I'm a geoscientist trying to do the jobs of several people here :-) -- we are struggling in this economy.

I did find info on PROGMEM:

Looks like this would work, but with added complexity.

Also this is a production item, we'll send dozens of these out to clients, and anything that risks flaky behavior is a real risk for us; most users will not want to reprogram themselves.

Would really help if we could just calculate loading of sram, but I don't see a simple way to do that.

23  Using Arduino / Project Guidance / "Load mapping" SRAM memory use in Arduino? on: November 13, 2011, 12:04:13 pm
First, I'm a geologist, not an EE guy; I can do simple sketches, but this stuff is way over my head.

In short, I'm using the Arduino Pro in an electronic flow controller for educational river models we build (see

A pro programmer wrote some nice code for me as a favor (in C++); it works, but we're bumping against memory limits; we have several large arrays, most of which are used to run "hydrographs" -- simulation of a flood; a curve that starts small, climbs to a max, and then tapers off.

I am cleaning up and refining things because he's already done me WAY too many favors.

Also we had to hard code a pwm v. flow rate curve because it could not be well described by a math function; so 255 numbers right there (we unit8_t 'd them, that helped).

Also he as advised using "const" for variables, this put them in flash, correct?

Many thanks for help :-)

My friend isn't much versed on Arduino; he's asked me to ask you guys if there is a way to "load map" with the Arduino IDE, i.e. see how much SRAM is being used when the program runs.
24  Using Arduino / Motors, Mechanics, and Power / Re: Voltage v. PWM values nonlinear, why? on: October 02, 2011, 12:24:37 pm
Well, you guys did it again, the pro who designed the circuit says "I'm eating crow...."  He thought the MOSFET had built-in flyback diode and it does not.  Fortunately we can easily add that, we did, and here' s the new trace.

Thanks very much!

25  Using Arduino / Motors, Mechanics, and Power / Re: Voltage v. PWM values nonlinear, why? on: September 27, 2011, 09:38:52 am
Many thanks everybody, will look into all this and let you know what we do.

One thing I should mention is that the small centrifugal pump is drawing 1.6A at most, and of course it's very highly damped by water on the impeller.
26  Using Arduino / Motors, Mechanics, and Power / Re: Voltage v. PWM values nonlinear, why? on: September 26, 2011, 12:09:20 am
Grumpy Mike has warned me the scope lies about things like this.  This trace looks very much like others I've seen on this scope of similar circuits.   The only perfect square waves I've seen come from Critical Velocity PWM controllers.

Here's the circuit.  MPWM_D3 is pin 3 on the Arduino.

I think that MOSFET has its own flyback diode, but I don't see that on the datasheet, and there isn't one in the circuit; the MSENSE conection is unused.



27  Using Arduino / Project Guidance / Re: USB through tiny hole in box; FTDI breakout boards? on: September 25, 2011, 09:20:38 pm
Thanks ya'll.

After talking to others I've decided we'll keep using the Sparkfun unit with the mini b plug; I found a male mini b plug at Mouser (798-UX40A-MB-5P) that should be easy to solder; we'll pass the USB pigtail through the glandnut and then solder on the plug and connect to the Sparkfun board that way. Actually, without the overmolding we *might* be able to pass the soldered-on plug through the gland nut opening.

a.d., we will use for both programming and control; students and researchers use the models for experiments/teaching; so it's very cool to have real time control/data readout, which can be done with USB.

28  Using Arduino / Motors, Mechanics, and Power / Re: Voltage v. PWM values nonlinear, why? on: September 25, 2011, 11:18:29 am
I'll get that schematic soon; here's the scope trace in meantime; pretty much what I expected, and keeps this shape through all duty cycles.

29  Using Arduino / Project Guidance / USB through tiny hole in box; FTDI breakout boards? on: September 25, 2011, 11:11:23 am
We've developed an Arduino-powered pump controller for our river models ( using Arduino Pro.  It's in a watertight box.  I'd like to run USB through the box using a glad nut.

We could easily do this by running connector-less USB cable and then soldering to a breakout board inside the box (the gland nut will only pass small wire; not even a mini USB connector).

We are using these boards now  and I see Sparkfun also has a BOB that would probably work for us (but way expensive for some reason):

And we could desolder the connector from the first board above, but I hate to do that.  And we could use very expensive/ hard to find watertight USB ports.

Any advice or ideas?  Thanks!

Here's a little peek at the controller with nice custom PCB.

30  Using Arduino / Motors, Mechanics, and Power / Re: Voltage v. PWM values nonlinear, why? on: September 23, 2011, 08:53:14 am
Yep Magician; it's a first class circuit designed by a pro (not me :-); we'll check that out, thanks.
Pages: 1 [2] 3 4 ... 7