Show Posts
Pages: 1 ... 15 16 [17] 18
241  Forum 2005-2010 (read only) / Interfacing / Re: Comminication between Arduinos  - powerline or RF? on: November 12, 2009, 10:37:04 am
Quote
The simplest, cheapest way of communicating between arduinos is to use direct wiring and serial.

That  may be true if Arduinos are close of each other. But don't think that serial be practical if we have several Arduinos communicating with one master and they are located far a way from each other (say tens of meters of cable). Installing the cables is expensive and laborious  (and what if I want to move the coffee maker to an other room?) and serial does not fit very well in one to many communication.
242  Forum 2005-2010 (read only) / Interfacing / Comminication between Arduinos  - powerline or RF? on: November 12, 2009, 08:46:53 am
What do you think is the simplest and cheapest method for connecting two or more Arduinos? I am going to build a system for monitoring and controlling electric devices, say a coffee maker.  The architecture is something like:

Code:
Coffee maker
     |
     |
current sensor
relay
arduino slave
    |
    |
    |
Arduino master
   |
   |
   |
 PC

Arduino slave monitors the coffee maker (or any other electric device). There can be many slaves. It sends the status of the device (does it draw current) to an Arduino master, which transmit it to a PC.  PC is optional and meant for remote access. Arduino master has simple local user interface (lcd + some push buttons). The slave arduino controls a relay and it switches the power off/on if it receives a command from Arduino master to do so.

What do you think is the best (cheapest and simplest) way implement the communication between Arduinos? I thought that communication over power line would be natural choice because all the devices are connected to power lines. I know that X10 protocol implement some of the features I need, but the protocol is very limited, slow and X10 components a quite expensive in Europe.

Other alternatives that have crossed my mind include ethernet over powerline + ethernet shield and PLC UART http://www.sparkfun.com/commerce/product_info.php?products_id=9185, but they are all quite expensive and compilcated. If have started to doubt if power line communication is a viable alternative after all, and it would be better to go after RF communication like XBee.

Which would you prefer? Have you implemented power line communications between Arduinos and does it have any advantage over RF technologies like XBee?


243  Forum 2005-2010 (read only) / Interfacing / Internal 1.1V Aref on: November 02, 2009, 06:05:22 pm
Again one of these not so clever questions: If I use the internal  1.1V analog reference and connect an analog pin to voltage higher than 1.1V,  (up to 5V) it does not do any harm to my Arduino, does it? It just gives 1023 at voltage levels 1.1V - 5V, right?

(edit: typo)
244  Forum 2005-2010 (read only) / Interfacing / Re: Hall effect to measure DC: howto? on: October 29, 2009, 04:14:39 am
I got yesterday three of those: http://search.digikey.com/scripts/DkSearch/dksus.dll?Cat=1966573&k=398-1000-ND
They include ICs that levels the Vout to 0-5V and provide isoloation. They have holes you can put the wire through, but they are not split-core.
245  Forum 2005-2010 (read only) / Interfacing / Re: Hall effect to measure DC: howto? on: October 26, 2009, 04:29:13 am
Quote
Choose a sensor of which amp range matches your generator. For example, if the max. current from you generator is 6 amps DC, you may choose a unidirectional sensor that can sense currents from 0 to 10A. (or bidirectional from -10 to 10 if it is an AC generator). If you choose a sensor with too wide range (say from 0 to 100A), you loose resolution and accuracy.

It seems that "unidirection" does not always mean that the sensor is for DC only. But check the datasheet for the sensing range and what is the Vout value for I=0.
246  Forum 2005-2010 (read only) / Interfacing / Re: Hall effect to measure DC: howto? on: October 25, 2009, 05:09:49 pm
There are several kinds of Hall current sensors or current tranducers. You either connect the wire from the generator in series with the sensors input/output pins (e.g., primary current pins or terminal pins) or put the wire through the hole in the sensor.

Many of the sensors have ICs that do the conversion from current to voltage within given range, for example between 0-5V.  They have typically three pins for interfacing the uC: Vcc, GND and Vout. You connect Arduino's Vcc and GND to sensor's Vcc and GND. Sensor's Vout goes to Arduino's analog input. You may need to add resistors or/and capacitors, e.g., a capacitor between sensor's Vcc and GND. Check the datasheet for application diagrams.

