Posted by: admin - 11-28-2024, 11:40 AM - Forum: F24
- No Replies
Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* This program controls a 24-channel relay board via two PCF8575 I/O expanders.
* It sequentially turns on each relay and then turns them off in a loop.
*
* Pin Definitions:
* - SDA: GPIO 8
* - SCL: GPIO 18
*
* Delay Time:
* - 200 milliseconds between switching relays
*/
#include <Wire.h> // Include the Wire library for I2C communication
#include <PCF8575.h> // Include the PCF8575 library to control the I/O expander
#define SDA 8 // Define the SDA pin
#define SCL 18 // Define the SCL pin
#define DELAY_TIME 200 // Define the delay time in milliseconds
// Set I2C addresses of the PCF8575 modules
#define I2C_ADDRESS_R1 0x25 // I2C address of the first PCF8575 module
#define I2C_ADDRESS_R2 0x26 // I2C address of the second PCF8575 module
PCF8575 pcf8575_R1(I2C_ADDRESS_R1); // Create a PCF8575 object for the first module (for relays 9-24)
PCF8575 pcf8575_R2(I2C_ADDRESS_R2); // Create a PCF8575 object for the second module (for relays 1-8)
void setup() {
// Initialize I2C communication
Wire.begin(SDA, SCL); // SDA on GPIO 8, SCL on GPIO 18 (according to your board's configuration)
// Initialize serial communication for debugging (optional)
Serial.begin(115200);
Serial.println("PCF8575 Relay Control: Starting...");
// Initialize the PCF8575 modules
pcf8575_R1.begin();
pcf8575_R2.begin();
// Turn off all relays initially (set all pins HIGH)
for (int i = 0; i < 16; i++) {
pcf8575_R1.write(i, HIGH); // Set relays 9-24 to OFF (assuming HIGH means OFF for relays)
pcf8575_R2.write(i, HIGH); // Set relays 1-8 to OFF (assuming HIGH means OFF for relays)
}
}
void loop() {
// Sequentially turn on each relay (1-24)
// First control the relays on the second PCF8575 (relays 1-8, corresponding to pins 8-15)
for (int i = 8; i < 16; i++) {
pcf8575_R2.write(i, LOW); // Turn on the relay at pin i (LOW means ON for the relay)
delay(DELAY_TIME); // Wait for DELAY_TIME milliseconds
}
// Then control the relays on the first PCF8575 (relays 9-24)
for (int i = 0; i < 16; i++) {
pcf8575_R1.write(i, LOW); // Turn on the relay at pin i (LOW means ON for the relay)
delay(DELAY_TIME); // Wait for DELAY_TIME milliseconds
}
// Sequentially turn off each relay (1-24)
// First control the relays on the second PCF8575 (relays 1-8, corresponding to pins 8-15)
for (int i = 8; i < 16; i++) {
pcf8575_R2.write(i, HIGH); // Turn off the relay at pin i (HIGH means OFF for the relay)
delay(DELAY_TIME); // Wait for DELAY_TIME milliseconds
}
// Then control the relays on the first PCF8575 (relays 9-24)
for (int i = 0; i < 16; i++) {
pcf8575_R1.write(i, HIGH); // Turn off the relay at pin i (HIGH means OFF for the relay)
delay(DELAY_TIME); // Wait for DELAY_TIME milliseconds
}
}
Posted by: admin - 11-28-2024, 11:33 AM - Forum: News
- No Replies
The SIM7600E-L1C is a versatile and cost-effective 4G LTE module that integrates multiple communication functionalities, making it suitable for a wide range of IoT and M2M applications. Developed by KinCony, this module provides robust connectivity and high-speed data transmission capabilities, ensuring seamless integration into IoT ecosystems.
USB-C: connect with SIM7600E's USB port , debug by AT command
pin-S (SLEEP): set module to SLEEP mode
pin-G (GROUND): GND
pin-V (VCC): power supply DC 5-10V
pin-K (KEY): power on/off module
pin-T (TXD): send data
pin-R (RXD): receive data
pin-G (GROUND): GND
pin-RST: SIM7600 chip RESET pin
power chip: AZ1084CD
IPEX2: 4G antenna
IPEX4: GPS antenna
SIM card: Drawer SIM card holder (NANO)
TP1: DC4V power test point
SIM7600 network LED indicator: if blink means network registration successful
1: LED always ON: Searching network/call connect
2: LED 200ms ON, 200ms OFF: Data transmit
3: LED 800ms ON, 800ms OFF: Registered network
4: LED OFF: power off/Sleep
FPC1(16 pins) extender pins define:
Hello, can I configure settings for your presence sensor in esphome: https://www.aliexpress.com/item/1005006030673158.html
Or should I configure using remote?
Also, which presence sensor component does it use? LD2410? Thank you.
I am looking for confirmation before purchase that I can use this board as I plannig to.
So my plan is to use this board for central heating management. I attached a picture how does the setup looks so far.
I will use Home assistant and esphome.
As you can see I have
- 4 24V AC valve.
- 5 temperature sensor (ds18B20)
- analog pressure sensor (SEN0257)
- leak sensor (just a basic contact sensor)
- opentherm adapter (this one)
- for network connection I will use ethernet
Do I need an additonal power supply (9-24V DC) to power my board? Or it can be power from 5V?
4x 24V AC valve: This is easy, They can go to the 4 relay. I think I will use the normaly closed terminals, in case of a board issue, the heating should not be affected. There is a separate 24V AC power supply, which only responsible for powering these valves.
5 temperature sensor (ds18B20): As far as I know these sensors has uniq id and can use the same pin, with one wire protocol. I can use the 3.3V output and ground from the board, and GPIO01 for the onewire.
analog pressure sensor (SEN0257): This sensor needs 5V can I get 5V out of this board? The output of this sensor is analog, so I can use AI1 for that.
leak sensor: This is just a digital sensor this is trivial too, it can go DI1 and ground.
opentherm adapter: This board need 3.3V, this I can get from the board. But also needs 2 free IO. Is there an IO I can repurpose in this case? There is only one free "bare" gpio left which is this case GPIO2. All other looks like has a special purpose.
I am really excited for this project and looking forward for responses. Thanks in advance.