Show Posts
Pages: [1] 2 3 ... 58
1  Using Arduino / Project Guidance / Re: Need help on solar charge controller on: July 09, 2014, 02:29:45 pm
I once had to charge a lead-acid battery from a solar panel.  My approach was just to use a linear regulator -- an LM317 -- with the output voltage configured for the float voltage of the battery -- 13.75V.  Done.

When the solar panel is generating less than 13.75+dropout ~= 15V or so, nothing much happens.  When the voltage rises above this the battery charges to its nominal float voltage and no more.  The OCV of the solar panel is a bit above 18V but in practice it tracks at the battery voltage + regulator dropout most of the time.

In my case the solar panel generates about 5 watts only, so the chances of overcharging the battery are small anyway.
2  Using Arduino / Project Guidance / Re: UNO with SIM900 Quad-band GSM/GPRS Shield & a Ethernet Shield W5100 Micro-SD on: July 09, 2014, 02:20:14 pm
how do you program in Unix. Are there compilers and IDE to do so? Or just a Linux distro.

There are compilers of course.  And IDEs.  You can use any of a dozen Linux distributions, Free/Net/OpenBSD, Solaris -- take your pick.

My point was only that if the private network involves a proper computer -- as opposed to a microcontroller like a AVR Arduino -- that might be a good place to implement an ethernet/SMS gateway -- rather than trying to cram this function into an Arduino.

Quote
Btw, maybe its easier to program in Arduino than Unix.

By some measures yes, by others, no.  If you are used to programming real computers, then programming them is easier than the Arduino.  If you've never programmed anything for any purpose before in your life, then getting started with Arduino is less daunting than picking up a PHP, SQL and C/C++ manual.
3  Using Arduino / Programming Questions / Re: tiny84 .. strange "millis()" function results with interrupts on: July 08, 2014, 08:21:47 am
Please use code tags.  If you want help with a sketch, please include the whole sketch.

How is the ISR installed?  In particular, is it edge or level triggered?
4  Using Arduino / Project Guidance / Re: Transforming frequency inputs into commands on: July 07, 2014, 11:18:25 pm
K.  So a Raspberry Pie or maybe a real computer.  Not something an Arduino would excel at, it seems to me.
5  Using Arduino / Project Guidance / Re: UNO with SIM900 Quad-band GSM/GPRS Shield & a Ethernet Shield W5100 Micro-SD on: July 07, 2014, 10:27:21 pm
If the closed ethernet network has a real computer on it, I would personal want to use that to talk to the SIM900, not an arduino.  I wrote a SIM900 library for UNIX.  I know there's one for Raspberry Pie.

http://1474orchard.ca/projects/?x=entry:entry140523-140449
6  Using Arduino / Project Guidance / Re: Transforming frequency inputs into commands on: July 07, 2014, 10:22:08 pm
If the signal contains only one frequency at a time, you can feed it into a counter, sample that via a timer interrupt or timed loop, and have a good info what frequency is being fed in.  I think if you look in the forum for frequency counter projects you'll find something useful.

If the input is composed of multiple frequencies at once -- like DTMF tones or something -- then an FFT or maybe, cheaper computationally, a Goertzel algorithm approach, might be needed.  I'm a fan of the  Goertzel approach, if you know what frequencies you're looking for beforehand and just want to test if they're present or not.
7  Using Arduino / Programming Questions / Re: How to Shrinkify this code for a 433.92 Mhz receiver on: July 07, 2014, 10:06:57 pm
If you remove things from the CPP, you will have to get rid of the declaration in the .h also.

Just removing methods you don't use is unlikely to help much though, since the compiler and linker will do that automatically for the most part.
8  Using Arduino / Project Guidance / Re: Problem with outputting a voltage. on: July 07, 2014, 01:28:51 pm
One problem is that you are mixing float and integer types in ways that likely discard precision.  Make sure all the numeric constants are 1.0, not just 1.  vthresh should be "const float vthresh = 1.0", for example.  Mixing float and int without careful attention can easily lead to strange results.

9  Using Arduino / Programming Questions / Re: Voltage measurement on: July 07, 2014, 10:50:41 am
what code I should use to calibrate ADC output value ?