Choose a sensor of which amp range matches your generator. For example, if the max. current from you generator is 6 amps DC, you may choose a unidirectional sensor that can sense currents from 0 to 10A. (or bidirectional from -10 to 10 if it is an AC generator). If you choose a sensor with too wide range (say from 0 to 100A), you loose resolution and accuracy.

For unidirectional sensors you get 0V from Vout at 0A, from bidirectional sersors you get 0-2.5V when I<0 and 2.5-5 when I>0.
The sensitivity of the sensor is given as mV/A, for example 100mV/A. (0.1V change in voltage from Vout means 1A change in current.)

Arduino has 10bit ADC which gives you values from 0 to 1023. If the sensor's sensitivity is 100mV/A and analogIn reading is 123, in the case of an unidirectional sensor the current is (5.0/(1024*0.1))*123 = 6A. For bidirectional: (5.0/(1024*0.1))*(123-512) = -18.99A.
247  Forum 2005-2010 (read only) / Interfacing / Re: PTC Thermistor? (actually NTC) Steinhart-hart on: October 29, 2009, 02:21:26 am
One clarification:
Quote
NTC ntc(pin, B, R0,order);

R0 is the resistance both of the divider resistor and the thermistor @25*C. If you need different values, you have to change the code a bit.
248  Forum 2005-2010 (read only) / Interfacing / Re: PTC Thermistor? (actually NTC) Steinhart-hart on: October 29, 2009, 01:05:05 am
Here is how I have done it. The purpose of the Sensor base class is to provide different kind of sensors (e.g, ntc10, ds18b20, smt16030) with a common interface. In my code I have an array of pointers to sensor instances which I call through the base class.

I use the B parameter equation, check http://en.wikipedia.org/wiki/Thermistor.
You have to know the sersor's B-value. If you don't know it, I guess you can start from 3950 which works for many NTC10 thermistors. Adjust it until the readings match with a known reference.

Code:
byte pin = 0;    
float B = 3950; // thermistors B-value
int R0=10000;  //  resistor value
int order = 0;   // 1 or 0 depending on which side the ground is
NTC ntc(pin, B, R0,order);

// convert the temperature. Returns temp in celsius * 10,
// if the temperate is 25*C, returns 250
int temp = ntc.updateTemp();
Serial.println(temp/10.0);


// return the last converted temp value. Doesn't do the conversion
int temp = ntc.getTemp();

Sensor.h:
Code:
#ifndef Sensor_h
#define Sensor_h

// pure virtual base class for temperature sensors
class Sensor
{
  public:
  virtual int getTemp() = 0;
  virtual int updateTemp() = 0;
  virtual int setCalib(int);
  virtual int getCalib();
};
#endif // Sensor_h

Sensor.cpp
Code:
#include "Sensor.h"
int Sensor::setCalib(int calib) { return 0; };
int Sensor::getCalib() { return 0; };

NTC.h:
Code:
#ifndef NTC_h
#define NTC_h

#include "WProgram.h"
#include "wiring.h"
#include "Sensor.h"


class NTC : public Sensor
{
 private:
  int temp;
  float B;
  int R0;
  float Ri;
 public:
  byte pin;
  int  calib;
  byte id;
  int order;
  
  // constructor,
  NTC(byte,float,int,int);
  
  // return temp value
  int getTemp();
  int updateTemp();
  
  int setCalib(int);
  int getCalib();
    
};
#endif // NTC_h

NTC.cpp
Code:
#include "NTC.h"
#include "math.h"
#include <EEPROM.h>


const float t0  = 298.15;

//NTC::t0 = 298.15; //+25C

NTC::NTC(byte pin=0, float B=0, int R0=0, int order=0)
{
  this->pin = pin;
  this->B = B;
  this->calib = 0;
  this->id = 0;
  this->R0 = R0;
  this->order = order;
  Ri = R0*exp(-B/t0);

}

int NTC::updateTemp()
{
  temp = 0;
  int val = analogRead(pin);
  if (order == 1) {
      val = 1023 - val;
  }
  float R = (float) val;
  R *= R0;
  R /= (1023 - val);

  float Ri = R0*exp(-B/t0);
  float t = B/log(R/Ri)-273.15;
  temp = 10*t;
  return temp;
}


int NTC::getTemp()
{
  return temp;
}

