Navigation

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

    ruxu

    @ruxu

    2
    Reputation
    8
    Posts
    1215
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    ruxu Follow

    Best posts made by ruxu

    • RE: [SOLVED] How to get SoftwareSerial to work on the SerialGateway...?

      Managed to find out a solution by myself.

      • removed the three #define NO_PORTx_PINCHANGES

      • removed the #include <PinChangeInt.h>

      • changed PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING); to
        attachInterrupt(1, startInclusionInterrupt, RISING);

      Now I am able to use the Seeedstudip GPRS shield pins 7 and 8 with SoftwareSerial.

      posted in Troubleshooting
      ruxu
      ruxu

    Latest posts made by ruxu

    • RE: [SOLVED] How to get SoftwareSerial to work on the SerialGateway...?

      Managed to find out a solution by myself.

      • removed the three #define NO_PORTx_PINCHANGES

      • removed the #include <PinChangeInt.h>

      • changed PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING); to
        attachInterrupt(1, startInclusionInterrupt, RISING);

      Now I am able to use the Seeedstudip GPRS shield pins 7 and 8 with SoftwareSerial.

      posted in Troubleshooting
      ruxu
      ruxu
    • RE: [SOLVED] How to get SoftwareSerial to work on the SerialGateway...?

      The following SerialGateway code works but inclusion is not possible as NO_PINCHANGE is set for all ports.

       #define NO_PORTB_PINCHANGES
       #define NO_PORTC_PINCHANGES
       #define NO_PORTD_PINCHANGES
      
       #include <SPI.h>  
       #include <MySensor.h>  
       #include <stdarg.h>
       #include <MsTimer2.h>
       #include <PinChangeInt.h>
       #include "GatewayUtil.h"
       #include <SoftwareSerial.h>
      
       #ifndef MYSENSORS_SERIAL_GATEWAY
       #error Please switch to MYSENSORS_SERIAL_GATEWAY in MyConfig.h
       #endif
      
       #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_ERROR_LED_PIN A3  // Error led pin
       #define RADIO_RX_LED_PIN    A5  // Receive led pin
       #define RADIO_TX_LED_PIN    A4  // the PCB, on board LED
      
       MySensor gw;
      
       SoftwareSerial SIM900(7, 8);
      
       char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
       int inputPos = 0;
       boolean commandComplete = false;  // whether the string is complete
      
       void parseAndSend(char *commandBuffer);
      
       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);
       }
      
      
       void setup()  
       { 
         gw.begin(incomingMessage, 0, true, 0);
      
         setupGateway(RADIO_RX_LED_PIN, RADIO_TX_LED_PIN, RADIO_ERROR_LED_PIN, INCLUSION_MODE_PIN, INCLUSION_MODE_TIME, output);  
      
         // Add led timer interrupt
         MsTimer2::set(300, ledTimersInterrupt);
         MsTimer2::start();
      
         // Add interrupt for inclusion button to pin
         PCintPort::attachInterrupt(pinInclusion, startInclusionInterrupt, RISING);
      
      
         // Send startup log message on serial
         serial(PSTR("0;0;%d;0;%d;Gateway startup complete.\n"),  C_INTERNAL, I_GATEWAY_READY);
       }
      
       void loop()  
       { 
         gw.process();
      
         checkButtonTriggeredInclusion();
         checkInclusionFinished();
      
         if (commandComplete) {
           // A command wass issued from serial interface
           // We will now try to send it to the actuator
           parseAndSend(gw, inputString);
           commandComplete = false;  
           inputPos = 0;
         }
       }
      
      
       /*
        SerialEvent occurs whenever a new data comes in the
        hardware serial RX.  This routine is run between each
        time loop() runs, so using delay inside loop can delay
        response.  Multiple bytes of data may be available.
        */
       void serialEvent() {
         while (Serial.available()) {
           // get the new byte:
           char inChar = (char)Serial.read(); 
           // if the incoming character is a newline, set a flag
           // so the main loop can do something about it:
           if (inputPos<MAX_RECEIVE_LENGTH-1 && !commandComplete) { 
             if (inChar == '\n') {
               inputString[inputPos] = 0;
               commandComplete = true;
             } else {
               // add it to the inputString:
               inputString[inputPos] = inChar;
               inputPos++;
             }
           } else {
              // Incoming message too long. Throw away 
               inputPos = 0;
           }
         }
       }
      

      But as soon as i comment out any of the three #define NO_PORTx_PINCHANGES I get a compile error including the vector 3, 4 or 5 messages. If I am correct the #define NO_PORTD_PINCHANGES should be uncommented for the inclusion to work. Any ideas on how to fix this annoying problem?

      posted in Troubleshooting
      ruxu
      ruxu
    • RE: [SOLVED] How to get SoftwareSerial to work on the SerialGateway...?

      @axillent said:

      @ruxu arduino is using a bit stupid way of making files and this sometimes leads to stupid behavior

      try to place #include <SoftwareSerial.h> between or after other includes, top, bottom or middle
      or even try to include PinChangeInt.h: instead

      also check the content of SoftwareSerial.h, it should have #ifdef #endif at most top and most bottom of the file to avoid problem in case of multiple inclusions, etc, it is a common practice for any .H file

      Tried your suggestions and noticed that if I comment out #include PinChangeInt.h and one line related to that library then the code compiles fine with SoftwareSerial.h included. Still the code doesn't of course work because the inclusion is then disabled. Any new ideas...?

      posted in Troubleshooting
      ruxu
      ruxu
    • [SOLVED] How to get SoftwareSerial to work on the SerialGateway...?

      Can't figure out how to get the SoftwareSerial to work on the SerialGateway. Have been using the GitHub master branch of MySensors and tried all described workarounds I have came over but to no avail - usually I get the long error codes referring to vectors....

      Then I saw a five days old message on GitHub that said that this behavior is fixed in the GitHub development branch. I installed that and now SoftwareSerial can be successfully compiled on nodes with no error.

      But on the SerialGateway I run into two different nonworking options,

      • if I don't #include <SoftwareSerial.h> in the sketch it recognizes SoftwareSerial when I type it and colors it orange - but when I run the sketch I get the following error SerialGateway.ino:46:1: error: 'SoftwareSerial' does not name a type

      • if I again #include <SoftwareSerial.h> in the sketch I get the usual long compile error - SoftwareSerial/SoftwareSerial.cpp.o: In function _vector_3:
        /Applications/Arduino 1.5.8.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:307: multiple definition of __vector_3' SerialGateway.cpp.o:/Users/sirrai/Documents/Arduino/libraries/PinChangeInt/PinChangeInt.h:563: first defined here SoftwareSerial/SoftwareSerial.cpp.o: In function __vector_5': /Applications/Arduino 1.5.8.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:322: multiple definition of __vector_5'
        SerialGateway.cpp.o:/Users/sirrai/Documents/Arduino/libraries/PinChangeInt/PinChangeInt.h:583: first defined here

      I have a Seeedstudio GPRS shield that uses SoftwareSerial on pins 7 and 8 that I intend to fit on the Arduino SerialGateway to send out alert messages.

      Can anyone help me to solve the problem...

      posted in Troubleshooting
      ruxu
      ruxu
    • RE: [SOLVED] Help needed - how to access node data in gateway code for usage in SMS alerts over GPRS?

      @ruxu

      As an occasional coder I finally managed to figure it out myself after about five hours of trying and Googling....

      Created some additional global extern variables in the MyGateway.cpp that takes their values from msg.sender, msg.sensor and msg.getString. Now I just have to start to code the conditional alert functions for triggering the SMS message sending...

      posted in Development
      ruxu
      ruxu
    • [SOLVED] Help needed - how to access node data in gateway code for usage in SMS alerts over GPRS?

      Hi everyone!

      I am making a monitoring system with several sensor nodes that will be setup in two versions,

      • a full system with nodes, gateway and controller with openHAB
      • a light version without a controller where the gateway has a GPRS shield. Additional code will send out SMS alert messages when certain node data conditions are met

      I have set up a node sending battery level and temperature to the gateway. Then I have tried to figure out how to get the values marked with red rectangles into variables for usage in the GPRS/SMS alert message code but so far I have not succeeded.

      Gateway.jpg
      Can anyone give me a hint in the right direction?

      posted in Development
      ruxu
      ruxu
    • RE: PIR sensor with nRF24L01+ transmitter gives false alarms if supply voltage over 2,98 volts

      I have povered the circuit both from batteries, a step up converter and from an external power supply. In all cases the PIR self trigger problem starts when the voltage is higher than about 2,98 volts...

      posted in Troubleshooting
      ruxu
      ruxu
    • PIR sensor with nRF24L01+ transmitter gives false alarms if supply voltage over 2,98 volts

      Hi everyone!

      I am building a sensor network system based on nRF24L01+ transmitters and I have a problem with my PIR movement detection sensor. The sensor consists of,

      • Arduino Mini Pro 3.3V with voltage regulator and LED removed
      • Seeedstudio SEN-116A2B PIR sensor with voltage regulator removed
      • Dallas DS18B20 temperature sensor

      The sensor is transmitting temperature, PIR movement status and battery voltage every 15 minutes, in between that the Mini Pro is sleeping only detecting PIR movement that is wired from the PIR out to pin 3 of Mini Pro and handled as an interrupt in the code.

      The whole setup worked for perfectly for days on 2 used AA batteries with a voltage between 2,97...2,94 volts. Then I at some point put in fresh batteries with a voltage around 3,1 volts.

      With the fresh battery voltage the PIR started to trigger by itself in about 4...5 second cycles!?!? What could the reason for this be? Any correction suggestions?

      So far I have found out the following,

      • if I disconnect power from the nRF24L01+ transmitter the PIR stops self triggering
      • a smoothing capacitor on the nRF24L01+ power pins is of no help
      • if I supply separate 3,1V battery power to the nRF24L01+ from a second battery set everything works OK
      • the problem starts randomly to occur if I supply power at a voltage over 2,98 volts and at about 3,05 volts it is continuous

      I have now spent two days trying to solve this problem with different capacitor additions in the power supply line but nothing I have tried has helped. Anyone had a similar problem and solved it?

      Any help greatly appreciated!

      posted in Troubleshooting
      ruxu
      ruxu