It's not so much a matter of code.  You want to have some debugging in there to spit out the ADC readings and calculation on the serial port.  Then hook up a 12V, 24V, 9V, what-have-you voltage to the input, measure the actual voltage with a meter and compare to the debug output of the running program.

If you have a lab power supply to work with, that would be an excellent way to generate different input voltages.  Otherwise, just use a pack of 9V batteries to generate 9V, 18V, ... 54V.  Since the 9V is "nominal" the actual voltage of two fresh batteries might be 19.23V or something.  You can measure this with a meter and compare to the value computed by the logic in your program.
10  Using Arduino / Programming Questions / Re: Voltage measurement on: July 07, 2014, 09:46:50 am
FWIW, I never go by the nominal values of my resistors but actually measure them.  So I might have:

Code:
const float R1 = 55820.0;
const float R2 = 4735.0;

Or whatever.  I also spend some time actually calibrating the ADC output values against measured voltage inputs to double check.
11  Using Arduino / Programming Questions / Re: PWM controll on: July 06, 2014, 04:02:41 pm
Please use code tags around your code.  Select it and press the "#" button.

You're going to want to use a variable to compute the motor speed rather than just setting it to a constant.  Maybe something like:

Code:
int MotorSpeed = 0, OldSpeed = 0;

void loop()
{
  while(Serial.available()>0)
  {
    myData=Serial.read();
  
    if(myData == 'w')
    {
        MotorSpeed += 1;
        if (MotorSpeed > 255)
            MotorSpeed = 255;
          Serial.print("Motor On speed="); Serial.println(MotorSpeed);
    }
    if(myData == 's')
    {
        MotorSpeed = 0;
        Serial.println("Motor Off speed=0");
    }
  }
  if (MotorSpeed != OldSpeed) {
      analogWrite(motorPin, MotorSpeed);
      OldSpeed = MotorSpeed;
  }
}
12  Using Arduino / Programming Questions / Re: How to Shrinkify this code for a 433.92 Mhz receiver on: July 06, 2014, 03:53:35 pm
I think you're going to have to slim down the RCSwitch library to make it fit.  It has code paths for multiple styles of OOK protocols, of which you likely only need one to work, so there's some fat to trim.

Also look at:

Code:
// Number of maximum High/Low changes per packet.
// We can handle up to (unsigned long) => 32 bit * 2 H/L changes per bit + 2 for sync
#define RCSWITCH_MAX_CHANGES 67

    /*
     * timings[0] contains sync timing, followed by a number of bits
     */
    static unsigned int timings[RCSWITCH_MAX_CHANGES]

That's 140 bytes right there.  Maybe in your case RCSWITCH_MAX_CHANGES can be smaller.
13  Using Arduino / Programming Questions / Re: Error creating .elf on: July 06, 2014, 03:34:26 pm
I have a class that contains an array of [8][1440] for a total of 11,520 bytes.

That's going to be a problem on a Mega.  You just don't have enough RAM to deal with that.  If the array is a static lookup table, you can put it in PROGMEM.  If it has to be RAM, it simply won't fit.  You may be able to get it down to one or two bits per valve.  Then it would be something like 1.4-2.8K and would fit in a Mega's RAM. (just)
14  Using Arduino / Programming Questions / Re: Multiple files project, ‘analogWrite’ was not declared in this scope on: July 06, 2014, 03:27:12 pm
You'll need to

Code:
#include "Arduino.h"

Depending on the IDE version, there can be some differences in what needs to be included.  By convention, you'll see something like:

Code:
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#include "pins_arduino.h"
#endif

Put this at the top of ex.cpp and see how that works.
15  Using Arduino / Programming Questions / Re: Progmem won't work with variable for index; only static values on: June 14, 2014, 11:36:32 pm
You'll have to read from flash twice.  Something like:

Code:
void Test()
{
  char *p;

  for(int x = 0; x < 3; x++)
  {
    p = pgm_read_word(&(progbytes[x]));
    for(int y = 0; y < 10; y++)
    {      
      byte var = pgm_read_byte(&(p[y]));
      Serial.print("x: ");
      Serial.print(x);
      Serial.print("    y: ");
      Serial.print(y);
      Serial.print("     ");
      Serial.println((char)var);
    }
  }
}
Pages: [1] 2 3 ... 58