Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Iboard - Cheap Single board Ethernet Arduino with Radio

Iboard - Cheap Single board Ethernet Arduino with Radio

Scheduled Pinned Locked Moved Hardware
iboard
74 Posts 27 Posters 59.0k Views 9 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • greglG gregl

    @hugob - Finally got to try this last night late...Success!

    I did also need to add to the EthernetGateway.ino this line to load the Softspi libs...

    #include <DigitalIO.h>     <-added this too!
    #include <SPI.h>  
    #include <MySensor.h>
    #include <MyGateway.h>  
    #include <stdarg.h>
    

    I also needed to compile it under a newer IDE version due to memory..I used 1.6.5.

    H Offline
    H Offline
    hugob
    wrote on last edited by
    #49

    @gregl
    Good to hear that you can confirm that this is working. My unmodified IBoard gateway is working for months now without problems. But as I said in some other topic, this board needs a decent power supply.
    So all you need for a MySensors Ethernet gateway is this board, a NRF24L01 Radio that plugs in into this board, and a power supply. No mess with cables like in http://www.mysensors.org/build/ethernet_gateway. This board has 7 IO ports in case you want the leds. For $17.50 this is a no brainer.

    1 Reply Last reply
    1
    • H Offline
      H Offline
      hugob
      wrote on last edited by
      #50

      OK, I did forget some minor drawback. You need a FTDI adapter to program this IBoard from the Arduino UI.

      1 Reply Last reply
      0
      • sowardS Offline
        sowardS Offline
        soward
        wrote on last edited by
        #51

        I'm using this as a gateway w/ 1.5 also with no issue. I do have the LEDs hooked up as well, using an oversized 'recovered' power supply and the PA+LNA radio with no problems. All I need is a nice case...

        DwaltD 1 Reply Last reply
        0
        • 5546dug5 Offline
          5546dug5 Offline
          5546dug
          wrote on last edited by
          #52

          My iboard gw is up and running so far so good!

          Using the basic sketch with no LEDs

          Question I see only A0 to A5 I/o s where or how can I use t he sketches pins d6 -d9 pins?

          I printed the my sensors 3d stl file for the gw and it fits great, but there are the holes for the 3 LEDs and re include button .

          Any help would be good maybe just a senior moment eh?

          1 Reply Last reply
          0
          • sowardS soward

            I'm using this as a gateway w/ 1.5 also with no issue. I do have the LEDs hooked up as well, using an oversized 'recovered' power supply and the PA+LNA radio with no problems. All I need is a nice case...

            DwaltD Offline
            DwaltD Offline
            Dwalt
            wrote on last edited by
            #53

            @soward said:

            All I need is a nice case...

            Print one

            Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

            1 Reply Last reply
            0
            • F Offline
              F Offline
              Fabien
              wrote on last edited by
              #54

              Switch today to MySensors 1.5 without any problem. Easy to setup softspi with MyConfig.h

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Fabien
                wrote on last edited by
                #55

                And test OTA with a sensebender, work fine ! :smiley:

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  hugob
                  wrote on last edited by
                  #56

                  @5546dug

                  In the original sketch, you map a variable to a Dn pin. E.g. INCLUSION_MODE_PIN is mapped to pin 3.
                  The iBoard has no digital ports (Dn) on a connector, but only analog ports (An). Luckily, the analog ports can also be used as digital ports. The modified sketch maps the variables that were mapped to a Dn port in the oririginal sketch, to an An port in the modified sketch. This is the list:

                  Original
                  INCLUSION_MODE_PIN 3 // Digital pin used for inclusion mode button
                  RADIO_ERROR_LED_PIN 7 // Error led pin
                  RADIO_RX_LED_PIN 8 // Receive led pin
                  RADIO_TX_LED_PIN 9 // the PCB, on board LED

                  Modified
                  INCLUSION_MODE_PIN 14 // A0 Digital pin used for inclusion mode button
                  RADIO_ERROR_LED_PIN 15 // A1 Error led pin
                  RADIO_RX_LED_PIN 16 // A2 Receive led pin
                  RADIO_TX_LED_PIN 17 // A3 the PCB, on board LED

                  So for the iBoard, the receive LED has to be connected to pin 16 (A2). Etc.

                  If you carefully look at the code, you will notice that also RADIO_SPI_SS_PIN changed from 6 to 8. That is because the header for the radio chip on the iBoard is connected to a different Arduino pin on the iBoard, than it is on the wiring diagram of the original gateway diagram. But this is just an internal issue. It should not bother you if you build the gateway.

                  1 Reply Last reply
                  0
                  • 5546dug5 Offline
                    5546dug5 Offline
                    5546dug
                    wrote on last edited by
                    #57

                    @hugob Thanks

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      envagyok
                      wrote on last edited by
                      #58

                      Hi Guys!
                      I have got a Wborad Ex board with built in wifi (rak410) from itead.
                      http://wiki.iteadstudio.com/Wboard_Ex

                      Unfortunately I can not find anywhere arduino code that would work of the board with wifi.
                      Does anyone have the same board and could possibly help?

                      Itead said it works on this demo, but without success .
                      http://blog.iteadstudio.com/basic-testtutorial-for-itead-wifi-shield-rev2-by-david-morphett/

                      Thanks:
                      Gabor

                      hekH 1 Reply Last reply
                      0
                      • E envagyok

                        Hi Guys!
                        I have got a Wborad Ex board with built in wifi (rak410) from itead.
                        http://wiki.iteadstudio.com/Wboard_Ex

                        Unfortunately I can not find anywhere arduino code that would work of the board with wifi.
                        Does anyone have the same board and could possibly help?

                        Itead said it works on this demo, but without success .
                        http://blog.iteadstudio.com/basic-testtutorial-for-itead-wifi-shield-rev2-by-david-morphett/

                        Thanks:
                        Gabor

                        hekH Offline
                        hekH Offline
                        hek
                        Admin
                        wrote on last edited by
                        #59

                        @envagyok

                        Maybe not the answer you want, but if you want a verified wifi-gateway solution, have a look at this:
                        http://www.mysensors.org/build/esp8266_gateway

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          TommySharp
                          wrote on last edited by
                          #60

                          I know this is a basic question but what do I need to buy to program this using USB from my PC? So far I've just tinkered with Nanos which have a usb port on it.... An ebay link would be great!

                          korttomaK DwaltD 2 Replies Last reply
                          0
                          • T TommySharp

                            I know this is a basic question but what do I need to buy to program this using USB from my PC? So far I've just tinkered with Nanos which have a usb port on it.... An ebay link would be great!

                            korttomaK Offline
                            korttomaK Offline
                            korttoma
                            Hero Member
                            wrote on last edited by
                            #61

                            @TommySharp something like this or simlar http://www.itead.cc/foca.html

                            • Tomas
                            1 Reply Last reply
                            0
                            • T TommySharp

                              I know this is a basic question but what do I need to buy to program this using USB from my PC? So far I've just tinkered with Nanos which have a usb port on it.... An ebay link would be great!

                              DwaltD Offline
                              DwaltD Offline
                              Dwalt
                              wrote on last edited by
                              #62

                              @TommySharp
                              I just changed over to the iBoard Ethernet gateway from serial. I used the FTDI breakout board to program it. Very simple to use. The FTDI board is also needed for programming pro minis.

                              Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

                              1 Reply Last reply
                              0
                              • T Offline
                                T Offline
                                tbully
                                wrote on last edited by
                                #63

                                Hello Everyone. Sorry to bother you. I somehow screwed up my iBoard (hardware / trace modification) sketch/config today and was hoping someone could help me think through this.

                                I was having a problem with one of my far away sensors from hearing the gateway so I thought I'd increase power. When I compiled and uploaded the code, I started getting: "0;0;3;0;9;radio init fail"

                                I thought maybe my MyConfig.H file was incorrect. However, I referenced this schematic (and took in to account @gregl 's wiring changes), and my values look OK. The original setup URL referenced by Greg no longer exists on the MySensor page. Mysensors Ethernet

                                I tried changing the radio and supply on a whim. That didn't make a difference (not surprised as it has been working fine for months before trying to change the power setting)

                                Here's my sketch followed by my config file. Please help.....

                                Sketch

                                /**
                                 * The MySensors Arduino library handles the wireless radio link and protocol
                                 * between your home built sensors/actuators and HA controller of choice.
                                 * The sensors forms a self healing radio network with optional repeaters. Each
                                 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                 * network topology allowing messages to be routed to nodes.
                                 *
                                 * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                 * Copyright (C) 2013-2015 Sensnology AB
                                 * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                 *
                                 * Documentation: http://www.mysensors.org
                                 * Support Forum: http://forum.mysensors.org
                                 *
                                 * This program is free software; you can redistribute it and/or
                                 * modify it under the terms of the GNU General Public License
                                 * version 2 as published by the Free Software Foundation.
                                 *
                                 *******************************
                                 *
                                 * REVISION HISTORY
                                 * Version 1.0 - Henrik EKblad
                                 * Contribution by a-lurker and Anticimex, 
                                 * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
                                 *
                                 * 
                                 * DESCRIPTION
                                 * The EthernetGateway sends data received from sensors to the ethernet link. 
                                 * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
                                 *
                                 * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
                                 * 
                                 *
                                 * COMPILING WIZNET (W5100) ETHERNET MODULE
                                 * > Edit MyConfig.h in (libraries\MySensors\) to enable softspi (remove // before "#define SOFTSPI").
                                 *
                                 * COMPILING ENC28J60 ETHERNET MODULE
                                 * > Use Arduino IDE 1.5.7 (or later) 
                                 * > Disable DEBUG in Sensor.h before compiling this sketch. Othervise the sketch will probably not fit in program space when downloading. 
                                 * > Remove Ethernet.h include below and include UIPEthernet.h 
                                 * > Remove DigitalIO include 
                                 * Note that I had to disable UDP and DHCP support in uipethernet-conf.h to reduce space. (which means you have to choose a static IP for that module)
                                 *
                                 * VERA CONFIGURATION:
                                 * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. 
                                 * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
                                 *
                                 * LED purposes:
                                 * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
                                 * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
                                 * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
                                 * - ERR (red) - fast blink on error during transmission error or recieve crc error  
                                 * 
                                 * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
                                 *
                                 */
                                #define NO_PORTB_PINCHANGES 
                                
                                #include <DigitalIO.h>     // This include can be removed when using UIPEthernet module  
                                #include <SPI.h>  
                                
                                #include <MySigningNone.h>
                                #include <MyTransportRFM69.h>
                                #include <MyTransportNRF24.h>
                                #include <MyHwATMega328.h>
                                #include <MySigningAtsha204Soft.h>
                                #include <MySigningAtsha204.h>
                                
                                #include <MyParserSerial.h>  
                                #include <MySensor.h>  
                                #include <stdarg.h>
                                #include <PinChangeInt.h>
                                #include "GatewayUtil.h"
                                
                                
                                // Use this if you have attached a Ethernet ENC28J60 shields  
                                // #include <UIPEthernet.h>  
                                
                                // Use this for WizNET W5100 module and Arduino Ethernet Shield 
                                #include <Ethernet.h>   
                                
                                
                                #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                                #define INCLUSION_MODE_PIN  5 // Digital pin used for inclusion mode button
                                
                                #define RADIO_CE_PIN        3  // radio chip enable
                                #define RADIO_SPI_SS_PIN    8  // radio SPI serial select
                                
                                #define RADIO_ERROR_LED_PIN 11  // Error led pin
                                #define RADIO_RX_LED_PIN    12  // Receive led pin
                                #define RADIO_TX_LED_PIN    13  // the PCB, on board LED
                                
                                
                                
                                
                                // NRFRF24L01 radio driver (set low transmit power by default) 
                                MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
                                //MyTransportRFM69 transport;
                                
                                // Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                                //MySigningNone signer;
                                //MySigningAtsha204Soft signer;
                                //MySigningAtsha204 signer;
                                
                                // Hardware profile 
                                MyHwATMega328 hw;
                                
                                // Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                                // To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
                                #ifdef WITH_LEDS_BLINKING
                                MySensor gw(transport, hw /*, signer*/, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
                                #else
                                MySensor gw(transport, hw /*, signer*/);
                                #endif
                                
                                
                                #define IP_PORT 5003        // The port you want to open 
                                IPAddress myIp (192, 168, 34, 13);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!
                                
                                // The MAC address can be anything you want but should be unique on your network.
                                // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                                // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                                byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  // DEAD BEEF FEED
                                
                                // a R/W server on the port
                                EthernetServer server = EthernetServer(IP_PORT);
                                // handle to open connection
                                EthernetClient client = EthernetClient();
                                
                                char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
                                int inputPos = 0;
                                bool sentReady = false;
                                
                                void output(const char *fmt, ... ) {
                                   va_list args;
                                   va_start (args, fmt );
                                   vsnprintf_P(serialBuffer, MAX_SEND_LENGTH, fmt, args);
                                   va_end (args);
                                   Serial.print(serialBuffer);
                                   server.write(serialBuffer);
                                }
                                
                                void setup()  
                                { 
                                  Ethernet.begin(mac, myIp);
                                
                                  setupGateway(INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);
                                
                                  // Add interrupt for inclusion button to pin
                                  PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING);
                                
                                  // give the Ethernet interface a second to initialize
                                  delay(1000);
                                
                                  // Initialize gateway at maximum PA level, channel 70 and callback for write operations 
                                  gw.begin(incomingMessage, 0, true, 0);
                                
                                  
                                  // start listening for clients
                                  server.begin();
                                
                                }
                                
                                
                                void loop() {
                                  gw.process();  
                                  
                                  checkButtonTriggeredInclusion();
                                  checkInclusionFinished();
                                  
                                  // if an incoming client connects, there will be
                                  // bytes available to read via the client object
                                  EthernetClient newclient = server.available();
                                  // if a new client connects make sure to dispose any previous existing sockets
                                  if (newclient) {
                                      if (client != newclient) {
                                       client.stop();
                                       client = newclient;
                                       output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"),  C_INTERNAL, I_GATEWAY_READY);
                                     }
                                   }
                                   		 
                                   if (client) {
                                     if (!client.connected()) {
                                       client.stop();
                                     } else if (client.available()) { 
                                       // read the bytes incoming from the client
                                       char inChar = client.read();
                                       if (inputPos<MAX_RECEIVE_LENGTH-1) { 
                                         // if newline then command is complete
                                         if (inChar == '\n') {  
                                           Serial.println("Finished");
                                            // a command was issued by the client
                                            // we will now try to send it to the actuator
                                            inputString[inputPos] = 0;
                                      
                                            // echo the string to the serial port
                                            Serial.print(inputString);
                                      
                                            parseAndSend(gw, inputString);
                                      
                                            // clear the string:
                                            inputPos = 0;
                                         } else {  
                                           // add it to the inputString:
                                           inputString[inputPos] = inChar;
                                           inputPos++;
                                         }
                                      } else {
                                         // Incoming message too long. Throw away 
                                         inputPos = 0;
                                      }
                                    }
                                  }
                                }
                                
                                

                                Config File

                                /**
                                 * The MySensors Arduino library handles the wireless radio link and protocol
                                 * between your home built sensors/actuators and HA controller of choice.
                                 * The sensors forms a self healing radio network with optional repeaters. Each
                                 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                 * network topology allowing messages to be routed to nodes.
                                 *
                                 * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                 * Copyright (C) 2013-2015 Sensnology AB
                                 * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                 *
                                 * Documentation: http://www.mysensors.org
                                 * Support Forum: http://forum.mysensors.org
                                 *
                                 * This program is free software; you can redistribute it and/or
                                 * modify it under the terms of the GNU General Public License
                                 * version 2 as published by the Free Software Foundation.
                                 */
                                
                                
                                #ifndef MyConfig_h
                                #define MyConfig_h
                                #include <stdint.h>
                                
                                // Enable debug flag for debug prints. This will add a lot to the size of the final sketch but good
                                // to see what is actually is happening when developing
                                #define DEBUG
                                
                                // Disable this line, If you are using TX(1), RX(0) as normal I/O pin
                                #define ENABLED_SERIAL
                                
                                // Serial output baud rate (for debug prints and serial gateway)
                                #define BAUD_RATE 115200
                                
                                
                                /**********************************
                                *  Over the air firmware updates
                                ***********************************/
                                
                                // The following define enables the safe over-the-air firmware update feature
                                // which requires external flash and the DualOptiBoot bootloader.
                                // Note: You can still have OTA FW updates without external flash but it
                                // requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
                                //#define MY_OTA_FIRMWARE_FEATURE
                                // Slave select pin for external flash
                                #define MY_OTA_FLASH_SS 8
                                // Flash jdecid
                                #define MY_OTA_FLASH_JDECID 0x1F65
                                
                                
                                /**********************************
                                *  Information LEDs blinking
                                ***********************************/
                                // This feature enables LEDs blinking on message receive, transmit
                                // or if some error occured. This was commonly used only in gateways,
                                // but now can be used in any sensor node. Also the LEDs can now be
                                // disabled in the gateway.
                                
                                // #define WITH_LEDS_BLINKING
                                
                                // The following setting allows you to inverse the blinking feature WITH_LEDS_BLINKING
                                // When WITH_LEDS_BLINKING_INVERSE is enabled LEDSs are normally turned on and switches
                                // off when blinking
                                
                                //#define WITH_LEDS_BLINKING_INVERSE
                                
                                
                                // default LEDs blinking period in milliseconds
                                #define DEFAULT_LED_BLINK_PERIOD 300
                                // The RX LED default pin
                                #define DEFAULT_RX_LED_PIN 6
                                // The TX LED default pin
                                #define DEFAULT_TX_LED_PIN 5
                                // The Error LED default pin
                                #define DEFAULT_ERR_LED_PIN 4
                                
                                
                                /**********************************
                                *  Message Signing Settings
                                ***********************************/
                                // Disable to completly disable signing functionality in library
                                //#define MY_SIGNING_FEATURE
                                
                                // Define a suitable timeout for a signature verification session
                                // Consider the turnaround from a nonce being generated to a signed message being received
                                // which might vary, especially in networks with many hops. 5s ought to be enough for anyone.
                                #define MY_VERIFICATION_TIMEOUT_MS 5000
                                
                                // Enable to turn on whitelisting
                                // When enabled, a signing node will salt the signature with it's unique signature and nodeId.
                                // The verifying node will look up the sender in a local table of trusted nodes and
                                // do the corresponding salting in order to verify the signature.
                                // For this reason, if whitelisting is enabled on one of the nodes in a sign-verify pair, both
                                // nodes have to implement whitelisting for this to work.
                                // Note that a node can still transmit a non-salted message (i.e. have whitelisting disabled)
                                // to a node that has whitelisting enabled (assuming the receiver does not have a matching entry
                                // for the sender in it's whitelist)
                                //#define MY_SECURE_NODE_WHITELISTING
                                
                                // MySigningAtsha204 default setting
                                #define MY_ATSHA204_PIN 17 // A3 - pin where ATSHA204 is attached
                                
                                // MySigningAtsha204Soft default settings
                                #define MY_RANDOMSEED_PIN 7 // A7 - Pin used for random generation (do not connect anything to this)
                                
                                // Key to use for HMAC calculation in MySigningAtsha204Soft (32 bytes)
                                #define MY_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
                                
                                /**********************************
                                *  NRF24L01 Driver Defaults
                                ***********************************/
                                #define RF24_CE_PIN		   9  //norm
                                #define RF24_CS_PIN		   10 //norm
                                
                                //#define RF24_CE_PIN		   3  //gateway
                                //#define RF24_CS_PIN		   8  //gateway
                                //#define RF24_CE_PIN		   17 //lcd controller
                                //#define RF24_CS_PIN		   18  //lcd controller
                                #define RF24_PA_LEVEL 	   RF24_PA_LOW
                                #define RF24_PA_LEVEL_GW   RF24_PA_LOW
                                // RF channel for the sensor net, 0-127
                                #define RF24_CHANNEL	   76
                                //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
                                #define RF24_DATARATE 	   RF24_250KBPS
                                // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
                                #define RF24_BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL)
                                
                                // Enable SOFTSPI for NRF24L01 when using the W5100 Ethernet module
                                #define SOFTSPI
                                #ifdef SOFTSPI
                                	// Define the soft SPI pins used for NRF radio
                                    //const uint8_t SOFT_SPI_MISO_PIN = 16;  //norm - scene controller
                                    //const uint8_t SOFT_SPI_MOSI_PIN = 15;  //norm - scene controller
                                    //const uint8_t SOFT_SPI_SCK_PIN = 14;  //norm - scene controller
                                    const uint8_t SOFT_SPI_MISO_PIN = 12;  //gateway
                                    const uint8_t SOFT_SPI_MOSI_PIN = 11;  //gateway
                                    const uint8_t SOFT_SPI_SCK_PIN = 13;  //gateway
                                
                                #endif
                                
                                
                                /**********************************
                                *  RFM69 Driver Defaults
                                ***********************************/
                                // Default network id. Use the same for all nodes that will talk to each other
                                #define RFM69_NETWORKID     100
                                
                                // Default frequency to use. This must match the hardware version of the RFM69 radio (uncomment one):
                                // #define RFM69_FREQUENCY   RF69_433MHZ
                                #define RFM69_FREQUENCY   RF69_868MHZ
                                //#define FREQUENCY     RF69_915MHZ
                                
                                // Enable this for encryption of packets
                                //#define RFM69_ENABLE_ENCRYPTION
                                #define RFM69_ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
                                
                                
                                
                                
                                #endif
                                DwaltD 1 Reply Last reply
                                0
                                • T tbully

                                  Hello Everyone. Sorry to bother you. I somehow screwed up my iBoard (hardware / trace modification) sketch/config today and was hoping someone could help me think through this.

                                  I was having a problem with one of my far away sensors from hearing the gateway so I thought I'd increase power. When I compiled and uploaded the code, I started getting: "0;0;3;0;9;radio init fail"

                                  I thought maybe my MyConfig.H file was incorrect. However, I referenced this schematic (and took in to account @gregl 's wiring changes), and my values look OK. The original setup URL referenced by Greg no longer exists on the MySensor page. Mysensors Ethernet

                                  I tried changing the radio and supply on a whim. That didn't make a difference (not surprised as it has been working fine for months before trying to change the power setting)

                                  Here's my sketch followed by my config file. Please help.....

                                  Sketch

                                  /**
                                   * The MySensors Arduino library handles the wireless radio link and protocol
                                   * between your home built sensors/actuators and HA controller of choice.
                                   * The sensors forms a self healing radio network with optional repeaters. Each
                                   * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                   * network topology allowing messages to be routed to nodes.
                                   *
                                   * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                   * Copyright (C) 2013-2015 Sensnology AB
                                   * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                   *
                                   * Documentation: http://www.mysensors.org
                                   * Support Forum: http://forum.mysensors.org
                                   *
                                   * This program is free software; you can redistribute it and/or
                                   * modify it under the terms of the GNU General Public License
                                   * version 2 as published by the Free Software Foundation.
                                   *
                                   *******************************
                                   *
                                   * REVISION HISTORY
                                   * Version 1.0 - Henrik EKblad
                                   * Contribution by a-lurker and Anticimex, 
                                   * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
                                   *
                                   * 
                                   * DESCRIPTION
                                   * The EthernetGateway sends data received from sensors to the ethernet link. 
                                   * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
                                   *
                                   * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
                                   * 
                                   *
                                   * COMPILING WIZNET (W5100) ETHERNET MODULE
                                   * > Edit MyConfig.h in (libraries\MySensors\) to enable softspi (remove // before "#define SOFTSPI").
                                   *
                                   * COMPILING ENC28J60 ETHERNET MODULE
                                   * > Use Arduino IDE 1.5.7 (or later) 
                                   * > Disable DEBUG in Sensor.h before compiling this sketch. Othervise the sketch will probably not fit in program space when downloading. 
                                   * > Remove Ethernet.h include below and include UIPEthernet.h 
                                   * > Remove DigitalIO include 
                                   * Note that I had to disable UDP and DHCP support in uipethernet-conf.h to reduce space. (which means you have to choose a static IP for that module)
                                   *
                                   * VERA CONFIGURATION:
                                   * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. 
                                   * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
                                   *
                                   * LED purposes:
                                   * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
                                   * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
                                   * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
                                   * - ERR (red) - fast blink on error during transmission error or recieve crc error  
                                   * 
                                   * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
                                   *
                                   */
                                  #define NO_PORTB_PINCHANGES 
                                  
                                  #include <DigitalIO.h>     // This include can be removed when using UIPEthernet module  
                                  #include <SPI.h>  
                                  
                                  #include <MySigningNone.h>
                                  #include <MyTransportRFM69.h>
                                  #include <MyTransportNRF24.h>
                                  #include <MyHwATMega328.h>
                                  #include <MySigningAtsha204Soft.h>
                                  #include <MySigningAtsha204.h>
                                  
                                  #include <MyParserSerial.h>  
                                  #include <MySensor.h>  
                                  #include <stdarg.h>
                                  #include <PinChangeInt.h>
                                  #include "GatewayUtil.h"
                                  
                                  
                                  // Use this if you have attached a Ethernet ENC28J60 shields  
                                  // #include <UIPEthernet.h>  
                                  
                                  // Use this for WizNET W5100 module and Arduino Ethernet Shield 
                                  #include <Ethernet.h>   
                                  
                                  
                                  #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                                  #define INCLUSION_MODE_PIN  5 // Digital pin used for inclusion mode button
                                  
                                  #define RADIO_CE_PIN        3  // radio chip enable
                                  #define RADIO_SPI_SS_PIN    8  // radio SPI serial select
                                  
                                  #define RADIO_ERROR_LED_PIN 11  // Error led pin
                                  #define RADIO_RX_LED_PIN    12  // Receive led pin
                                  #define RADIO_TX_LED_PIN    13  // the PCB, on board LED
                                  
                                  
                                  
                                  
                                  // NRFRF24L01 radio driver (set low transmit power by default) 
                                  MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
                                  //MyTransportRFM69 transport;
                                  
                                  // Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                                  //MySigningNone signer;
                                  //MySigningAtsha204Soft signer;
                                  //MySigningAtsha204 signer;
                                  
                                  // Hardware profile 
                                  MyHwATMega328 hw;
                                  
                                  // Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                                  // To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
                                  #ifdef WITH_LEDS_BLINKING
                                  MySensor gw(transport, hw /*, signer*/, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
                                  #else
                                  MySensor gw(transport, hw /*, signer*/);
                                  #endif
                                  
                                  
                                  #define IP_PORT 5003        // The port you want to open 
                                  IPAddress myIp (192, 168, 34, 13);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!
                                  
                                  // The MAC address can be anything you want but should be unique on your network.
                                  // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                                  // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                                  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  // DEAD BEEF FEED
                                  
                                  // a R/W server on the port
                                  EthernetServer server = EthernetServer(IP_PORT);
                                  // handle to open connection
                                  EthernetClient client = EthernetClient();
                                  
                                  char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
                                  int inputPos = 0;
                                  bool sentReady = false;
                                  
                                  void output(const char *fmt, ... ) {
                                     va_list args;
                                     va_start (args, fmt );
                                     vsnprintf_P(serialBuffer, MAX_SEND_LENGTH, fmt, args);
                                     va_end (args);
                                     Serial.print(serialBuffer);
                                     server.write(serialBuffer);
                                  }
                                  
                                  void setup()  
                                  { 
                                    Ethernet.begin(mac, myIp);
                                  
                                    setupGateway(INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);
                                  
                                    // Add interrupt for inclusion button to pin
                                    PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING);
                                  
                                    // give the Ethernet interface a second to initialize
                                    delay(1000);
                                  
                                    // Initialize gateway at maximum PA level, channel 70 and callback for write operations 
                                    gw.begin(incomingMessage, 0, true, 0);
                                  
                                    
                                    // start listening for clients
                                    server.begin();
                                  
                                  }
                                  
                                  
                                  void loop() {
                                    gw.process();  
                                    
                                    checkButtonTriggeredInclusion();
                                    checkInclusionFinished();
                                    
                                    // if an incoming client connects, there will be
                                    // bytes available to read via the client object
                                    EthernetClient newclient = server.available();
                                    // if a new client connects make sure to dispose any previous existing sockets
                                    if (newclient) {
                                        if (client != newclient) {
                                         client.stop();
                                         client = newclient;
                                         output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"),  C_INTERNAL, I_GATEWAY_READY);
                                       }
                                     }
                                     		 
                                     if (client) {
                                       if (!client.connected()) {
                                         client.stop();
                                       } else if (client.available()) { 
                                         // read the bytes incoming from the client
                                         char inChar = client.read();
                                         if (inputPos<MAX_RECEIVE_LENGTH-1) { 
                                           // if newline then command is complete
                                           if (inChar == '\n') {  
                                             Serial.println("Finished");
                                              // a command was issued by the client
                                              // we will now try to send it to the actuator
                                              inputString[inputPos] = 0;
                                        
                                              // echo the string to the serial port
                                              Serial.print(inputString);
                                        
                                              parseAndSend(gw, inputString);
                                        
                                              // clear the string:
                                              inputPos = 0;
                                           } else {  
                                             // add it to the inputString:
                                             inputString[inputPos] = inChar;
                                             inputPos++;
                                           }
                                        } else {
                                           // Incoming message too long. Throw away 
                                           inputPos = 0;
                                        }
                                      }
                                    }
                                  }
                                  
                                  

                                  Config File

                                  /**
                                   * The MySensors Arduino library handles the wireless radio link and protocol
                                   * between your home built sensors/actuators and HA controller of choice.
                                   * The sensors forms a self healing radio network with optional repeaters. Each
                                   * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                   * network topology allowing messages to be routed to nodes.
                                   *
                                   * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                   * Copyright (C) 2013-2015 Sensnology AB
                                   * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                   *
                                   * Documentation: http://www.mysensors.org
                                   * Support Forum: http://forum.mysensors.org
                                   *
                                   * This program is free software; you can redistribute it and/or
                                   * modify it under the terms of the GNU General Public License
                                   * version 2 as published by the Free Software Foundation.
                                   */
                                  
                                  
                                  #ifndef MyConfig_h
                                  #define MyConfig_h
                                  #include <stdint.h>
                                  
                                  // Enable debug flag for debug prints. This will add a lot to the size of the final sketch but good
                                  // to see what is actually is happening when developing
                                  #define DEBUG
                                  
                                  // Disable this line, If you are using TX(1), RX(0) as normal I/O pin
                                  #define ENABLED_SERIAL
                                  
                                  // Serial output baud rate (for debug prints and serial gateway)
                                  #define BAUD_RATE 115200
                                  
                                  
                                  /**********************************
                                  *  Over the air firmware updates
                                  ***********************************/
                                  
                                  // The following define enables the safe over-the-air firmware update feature
                                  // which requires external flash and the DualOptiBoot bootloader.
                                  // Note: You can still have OTA FW updates without external flash but it
                                  // requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
                                  //#define MY_OTA_FIRMWARE_FEATURE
                                  // Slave select pin for external flash
                                  #define MY_OTA_FLASH_SS 8
                                  // Flash jdecid
                                  #define MY_OTA_FLASH_JDECID 0x1F65
                                  
                                  
                                  /**********************************
                                  *  Information LEDs blinking
                                  ***********************************/
                                  // This feature enables LEDs blinking on message receive, transmit
                                  // or if some error occured. This was commonly used only in gateways,
                                  // but now can be used in any sensor node. Also the LEDs can now be
                                  // disabled in the gateway.
                                  
                                  // #define WITH_LEDS_BLINKING
                                  
                                  // The following setting allows you to inverse the blinking feature WITH_LEDS_BLINKING
                                  // When WITH_LEDS_BLINKING_INVERSE is enabled LEDSs are normally turned on and switches
                                  // off when blinking
                                  
                                  //#define WITH_LEDS_BLINKING_INVERSE
                                  
                                  
                                  // default LEDs blinking period in milliseconds
                                  #define DEFAULT_LED_BLINK_PERIOD 300
                                  // The RX LED default pin
                                  #define DEFAULT_RX_LED_PIN 6
                                  // The TX LED default pin
                                  #define DEFAULT_TX_LED_PIN 5
                                  // The Error LED default pin
                                  #define DEFAULT_ERR_LED_PIN 4
                                  
                                  
                                  /**********************************
                                  *  Message Signing Settings
                                  ***********************************/
                                  // Disable to completly disable signing functionality in library
                                  //#define MY_SIGNING_FEATURE
                                  
                                  // Define a suitable timeout for a signature verification session
                                  // Consider the turnaround from a nonce being generated to a signed message being received
                                  // which might vary, especially in networks with many hops. 5s ought to be enough for anyone.
                                  #define MY_VERIFICATION_TIMEOUT_MS 5000
                                  
                                  // Enable to turn on whitelisting
                                  // When enabled, a signing node will salt the signature with it's unique signature and nodeId.
                                  // The verifying node will look up the sender in a local table of trusted nodes and
                                  // do the corresponding salting in order to verify the signature.
                                  // For this reason, if whitelisting is enabled on one of the nodes in a sign-verify pair, both
                                  // nodes have to implement whitelisting for this to work.
                                  // Note that a node can still transmit a non-salted message (i.e. have whitelisting disabled)
                                  // to a node that has whitelisting enabled (assuming the receiver does not have a matching entry
                                  // for the sender in it's whitelist)
                                  //#define MY_SECURE_NODE_WHITELISTING
                                  
                                  // MySigningAtsha204 default setting
                                  #define MY_ATSHA204_PIN 17 // A3 - pin where ATSHA204 is attached
                                  
                                  // MySigningAtsha204Soft default settings
                                  #define MY_RANDOMSEED_PIN 7 // A7 - Pin used for random generation (do not connect anything to this)
                                  
                                  // Key to use for HMAC calculation in MySigningAtsha204Soft (32 bytes)
                                  #define MY_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
                                  
                                  /**********************************
                                  *  NRF24L01 Driver Defaults
                                  ***********************************/
                                  #define RF24_CE_PIN		   9  //norm
                                  #define RF24_CS_PIN		   10 //norm
                                  
                                  //#define RF24_CE_PIN		   3  //gateway
                                  //#define RF24_CS_PIN		   8  //gateway
                                  //#define RF24_CE_PIN		   17 //lcd controller
                                  //#define RF24_CS_PIN		   18  //lcd controller
                                  #define RF24_PA_LEVEL 	   RF24_PA_LOW
                                  #define RF24_PA_LEVEL_GW   RF24_PA_LOW
                                  // RF channel for the sensor net, 0-127
                                  #define RF24_CHANNEL	   76
                                  //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
                                  #define RF24_DATARATE 	   RF24_250KBPS
                                  // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
                                  #define RF24_BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL)
                                  
                                  // Enable SOFTSPI for NRF24L01 when using the W5100 Ethernet module
                                  #define SOFTSPI
                                  #ifdef SOFTSPI
                                  	// Define the soft SPI pins used for NRF radio
                                      //const uint8_t SOFT_SPI_MISO_PIN = 16;  //norm - scene controller
                                      //const uint8_t SOFT_SPI_MOSI_PIN = 15;  //norm - scene controller
                                      //const uint8_t SOFT_SPI_SCK_PIN = 14;  //norm - scene controller
                                      const uint8_t SOFT_SPI_MISO_PIN = 12;  //gateway
                                      const uint8_t SOFT_SPI_MOSI_PIN = 11;  //gateway
                                      const uint8_t SOFT_SPI_SCK_PIN = 13;  //gateway
                                  
                                  #endif
                                  
                                  
                                  /**********************************
                                  *  RFM69 Driver Defaults
                                  ***********************************/
                                  // Default network id. Use the same for all nodes that will talk to each other
                                  #define RFM69_NETWORKID     100
                                  
                                  // Default frequency to use. This must match the hardware version of the RFM69 radio (uncomment one):
                                  // #define RFM69_FREQUENCY   RF69_433MHZ
                                  #define RFM69_FREQUENCY   RF69_868MHZ
                                  //#define FREQUENCY     RF69_915MHZ
                                  
                                  // Enable this for encryption of packets
                                  //#define RFM69_ENABLE_ENCRYPTION
                                  #define RFM69_ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
                                  
                                  
                                  
                                  
                                  #endif
                                  DwaltD Offline
                                  DwaltD Offline
                                  Dwalt
                                  wrote on last edited by
                                  #64

                                  @tbully

                                  I vaguely remember getting the 'radio inti fail' error when i first setup my iBoard (with hardware mod) and the only difference i see between my sketch and yours is mapping the inclusion button and led pins to analog pin numbers.

                                  #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                                  #define INCLUSION_MODE_PIN  14 // Digital pin used for inclusion mode button A0
                                  
                                  #define RADIO_CE_PIN        3  // radio chip enable
                                  #define RADIO_SPI_SS_PIN    8  // radio SPI serial select
                                  
                                  #define RADIO_ERROR_LED_PIN 15  // Error led pin A1
                                  #define RADIO_RX_LED_PIN    16  // Receive led pin A2
                                  #define RADIO_TX_LED_PIN    17  // the PCB, on board LED A3
                                  

                                  Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

                                  1 Reply Last reply
                                  0
                                  • T Offline
                                    T Offline
                                    tbully
                                    wrote on last edited by
                                    #65

                                    Thanks @Dwalt I'm pulling my hair out here.

                                    Pin 5 should matter (nor should the others) as it is freed up with the "hardware mod" of @gregl 's engineering.

                                    I changed all four settings anyway, just in case. No go.

                                    Starting to wonder if something is going on with the board.......

                                    1 Reply Last reply
                                    0
                                    • T Offline
                                      T Offline
                                      tbully
                                      wrote on last edited by tbully
                                      #66

                                      To close the loop on this (and to help future dwellers), a new board solved the issue. Not sure what wasn't working properly on the old board but I'm up and running again (with the same old radio, supply, etc).

                                      Also, since I've learned a little and now understand a few of the configs better since my original iBoard build, I was able to do this WITHOUT the hardware mod.

                                      I set the following in MyConfig.H:

                                      const uint8_t SOFT_SPI_MISO_PIN = 6; 
                                      const uint8_t SOFT_SPI_MOSI_PIN = 5; 
                                      const uint8_t SOFT_SPI_SCK_PIN = 7;
                                      

                                      My failure from several months ago was not setting the CE and SS pins properly in my sketch. I also took @Dwalt 's advice and updated my inclusion and LED pins (even though I didn't use them):

                                      #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                                      #define INCLUSION_MODE_PIN  14 // Digital pin used for inclusion mode button A0
                                      
                                      #define RADIO_CE_PIN        3  // radio chip enable
                                      #define RADIO_SPI_SS_PIN    8  // radio SPI serial select
                                      
                                      #define RADIO_ERROR_LED_PIN 15  // Error led pin A1
                                      #define RADIO_RX_LED_PIN    16  // Receive led pin A2
                                      #define RADIO_TX_LED_PIN    17  // the PCB, on board LED A3
                                      1 Reply Last reply
                                      1
                                      • C Offline
                                        C Offline
                                        cleight
                                        wrote on last edited by
                                        #67

                                        Hello,

                                        I have been trying to get my iBoard working correctly for a few months on and off and finally got it up and running with good range and things are working good. However I am having an issue with the gateway always being stuck in inclusion mode, I have the following sketch, I would like to retain the onboard LED's but I don't have an inclusion button or need one since I can start the inclusion process from Vera. Any guidance would be greatly appreciated.

                                        /**
                                         * The MySensors Arduino library handles the wireless radio link and protocol
                                         * between your home built sensors/actuators and HA controller of choice.
                                         * The sensors forms a self healing radio network with optional repeaters. Each
                                         * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                         * network topology allowing messages to be routed to nodes.
                                         *
                                         * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                         * Copyright (C) 2013-2015 Sensnology AB
                                         * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                         *
                                         * Documentation: http://www.mysensors.org
                                         * Support Forum: http://forum.mysensors.org
                                         *
                                         * This program is free software; you can redistribute it and/or
                                         * modify it under the terms of the GNU General Public License
                                         * version 2 as published by the Free Software Foundation.
                                         *
                                         *******************************
                                         *
                                         * REVISION HISTORY
                                         * Version 1.0 - Henrik EKblad
                                         * Contribution by a-lurker and Anticimex, 
                                         * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
                                         *
                                         * 
                                         * DESCRIPTION
                                         * The EthernetGateway sends data received from sensors to the ethernet link. 
                                         * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
                                         *
                                         * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
                                         * 
                                         *
                                         * COMPILING WIZNET (W5100) ETHERNET MODULE
                                         * > Edit MyConfig.h in (libraries\MySensors\) to enable softspi (remove // before "#define SOFTSPI").
                                         *
                                         * COMPILING ENC28J60 ETHERNET MODULE
                                         * > Use Arduino IDE 1.5.7 (or later) 
                                         * > Disable DEBUG in Sensor.h before compiling this sketch. Othervise the sketch will probably not fit in program space when downloading. 
                                         * > Remove Ethernet.h include below and include UIPEthernet.h 
                                         * > Remove DigitalIO include 
                                         * Note that I had to disable UDP and DHCP support in uipethernet-conf.h to reduce space. (which means you have to choose a static IP for that module)
                                         *
                                         * VERA CONFIGURATION:
                                         * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. 
                                         * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
                                         *
                                         * LED purposes:
                                         * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
                                         * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
                                         * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
                                         * - ERR (red) - fast blink on error during transmission error or recieve crc error  
                                         * 
                                         * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
                                         *
                                         */
                                        #define NO_PORTB_PINCHANGES 
                                        
                                        #include <DigitalIO.h>     // This include can be removed when using UIPEthernet module  
                                        #include <SPI.h>  
                                        
                                        #include <MySigningNone.h>
                                        #include <MyTransportRFM69.h>
                                        #include <MyTransportNRF24.h>
                                        #include <MyHwATMega328.h>
                                        #include <MySigningAtsha204Soft.h>
                                        #include <MySigningAtsha204.h>
                                        
                                        #include <MyParserSerial.h>  
                                        #include <MySensor.h>  
                                        #include <stdarg.h>
                                        #include <PinChangeInt.h>
                                        #include "GatewayUtil.h"
                                        
                                        
                                        // Use this if you have attached a Ethernet ENC28J60 shields  
                                        // #include <UIPEthernet.h>  
                                        
                                        // Use this for WizNET W5100 module and Arduino Ethernet Shield 
                                        #include <Ethernet.h>   
                                        
                                        
                                        #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                                        #define INCLUSION_MODE_PIN  14 // Digital pin used for inclusion mode button
                                        
                                        #define RADIO_CE_PIN        3  // radio chip enable
                                        #define RADIO_SPI_SS_PIN    8  // radio SPI serial select
                                        
                                        #define RADIO_ERROR_LED_PIN 7  // Error led pin
                                        #define RADIO_RX_LED_PIN    6  // Receive led pin
                                        #define RADIO_TX_LED_PIN    9  // the PCB, on board LED
                                        
                                        
                                        // NRFRF24L01 radio driver (set low transmit power by default) 
                                        MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
                                        //MyTransportRFM69 transport;
                                        
                                        // Message signing driver (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                                        //MySigningNone signer;
                                        //MySigningAtsha204Soft signer;
                                        //MySigningAtsha204 signer;
                                        
                                        // Hardware profile 
                                        MyHwATMega328 hw;
                                        
                                        // Construct MySensors library (signer needed if MY_SIGNING_FEATURE is turned on in MyConfig.h)
                                        // To use LEDs blinking, uncomment WITH_LEDS_BLINKING in MyConfig.h
                                        #ifdef WITH_LEDS_BLINKING
                                        MySensor gw(transport, hw /*, signer*/, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
                                        #else
                                        MySensor gw(transport, hw /*, signer*/);
                                        #endif
                                        
                                        
                                        #define IP_PORT 5003        // The port you want to open 
                                        IPAddress myIp (192, 168, 2, 62);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!
                                        
                                        // The MAC address can be anything you want but should be unique on your network.
                                        // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                                        // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                                        byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  // DEAD BEEF FEED
                                        
                                        // a R/W server on the port
                                        EthernetServer server = EthernetServer(IP_PORT);
                                        // handle to open connection
                                        EthernetClient client = EthernetClient();
                                        
                                        char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
                                        int inputPos = 0;
                                        bool sentReady = false;
                                        
                                        void output(const char *fmt, ... ) {
                                           va_list args;
                                           va_start (args, fmt );
                                           vsnprintf_P(serialBuffer, MAX_SEND_LENGTH, fmt, args);
                                           va_end (args);
                                           Serial.print(serialBuffer);
                                           server.write(serialBuffer);
                                        }
                                        
                                        void setup()  
                                        { 
                                          Ethernet.begin(mac, myIp);
                                        
                                          setupGateway(INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);
                                        
                                          // Add interrupt for inclusion button to pin
                                          PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING);
                                        
                                          // give the Ethernet interface a second to initialize
                                          delay(1000);
                                        
                                          // Initialize gateway at maximum PA level, channel 70 and callback for write operations 
                                          gw.begin(incomingMessage, 0, true, 0);
                                        
                                          
                                          // start listening for clients
                                          server.begin();
                                        
                                        }
                                        
                                        
                                        void loop() {
                                          gw.process();  
                                          
                                          checkButtonTriggeredInclusion();
                                          checkInclusionFinished();
                                          
                                          // if an incoming client connects, there will be
                                          // bytes available to read via the client object
                                          EthernetClient newclient = server.available();
                                          // if a new client connects make sure to dispose any previous existing sockets
                                          if (newclient) {
                                              if (client != newclient) {
                                               client.stop();
                                               client = newclient;
                                               output(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"),  C_INTERNAL, I_GATEWAY_READY);
                                             }
                                           }
                                                
                                           if (client) {
                                             if (!client.connected()) {
                                               client.stop();
                                             } else if (client.available()) { 
                                               // read the bytes incoming from the client
                                               char inChar = client.read();
                                               if (inputPos<MAX_RECEIVE_LENGTH-1) { 
                                                 // if newline then command is complete
                                                 if (inChar == '\n') {  
                                                   Serial.println("Finished");
                                                    // a command was issued by the client
                                                    // we will now try to send it to the actuator
                                                    inputString[inputPos] = 0;
                                              
                                                    // echo the string to the serial port
                                                    Serial.print(inputString);
                                              
                                                    parseAndSend(gw, inputString);
                                              
                                                    // clear the string:
                                                    inputPos = 0;
                                                 } else {  
                                                   // add it to the inputString:
                                                   inputString[inputPos] = inChar;
                                                   inputPos++;
                                                 }
                                              } else {
                                                 // Incoming message too long. Throw away 
                                                 inputPos = 0;
                                              }
                                            }
                                          }
                                        }
                                        
                                        1 Reply Last reply
                                        0
                                        • 5546dug5 Offline
                                          5546dug5 Offline
                                          5546dug
                                          wrote on last edited by 5546dug
                                          #68

                                          @gregl or anyone with info

                                          this is the second iboard gateway to be set up for me. The first went off without a hitch. It was and is still up and running flawlessly, how ever there is aproblem I have to day.

                                          I believe I have used the same program as is indicated in this thread and have done so by the h/w method.

                                          When using the arduino 1.6.5 IDE and set to Duemilove board 328 processer and proper USB port, when using the serial moniter the message "0,0,3,0,14 gateway started " is what is shown.

                                          However when Iboard is plugged into Ethernet port on modem, there is no interaction on the vera 3 dashboard (ui5) and for the life of me I can not figure out the issue.
                                          The power LED as well as LINK ,SPD, FDX are on steady with occasional blinks of the Rx led
                                          suggesting there is some communication between iboard and modem. As there is no check wires, all in the board seems well.

                                          Any ideas on the problemI? I have tried different rf24 and power supplies or have I forgot to do something with the vera. I had usb gateway but it has been deleted from vera3.
                                          Thanks doug.

                                          Edit When I go to the router and inspect for connected things the Iboard does show up under the proper reserved ip (10.0.0.20) with port 5003.

                                          This unit is in remote home and first unit is at residence, both with own vera but both use the same mac dead beef feed.

                                          DwaltD 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          21

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular