Another source :
50Pieces/Lot JRC-21F 4100 3V DC 6 Pins Miniature PCB Relay Brand New
http://s.aliexpress.com/MNVv2myE
Another source :
50Pieces/Lot JRC-21F 4100 3V DC 6 Pins Miniature PCB Relay Brand New
http://s.aliexpress.com/MNVv2myE
@ServiceXp
Would you share the .stl file?
Greets
Stefan
I'm still waiting in germany, customs in this country have "Deutsche Gründlichkeit". Sticking their Nose in every bullshit ;-).
So still waiting .
Greets Stefan
Hi,
Thats a fact i'd. Never known,
Thanks for your help.
Stefan
Hi,
this ist the orginal example from this site, and so it works vor 5 relays.
"// Example sketch showing how to control physical relays.
// This example will remember relay state even after power failure.
#include <MySensor.h>
#include <SPI.h>
#define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define RELAY_2 4
#define RELAY_3 5
#define RELAY_4 6
#define RELAY_5 7
//#define RELAY_6 18
//#define RELAY_7 19
//#define RELAY_8 20
#define NUMBER_OF_RELAYS 5 // Total number of attached relays
#define RELAY_ON 1 // GPIO value to write to turn on attached relay
#define RELAY_OFF 0 // GPIO value to write to turn off attached relay
MySensor gw;
void setup()
{
// Initialize library and add callback for incoming messages
gw.begin(incomingMessage, AUTO, true);
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Relay", "1.0");
// Fetch relay status
for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
// Register all sensors to gw (they will be created as child devices)
gw.present(sensor, S_LIGHT);
// Then set relay pins in output mode
pinMode(pin, OUTPUT);
// Set relay to last known state (using eeprom storage)
digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
}
}
void loop()
{
// Alway process incoming messages whenever possible
gw.process();
}
void incomingMessage(const MyMessage &message) {
// We only expect one type of message from controller. But we better check anyway.
if (message.type==V_LIGHT) {
// Change relay state
digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
// Store state in eeprom
gw.saveState(message.sensor, message.getBool());
// Write some debug info
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
}
}
"
but not more.
On an Arduino Pro Mini
this sketch works for 6 Relays inkl. D8, i have changed to pro micro
an i used 2 different new ones same result, 5 Relays working -- externel power supply to the relays, arduino only needs to pull up or pull down.
bye
Stefan
thanks for your help
Ok, thanks
""// Example sketch showing how to control physical relays.
// This example will remember relay state even after power failure.
#include <MySensor.h>
#include <SPI.h>
//#define SPI_CE 9
//#define SPI_SS 10 // PB0, pin 8, Digital17
//#define SPI_MISO 14 // PB3, pin 11, Digital14
//#define SPI_MOSI 16 // PB2, pin 10, Digital16
//#define SPI_SCK 15 // PB1, pin 9, Digital15
//#define MySensor(uint8_t cepin = 9, uint8_t cspin = 10);
#define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define RELAY_2 4
#define RELAY_3 5
#define RELAY_4 6
#define RELAY_5 7
#define RELAY_6 18
#define RELAY_7 19
#define RELAY_8 20
#define NUMBER_OF_RELAYS 8 // Total number of attached relays
#define RELAY_ON 1 // GPIO value to write to turn on attached relay
#define RELAY_OFF 0 // GPIO value to write to turn off attached relay
//MySensor(uint8_t cepin = 9, uint8_t cspin = 10) gw;
MySensor gw;
void setup()
{
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(18, OUTPUT);
pinMode(19, OUTPUT);
pinMode(20, OUTPUT);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(18, HIGH);
digitalWrite(19, HIGH);
digitalWrite(20, HIGH);
//MySensor(uint8_t cepin=9, uint8_t cspin=10)
// Initialize library and add callback for incoming messages
gw.begin(incomingMessage, AUTO, true);
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Relay", "1.0");
// Fetch relay status
for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
// Register all sensors to gw (they will be created as child devices)
gw.present(sensor, S_LIGHT);
// Then set relay pins in output mode
pinMode(pin, OUTPUT);
// Set relay to last known state (using eeprom storage)
digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
}
}
void loop()
{
// Alway process incoming messages whenever possible
gw.process();
}
void incomingMessage(const MyMessage &message) {
// We only expect one type of message from controller. But we better check anyway.
if (message.type==V_LIGHT) {
// Change relay state
digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
// Store state in eeprom
gw.saveState(message.sensor, message.getBool());
// Write some debug info
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", New status: ");
Serial.println(message.getBool());
}
}
""
Hi,
ok i defined Relay 6,7,8 at A0,A1,A2, when i initial send a digitalwrite(high) or low within the sketch and uload that, it gone OK, but when want to change the states at runtime per radio, nothing changed but Relays 1 to 5 are ok.
example:
void setup()
{
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(18, OUTPUT);
pinMode(19, OUTPUT);
pinMode(20, OUTPUT);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(18, HIGH);
digitalWrite(19, HIGH);
digitalWrite(20, HIGH);
any idea ?
Bye Stefan
Hello,
does the Library Support using on Pro Micro Analog Inputs A0 A1 A2 A3
as Digital Output for More Relay steering up to 8 Relays ?
Greetings from Germany
Stefan