Show Posts
Pages: [1] 2 3
1  Using Arduino / General Electronics / General help on "MY ARDUINO IS REBOOTING WHEN..." on: June 11, 2014, 07:36:52 am
Tired of reading lots of posts like
Quote
"Arduino rebooting when I switch relay / motor / coil"
etc. here I like to post some general remarks.

If switching off/on seems to be the problem, then solve it like below. If you plan to get more juice out of your Arduino outputs (30mA each) then you probably have to increase C2 and choose a appropriate coil L1 for that. In many cases there can also a smaller diode be choosen. The diode prevents the C1 and C2 from beeing discharged from the power part and avoids "transients" (which is the appropriate word for the whole problem).

An other reason for rebooting maybe the internal watchdog, but normally people who use it know what they do  smiley-lol
2  Using Arduino / General Electronics / Re: Simple Relay+LED design isn't so simple on: June 11, 2014, 07:05:40 am
Please post a schematic every time when you want good answers. fritzing http://www.fritzing.org/ has breadboard and schematics functionality combined... 
3  Using Arduino / General Electronics / Re: low voltage cutout switch/relay to prevent killing batteries?? on: June 10, 2014, 02:16:46 am
Did you know that there are special chips called "supervisors"? Simply look here: https://www.google.de/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=automotive+supervisor+battery+-jobs+-plant
I would prefer the LTC2960 from LT. It's current consumption is below 1µA... In general, you also have to consider the self-discharging effect of a battery which is several times more. More Information is  to be found here: http://batteryuniversity.com/learn/article/elevating_self_discharge
As i know LT, you shurely will get free samples at http://www.linear.com/samples/LTC2960
4  Using Arduino / Programming Questions / Re: water tank controller on: May 17, 2014, 08:13:48 am
Please consider that switches (when used real contacts) bounce and therefore you probably have to debounce them.
5  Using Arduino / Programming Questions / Re: LiquidCrystal lcd(...) functionality on: May 16, 2014, 04:12:43 am
So here is the whole thing with the LCD pins stored in the EEPROM  smiley-cool
Code:
#include <EEPROMex.h>
#include <LiquidCrystal.h>

const int memBase    = 0;
uint16_t EEVer         = memBase;     // Version in 16 bit
uint16_t EELcdRS       = memBase + 2; // --> LCD pin RS
uint16_t EELcdEN       = EELcdRS + 1; // --> LCD pin EN
uint16_t EELcdD4       = EELcdEN + 1; // --> LCD pin D4
uint16_t EELcdD5       = EELcdD4 + 1; // --> LCD pin D5
uint16_t EELcdD6       = EELcdD5 + 1; // --> LCD pin D6
uint16_t EELcdD7       = EELcdD6 + 1; // --> LCD pin D7

uint8_t  LcdRS,       // LCD pin RS
         LcdEN,       // LCD pin EN
         LcdD4,       // LCD pin D4
         LcdD5,       // LCD pin D5
         LcdD6,       // LCD pin D6
         LcdD7;       // LCD pin D7
         
LiquidCrystal lcd(0,0,0,0,0,0);

void setup(){
  LcdRS = EEPROM.readByte(EELcdRS);    // LCD pin RS
  LcdEN = EEPROM.readByte(EELcdEN);    // LCD pin EN
  LcdD4 = EEPROM.readByte(EELcdD4);    // LCD pin D4
  LcdD5 = EEPROM.readByte(EELcdD5);    // LCD pin D5
  LcdD6 = EEPROM.readByte(EELcdD6);    // LCD pin D6
  LcdD7 = EEPROM.readByte(EELcdD7);    // LCD pin D7
 
  LiquidCrystal lcd1(LcdRS, LcdEN, LcdD4, LcdD5, LcdD6, LcdD7);
  lcd = lcd1;  // <-- this is the matchwinner!               

  lcd.begin(16,2);

  lcd.print("hello world");
}

void loop(){}
6  Using Arduino / Programming Questions / Re: LiquidCrystal lcd(...) functionality on: May 16, 2014, 01:01:36 am
Finally, I found a way to do it by myself. So I proudly present it to all of you, folks smiley-wink
Code:
#include <LiquidCrystal.h>

void setup(){}
uint8_t l1, l2, l3, l4, l5, l6 = 0;
boolean runOnce, printOnce = true;
LiquidCrystal lcd(l1, l2, l3, l4, l5, l6);
void loop(){
  if (runOnce){
    l1=8; l2=9; l3=4, l4=5; l5=6;l6=7;
    LiquidCrystal lcd1(l1, l2, l3, l4, l5, l6);
    lcd = lcd1;
    lcd.begin(16,2);
    runOnce=false;
  }
  if (printOnce){
    lcd.print("hello world");
    printOnce=false;
  }
}
7  Using Arduino / Programming Questions / Re: LiquidCrystal lcd(...) functionality on: May 15, 2014, 12:17:52 pm
But how? In pascal I would look if lcd^ equals nil. How do I the same in C++?
My question meant if I could find out if lcd is not yet defined. If it wouldn't I could do the initialization only once.
8  Using Arduino / Programming Questions / Re: Blinking LED on: May 15, 2014, 10:28:06 am
Debouncing should be done in a while() slope and not by only reading the input once. I remember that I once used delay(125) for good results.
More remarks:
  • Why don't u use pinMode(2, INPUT_PULLUP) you need only the button between pin and ground (assumed you used an external resistor to 5V), so you use the internal one
  • A construct like (val == LOW) && (old_val == HIGH) works, but could be done (val != old_val) in a smarter way, couldn't it? When you will be able to write more complex programs, you will like more "readable" code
  • Try to use digitalWrite(13, (stateOfLED == 1)) instead of that if ... else construct
For more ideas study the lower part of http://arduino.cc/en/Reference/Constants
9  Using Arduino / Programming Questions / Re: LiquidCrystal lcd(...) functionality on: May 14, 2014, 05:03:49 pm
If I do it so
Code:
  uint8_t lcd1 = 2;
  uint8_t lcd2 = 3;
  uint8_t lcd3 = 4;
  uint8_t lcd4 = 5;
  uint8_t lcd5 = 6;
  uint8_t lcd6 = 7;
  boolean runOnce = true;
 
void loop()
{
//  LiquidCrystal lcd(lcd1, lcd2, lcd3, lcd4, lcd5, lcd6);
  if (runOnce){
  LiquidCrystal lcd(lcd1, lcd2, lcd3, lcd4, lcd5, lcd6);
   lcd1 = 3;
   lcd2 = 2;
   lcd.begin(16, disp_zeilen);              // start the library
   lcd.createChar(1, la);
   lcd.createChar(2, ra);
   lcd.createChar(3, bell);
   runOnce = false;
  }
...
  lcd.setCursor(0,0);
 
I get "lcd" was not declared in this scope when the compiler comes to the lcd.setCursor()
But it seems to get into the right direction.
10  Using Arduino / Programming Questions / Re: LiquidCrystal lcd(...) functionality on: May 14, 2014, 04:43:43 pm
But how? In pascal I would look if lcd^ equals nil. How do I the same in C++?
11  Using Arduino / Programming Questions / Re: LiquidCrystal lcd(...) functionality on: May 14, 2014, 04:35:05 pm
Now I tried
Code:
  uint8_t lcd1 = 2;  // wrong value for testing overwrite
  uint8_t lcd2 = 3;  // wrong value for testing overwrite
  uint8_t lcd3 = 4;
  uint8_t lcd4 = 5;
  uint8_t lcd5 = 6;
  uint8_t lcd6 = 7;
  boolean runOnce = true;
 
void loop()
{
  LiquidCrystal lcd(lcd1, lcd2, lcd3, lcd4, lcd5, lcd6);
  if (runOnce){
   lcd1 = 3;         // load the right value
   lcd2 = 2;        // load the right value
   lcd.begin(16, disp_zeilen);              // start the library
   lcd.createChar(1, la);  // upload 3 user chchars
   lcd.createChar(2, ra);
   lcd.createChar(3, bell);
   runOnce = false;
  }
...
It seems to work, but the LCD flickers.  smiley-confuse
12  Using Arduino / Programming Questions / LiquidCrystal lcd(...) functionality on: May 14, 2014, 02:41:58 pm
Hi, maybe I was wrong posting it in the LCD forum part  smiley-roll
Anyway, I got no answer there...
Hi @all,
is there anybody who can explain me the real functionality of that function? As far I understand
// select the pins used on the LCD panel
  LiquidCrystal lcd(3, 2, 4, 5, 6, 7);

is a kind of standard (I use that pins and it also works in reality).

Now I tried in the declaration part to do it like this:
 uint8_t lcd1 = 3;
  uint8_t lcd2 = 2;
  uint8_t lcd3 = 4;
  uint8_t lcd4 = 5;
  uint8_t lcd5 = 6;
  uint8_t lcd6 = 7;
  LiquidCrystal lcd(lcd1, lcd2, lcd3, lcd4, lcd5, lcd6);

It also works, even when the lcd1..6 aren't constants...

So I intended to store these 6 values in EEPROM and get their values from there later on. I just wanted more flexibility because I have different hardware using different Arduinos (Uno, Nano) in different configs.
But it doesn't work if I initialize the values later (or just modify the predefined ones). Using LiquidCrystal(...) in the setup() function doesn't work either, because then it's unknown in loop().
Is there any possibility to use such a flexible configuration?
13  Using Arduino / General Electronics / Re: 25kHz PWM signal to analog voltage (DC) using low-pass filter: Weird output on: May 14, 2014, 01:22:14 pm
This is a real low pass filter case.
You have to consider that there are several influences... one importamt point is that you should not simply charge the capacitor, you also have to discharge it...
The complexity is well discussed here: http://electronics.stackexchange.com/questions/34843/how-determine-the-rc-time-constant-in-pwm-digital-to-analog-low-pass-filter
14  Using Arduino / General Electronics / Re: Combine TL431 voltage shunt with 555 timer when lighting "power low" LED? on: May 14, 2014, 01:12:52 pm
I suggest to use a simple µpower comparator (e.g. http://www.ti.com/lsds/ti/amplifiers-linear/comparator-products.page#p358min=0.9;2.2&p358max=5;5.5&p480=1;1)
Circuitry that way below (R2 and R3 you have to recalculate to your needs)
15  Using Arduino / General Electronics / Re: opto-isolator with HT16k33 on: May 14, 2014, 12:45:49 pm
If your purpose is just seeing the LED shine, then 1ms is a plenty and thy parts are 300 times faster.
Pages: [1] 2 3