// Let the IDE point to the Souliss framework#include "SoulissFramework.h"
// Configure the framework#include "bconf/StandardArduino.h" // Use a standard Arduino#include "conf/ethW5100.h" // Ethernet through Wiznet W5100#include "conf/Gateway.h" // The main node is the Gateway, we have just one node#include "conf/usart.h" // USART / RS485 transceiver#include "conf/IPBroadcast.h" // Use IP Broadcast Communication
#include <OneWire.h> #include <DallasTemperature.h>
// Include framework code and libraries#include <SPI.h>#define USARTDRIVER_INSKETCH#define USART_TXENABLE 1#define USART_TXENPIN 5#define USARTDRIVER Serial
/*** All configuration includes should be above this line ***/ #include "Souliss.h"
#define TEMPERATURE 0 // This is the memory slot used for the execution of the logic in network_address1#define DEADBAND 0.05 // Deadband value 5%
// Define the network configuration according to your router settingsuint8_t ip_address[4] = {192, 168, 80, 190};uint8_t subnet_mask[4] = {255, 255, 255, 0};uint8_t ip_gateway[4] = {192, 168, 80, 1};#define myvNet_address ip_address[3] // The last byte of the IP address (77) is also the vNet address
#define ONE_WIRE_BUS 6
OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire);float Temp1;
void setup(){ Initialize();
// Get the IP address from DHCP SetIPAddress(ip_address, subnet_mask, ip_gateway); SetAsGateway(myvNet_address); // Define the architecture SetAddress(0xAB01, 0xFF00, 0x0000); // set this node as IP supernode SetAddress(0xCE01, 0xFF00, 0x0000); // set this node as USART supernode. SetAsPeerNode(0xD002,1); Set_Thermostat(TEMPERATURE); // Set a logic for the thermostat // Define output pins pinMode(2, OUTPUT); // Heater (ON/OFF) //pinMode(3, OUTPUT); // Fan 1 //pinMode(4, OUTPUT); // Fan 2 //pinMode(5, OUTPUT); // Fan 3}
void loop(){ // Here we start to playsensors.requestTemperatures();Temp1 = sensors.getTempCByIndex(0); EXECUTEFAST() { UPDATEFAST(); // Execute the code every 11 time_base_fast FAST_110ms() { // The logic is executed faster than the data acquisition just to have a // prompt answer to the user commands, but the real rate is defined by // the temperature measure rate. // Compare the setpoint from the user interface with the measured temperature Logic_Thermostat(TEMPERATURE); // Start the heater and the fans nDigOut(2, Souliss_T3n_HeatingOn, TEMPERATURE); // Heater //nDigOut(3, Souliss_T3n_FanOn1 , TEMPERATURE); // Fan1 //nDigOut(4, Souliss_T3n_FanOn2 , TEMPERATURE); // Fan2 //nDigOut(5, Souliss_T3n_FanOn3 , TEMPERATURE); // Fan3 // We are not handling the cooling mode, if enabled by the user, force it back // to disable if(mOutput(TEMPERATURE) & Souliss_T3n_CoolingOn) mOutput(TEMPERATURE) &= ~Souliss_T3n_CoolingOn; } // Execute the code every 101 time_base_fast FAST_910ms() { // Acquire temperature from the microcontroller ADC ImportAnalog(TEMPERATURE+1,&Temp1); //AnalogIn(A0, ANALOGDAQ+1, 0.04, -10); // The raw data is 0-1024, scaled as -10 to +30 Celsius } // Process data communication FAST_GatewayComms(); } }
/************************************************************************** Souliss - Bridge WiFi to RS485 This is the basic example, create a software push-button on Android using SoulissApp (get it from Play Store) and bridge to an RS485 peer. Load this code on ESP8266 board using the porting of the Arduino core for this platform. ***************************************************************************/
// Let the IDE point to the Souliss framework#include "SoulissFramework.h"
// Configure the framework#include "bconf/MCU_ESP8266.h" // Load the code directly on the ESP8266#include "conf/SuperNode.h"#include "conf/usart.h" // USART / RS485 transceiver#include "conf/IPBroadcast.h"
// **** Define the WiFi name and password ****#define WIFICONF_INSKETCH#define WiFi_SSID "ZOOOOOM2"#define WiFi_Password "xxxxxxx"
// Include framework code and libraries#define USARTDRIVER_INSKETCH#define USART_TXENABLE 1#define USART_TXENPIN 0#define USARTDRIVER Serial
#include <ESP8266WiFi.h>#include <EEPROM.h>
/*** All configuration includes should be above this line ***/ #include "Souliss.h"/*uint8_t ip_address[4] = {192, 168, 80, 181};uint8_t subnet_mask[4] = {255, 255, 255, 0};uint8_t ip_gateway[4] = {192, 168, 80, 1};#define myvNet_address ip_address[3] */
// This identify the number of the LED logic//#define LL1 0 //#define LL1bright 1
// **** Define here the right pin for your ESP module **** //#define LL1OUT 4
void setup(){ Initialize(); // Connect to the WiFi network and get an address from DHCP GetIPAddress(); SetAsGateway(myvNet_dhcp); // Set this node as gateway for SoulissApp
// This is the vNet address for this node, used to communicate with other // nodes in your Souliss network SetAddress(0xAB02, 0xFF00, 0xAB01); SetAddress(0xD001, 0xFF00, 0x0000); // Set_DimmableLight(LL1); // Define a simple LED light logic //pinMode(LL1OUT, OUTPUT); // Use pin as output }
void loop(){ // Here we start to play // Here we handle here the communication with Android FAST_BridgeComms(); //FAST_PeerComms(); }
// Let the IDE point to the Souliss framework#include "SoulissFramework.h"
// Configure the framework#include "bconf/StandardArduino.h" // Use a standard Arduino#include "conf/usart.h" // USART
// Include framework code and libraries#define USARTDRIVER_INSKETCH#define USART_TXENABLE 1#define USART_TXENPIN 13#define USARTDRIVER Serial
#include "Souliss.h"
// This identify the number of the LED logic#define LL1 0#define LL1OUT 7#define LL1BTN 8
void setup(){ Initialize(); // Set network parameters SetAddress(0xD002, 0xFF00, 0xD001);
Set_SimpleLight(LL1); // Define a simple LED light logic pinMode(LL1OUT, OUTPUT); // Use pin as output }void loop(){ EXECUTEFAST() { UPDATEFAST(); FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds DigIn(LL1BTN, Souliss_T1n_ToggleCmd, LL1); Logic_SimpleLight(LL1); DigOut(LL1OUT, Souliss_T1n_Coil, LL1); } }
FAST_PeerComms();
START_PeerJoin();}
Luca
I cannot get bridge working too.. My idea is that is requiring a rs485 3.3v tranceiver and not 5v tranceiver. I haven't tried it out because i've only 5v rs485 tranceiver .. have you checked this thing ?
Luca
--
You received this message because you are subscribed to a topic in the Google Groups "souliss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/souliss/bdY8gjADi8Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/souliss/7ee67e36-3cca-4a62-b54b-44387ae0f98d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Luca,I have done multiple tests, based on 'barebone' ESP, a ESP201 and an ESP12 modules. On 2 of the pcb's i created i have used level shifters to go from the 3.3 to 5v logic. No luck on them eighter.Grtz,Stef
Op do 26 apr. 2018 23:53 schreef Luca Calcaterra <calcate...@gmail.com>:
I cannot get bridge working too.. My idea is that is requiring a rs485 3.3v tranceiver and not 5v tranceiver. I haven't tried it out because i've only 5v rs485 tranceiver .. have you checked this thing ?
Luca
--
You received this message because you are subscribed to a topic in the Google Groups "souliss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/souliss/bdY8gjADi8Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to souliss+unsubscribe@googlegroups.com.
Hi Stef,
if you have a flooding you can try using M1 instead of M3 for the WiFi communication. M3 is broadcast based rather M1 is unicast based.
Dario.