Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. mscott
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    mscott

    @mscott

    0
    Reputation
    9
    Posts
    709
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    mscott Follow

    Best posts made by mscott

    This user hasn't posted anything yet.

    Latest posts made by mscott

    • RE: Can't ping Ethernet Gateway

      @Sparkman Thanks for the suggestion. I tested some other example codes and it didn't work either. I found out that the Wiznet 5200 I bought from radioshock does not work with the default Ethernet.h. I had to download Seeedstudios example library and modify their EthernetV2.cpp because it was broken out of the box. I found my solution for the .cpp from reddit and their example code worked afterwards. Then i just replaced Ethernet.h with EthernetV2_0.h and everything ran. As a side note i reinstalled the arduino ide and deleted my Arduino folder and started from scratch so I had reenable soft spi and change the pin 14,15,16 to A0,A1,A2 like suggested in the Disqus comments and now everything works.

      EthernetV2.cpp code after mod:

      #include "w5200.h"
      #include "EthernetV2_0.h"
      #include "DhcpV2_0.h"
      
      // XXX: don't make assumptions about the value of MAX_SOCK_NUM.
      uint8_t EthernetClass::_state[MAX_SOCK_NUM] = { 
        0, 0, 0, 0 };
      uint16_t EthernetClass::_server_port[MAX_SOCK_NUM] = { 
        0, 0, 0, 0 };
      
      int EthernetClass::begin(uint8_t *mac_address)
      {
        _dhcp = new DhcpClass();
      
      
        // Initialise the basic info
        W5100.init();
        W5100.setMACAddress(mac_address);
        W5100.setIPAddress(IPAddress(0,0,0,0).raw_address());
      
        // Now try to get our config info from a DHCP server
        int ret = _dhcp->beginWithDHCP(mac_address);
        if(ret == 1)
        {
          // We've successfully found a DHCP server and got our configuration info, so set things
          // accordingly
          W5100.setIPAddress(_dhcp->getLocalIp().raw_address());
          W5100.setGatewayIp(_dhcp->getGatewayIp().raw_address());
          W5100.setSubnetMask(_dhcp->getSubnetMask().raw_address());
          _dnsServerAddress = _dhcp->getDnsServerIp();
        }
      
        return ret;
      }
      
      void EthernetClass::begin(uint8_t *mac_address, IPAddress local_ip)
      {
        // Assume the DNS server will be the machine on the same network as the local IP
        // but with last octet being '1'
        IPAddress dns_server = local_ip;
        dns_server[3] = 1;
        begin(mac_address, local_ip, dns_server);
      }
      
      void EthernetClass::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server)
      {
        // Assume the gateway will be the machine on the same network as the local IP
        // but with last octet being '1'
        IPAddress gateway = local_ip;
        gateway[3] = 1;
        begin(mac_address, local_ip, dns_server, gateway);
      }
      
      void EthernetClass::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway)
      {
        IPAddress subnet(255, 255, 255, 0);
        begin(mac_address, local_ip, dns_server, gateway, subnet);
      }
      
      void EthernetClass::begin(uint8_t *mac, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
      {
        W5100.init();
        W5100.setMACAddress(mac);
        W5100.setIPAddress(local_ip.raw_address());
        W5100.setGatewayIp(gateway.raw_address());
        W5100.setSubnetMask(subnet.raw_address());
        _dnsServerAddress = dns_server;
      }
      
      int EthernetClass::maintain(){
        int rc = DHCP_CHECK_NONE;
        if(_dhcp != NULL){
          //we have a pointer to dhcp, use it
          rc = _dhcp->checkLease();
          switch ( rc ){
            case DHCP_CHECK_NONE:
              //nothing done
              break;
            case DHCP_CHECK_RENEW_OK:
            case DHCP_CHECK_REBIND_OK:
              //we might have got a new IP.
              W5100.setIPAddress(_dhcp->getLocalIp().raw_address());
              W5100.setGatewayIp(_dhcp->getGatewayIp().raw_address());
              W5100.setSubnetMask(_dhcp->getSubnetMask().raw_address());
              _dnsServerAddress = _dhcp->getDnsServerIp();
              break;
            default:
              //this is actually a error, it will retry though
              break;
          }
        }
        return rc;
      }
      
      IPAddress EthernetClass::localIP()
      {
        IPAddress ret;
        W5100.getIPAddress(ret.raw_address());
        return ret;
      }
      
      IPAddress EthernetClass::subnetMask()
      {
        IPAddress ret;
        W5100.getSubnetMask(ret.raw_address());
        return ret;
      }
      
      IPAddress EthernetClass::gatewayIP()
      {
        IPAddress ret;
        W5100.getGatewayIp(ret.raw_address());
        return ret;
      }
      
      IPAddress EthernetClass::dnsServerIP()
      {
        return _dnsServerAddress;
      }
      
      EthernetClass Ethernet;
      
      
      posted in Troubleshooting
      mscott
      mscott
    • RE: Can't ping Ethernet Gateway

      Is there anyway i can debug this or add something to the code to enable dhcp. How much space does enabling dhcp take up.

      posted in Troubleshooting
      mscott
      mscott
    • RE: Charge battery while powering arduino

      Thank you. I will try this and report back.

      posted in General Discussion
      mscott
      mscott
    • Can't ping Ethernet Gateway

      I built a ethernet gateway using an arduino uno and a wiznet 5200. In the serial monitor i get 0;0;3;0;14;Gateway startup complete. But i can't ping it or connect with the veralite. I've attached my sketch below. Where am i going wrong here:

      /*
       * Copyright (C) 2013 Henrik Ekblad <henrik.ekblad@gmail.com>
       * 
       * Contribution by a-lurker
       *
       * 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.
       * 
       * 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 RF24_config.h in (libraries\MySensors\utility) 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:
       * - 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.
       *
       */
      
      #include <DigitalIO.h>     // This include can be removed when using UIPEthernet module  
      #include <SPI.h>  
      #include <MySensor.h>
      #include <MyGateway.h>  
      #include <stdarg.h>
      
      // Use this if you have attached a Ethernet ENC28J60 shields  
      //#include <UIPEthernet.h>  
      
      // Use this fo 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  3 // Digital pin used for inclusion mode button
      
      #define RADIO_CE_PIN        5  // radio chip enable
      #define RADIO_SPI_SS_PIN    6  // radio SPI serial select
      #define RADIO_ERROR_LED_PIN 7  // Error led pin
      #define RADIO_RX_LED_PIN    8  // Receive led pin
      #define RADIO_TX_LED_PIN    9  // the PCB, on board LED
      
      #define IP_PORT 5003        // The port you want to open 
      IPAddress myIp (192, 168, 100, 115);  // 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);
      
      // No blink or button functionality. Use the vanilla constructor.
      MyGateway gw(RADIO_CE_PIN, RADIO_SPI_SS_PIN, INCLUSION_MODE_TIME);
      
      // Uncomment this constructor if you have leds and include button attached to your gateway 
      //MyGateway gw(RADIO_CE_PIN, RADIO_SPI_SS_PIN, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN, RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN);
      
      
      char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
      int inputPos = 0;
      
      void setup()  
      { 
        Ethernet.begin(mac, myIp);
      
        // 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(RF24_PA_LEVEL_GW, RF24_CHANNEL, RF24_DATARATE, writeEthernet);
      
        // start listening for clients
        server.begin();
      }
      
      // This will be called when data should be written to ethernet 
      void writeEthernet(char *writeBuffer) {
        server.write(writeBuffer);
      }
      
      
      void loop()
      {
        // if an incoming client connects, there will be
        // bytes available to read via the client object
        EthernetClient client = server.available();
      
        if (client) {
            // if got 1 or more bytes
            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') {  
                    // 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);
      
                    gw.parseAndSend(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;
              }
            }
         }  
         gw.processRadioMessage();    
      }
      
      posted in Troubleshooting
      mscott
      mscott
    • Charge battery while powering arduino

      I've been looking everywhere for this answer but I can't find it. Can you charge batttery powered arduino and run it using AC power. Pretty much i watch to keep my lithuim battery charged while power is connected to my arduino. Is this possible. It sounds like people have done this with solar but this device will not be outside.

      posted in General Discussion
      mscott
      mscott
    • Two button light and fan switch

      This is my first project and I've learned a lot. I plan on improving the switch as I learn to design boards because I could have saved a ton of space if I could have build my own relay with built in 5v output from the load wire. But I'm happy with it so far.

      parts list

      • arduino nano
      • NRF24L01
      • Protoboard
      • Surface Mount Box Extender HW187-52
      • two radioshack pushbutton switches
      • dual load relay
      • in-sure Push-in Wire Connectors

      Sorry for the bad pictures.
      20150621_110321.jpg
      20150621_110659.jpg

      posted in My Project
      mscott
      mscott
    • RE: IR Blaster (progress)

      3 to 5 here

      posted in Hardware
      mscott
      mscott
    • RE: Ethernet Gateway - 0;0;3;0;9;check wires

      Same here. I'm probably going to just order a wiznet since that seems to be consistently working for most.

      posted in Vera
      mscott
      mscott
    • How to connect arduino nano to 2.8 tft

      I'm extremely new to arduino and i've successfully got two devices running, for example a gateway and two button relay. I've gotten a 2.8' tft in and want to connect it to but I'm lost. If i connect everything pin of this to my nano I wont have any left to connect anything else. I bought a bunch of nano and dont want to go buy a full size arduino but will if i have to. Please help me figure out the best way to wire my nano to the tft/sd card shield.

      Screen I bought

      pin diagram I found

      posted in Troubleshooting
      mscott
      mscott