int NTC::setCalib(int calib)
{
  this->calib = calib;
  return calib;
};

int NTC::getCalib()
{
  return calib;
};
249  Forum 2005-2010 (read only) / Interfacing / Re: Possible? receive sms in arduino+execute sth on: October 26, 2009, 03:23:49 pm
That should be doable. One solution is to buy a MAX3323 driver/receiver [http://www.arduino.cc/en/Tutorial/ArduinoSoftwareRS232] and a GSM modem with RS232 interface. (Or is it possible to USB RS232 adapter in Arduino's USB port?)  You can poll incoming messages in Arduino using AT-commands. It works both ways, so Arduino can send a SMS to your mobile when the coffee is ready.
250  Forum 2005-2010 (read only) / Interfacing / Re: 12v Relay and arduino. on: October 08, 2009, 06:27:02 am
I recommend using opto-isolator instead of transistor, at least if you are not exactly sure of the wiring.  That way you will have smaller risk of driving 12V to Arduino pins.  It also prevents the voltage peak that the coil generates when you switch off the relay from frying Arduino.

You may still want to use some transient supression method, e.g., a diode over the relay coil.
251  Forum 2005-2010 (read only) / Interfacing / Re: When to use capacitor on: October 15, 2009, 04:37:59 pm
Thanks a lot for a fast reply! I browsed through your tutorial and will read it again with more thought. I was already thinking of placing a 100uF electrolytic capacitor between arduino's +5V and GDN,  but after reading you tutorial I guess I'll try smaller capacitors for individual IC.

The reason I thought I need to consider capacitors is that the NTC-10 temperature sensors give a lot more jitter in the circuit than they did when I tested them alone with Arduino. There aren't  many IC in my circuit (SMT16030 and DS18B20 temp. sensors and a current sensor) so it shouldn't be too much trouble.
252  Forum 2005-2010 (read only) / Interfacing / When to use capacitor on: October 15, 2009, 02:58:46 pm
I am total n00b in electronics. I have so far experimented with Arduino and electronics on one project (controlling/monitoring the heating system of my house). The circuit built on solderless breadbord comprise of different types of temp sensors, optos for driving relays, diodes, an IC for measuring AC/amps, resistors, etc. There isn't, however, a single capacitor in the whole circuit.

I know i theory how capacitors work and that they can be used e.g. to filter or smooth voltage peaks/drops. But in practice I have no idea
when I should use a capacitor, what kind of capacitors (cheramic, electrolytic) I should use and how to calculate the right size for the capacitor.

Are the any simple rules of thumb of where and what kind of capacitors I should use?
253  Forum 2005-2010 (read only) / Interfacing / Re: Dallas Temperature sensor - how to make it faster? on: October 08, 2009, 06:59:07 am
Was it so that DS18S20 has 9 bit resolution? Then the multiplier is not 0.0625 but 0.5 (if I recall it correctly).  0.0625 is for 12 bit resolution.

You could try instead:

Code:
Tc_100 = 50 * TReading; // multiply by 100 * 0.5
254  Forum 2005-2010 (read only) / Exhibition / Re: RFC: serial packet-oriented protocol for arduino on: November 17, 2009, 10:02:13 am
I think your protocol specification is good and the implementation in your oscope project seemed very professional when I looked at it some time ago.  I will probably use it in one project myself.

I am not quite sure I we need a formal RFC process here but please publish the code and protocol spec in Arduino Playground.
255  Forum 2005-2010 (read only) / Exhibition / Re:  Using Potentiometer to Control LED Blink Speed on: April 21, 2010, 08:08:37 am
This is a slightly simplified version of  WRonX's example.  I haven't actually tested it.

Code:
int potpin = 0;  
int ledpin = 13;
int val;    
int lastChange; // the time of changing pin state
int state = HIGH;

void setup()
{
  pinMode(ledpin, OUTPUT);
  lastChange = millis();  // ledpin state changed NOW
  digitalWrite(ledpin, state);
}

void loop()
{
  val = map(analogRead(potpin), 0, 1023, 500, 5);  // read the value every time
  if (lastChange + val <= millis())
  {
       state = !state; // invert led's state
       lastChange = millis();  // ledpin state changed NOW
       digitalWrite(ledpin, state);
  }
  // you can add other functionality here ...
}  
Pages: 1 ... 15 16 [17] 18