Navigation

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

    Posts made by boylucky

    • RE: 4MHz bootloaders

      Looks I succeed. I had to change the LOW fuses to correct value. I modified the APM Optiboot bootloader to accept 4MHz external oscilator. Here is the correct settings which need to be add to the boards.txt file:

      ##############################################################
      
      apm96_4MHz.name=APM Optiboot external 4MHz noBOD 38400baud
      
      apm96_4MHz.upload.tool=avrdude
      apm96_4MHz.upload.protocol=arduino
      apm96_4MHz.upload.maximum_size=32256
      apm96_4MHz.upload.speed=38400
      apm96_4MHz.bootloader.tool=avrdude
      apm96_4MHz.bootloader.low_fuses=0xfd
      apm96_4MHz.bootloader.high_fuses=0xde
      apm96_4MHz.bootloader.extended_fuses=0x07
      apm96_4MHz.bootloader.path=optiboot_v50
      apm96_4MHz.bootloader.file=atmega328_1a_4MHz.hex
      apm96_4MHz.bootloader.unlock_bits=0x3F
      apm96_4MHz.bootloader.lock_bits=0x2F
      apm96_4MHz.build.mcu=atmega328p
      apm96_4MHz.build.f_cpu=4000000L
      apm96_4MHz.build.core=arduino
      apm96_4MHz.build.variant=standard
      
      ##############################################################
      

      I had to change following lines:
      apm96_4MHz.upload.speed=38400
      apm96_4MHz.bootloader.low_fuses=0xfd
      apm96_4MHz.build.f_cpu=4000000L

      I also changed the file name to: apm96_4MHz.bootloader.file=atmega328_1a_4MHz.hex but the file is exactely the same as the original one. I also changed the name in the beginning of each line.

      Currently looks it is working well. I will add more info later if all runs ok after some testing.

      And here is also nice FUSES configurator.

      posted in Development
      boylucky
      boylucky
    • RE: 4MHz bootloaders

      Actually the capacitance of the battery is not a problem for now. The time of wake up intervals and listen period can be changed. What I need to solve is the 4MHz bootloader.

      posted in Development
      boylucky
      boylucky
    • RE: 4MHz bootloaders

      Yes, I need the serial communication also during the operation of the chip. That is the reason why I want to switch to 4MHz. The node is in sleep mode for 8 seconds. Then it wake up for 500ms to listen if any communication is received on NRF24L01+. Then also every 15 minutes, the node is transfering received data from NRF24 to Sigfox backend (6 sensors values in one message) via LoRa module. Currently I tested 11 days running on 1MHz without problem. The voltage drop after this 11 days is about 0,3V. So on 2AA NiMH bateries it should last for about 1 month without bateries charging. There is required serial communication between ATMEGA328P and Sigfox. That is the reason for 4MHz.

      posted in Development
      boylucky
      boylucky
    • RE: 4MHz bootloaders

      You are right it looks like a good solution for such project. But I wanted to keep the project running on AA NiMH bateries as for me it is safe way let's say ☺ As I do not have any experiences with LiFePO4 and also no charger for them. But I should start focus also on such power supply in the future. Anyway, like you said it is a bit different topic ☺ but thanks anyway for your reply.

      posted in Development
      boylucky
      boylucky
    • RE: 4MHz bootloaders

      For me it looks like the best solution when I want to run the node for 2AA batteries without power regulator. As the spec of ATMEGA328P is that with 4MHz it can run from 1.8V. Which is exactely 2AA NiMH bateries at the end of the capacity. Then I also do not want to use 1MHz internal oscilator as it makes sometimes troubles when serial communication is used. So that is the reason for 4MHz node.

      posted in Development
      boylucky
      boylucky
    • 4MHz bootloaders

      Hi all,
      I would like to ask you about 4MHz bootloaders for ATMEGA328P. I make a project where I want to use ATMEGA328P running on 4MHz with external oscilator. Is there any possibility how to convert bootloaders to 4MHz? Or are there any already created? Currently I was using mostly APM Optiboot internal 1MHz noBOD 9600 BAUD bootloader. Would be there possibility to convert it to 4MHz external?

      Here is info about the APM Optiboot bootloader if needed.

      But anyway, it can be any other bootloader which would be converted to 4MHz.

      Thanks.

      posted in Development
      boylucky
      boylucky
    • MQTT vs Serial Gateway

      Hi all,
      I am sory for this stupid question but I still do not understand correctly the MQTT. Currently I build my first mysensors network with SerialGateway connected to RPi with Domoticz and it is working ok. I was just wondering what is the MQTT gateway good for and what are the differences and advantages when compared with SerialGateway. Does MQTT gateway affect only the communication between Controller (RPi with Domoticz) and MQTT gateway or it also have impact on the Gateway and nodes communication? Is the whole system more stable with MQTT or what is it good for in comparison with serial gateway.

      Thanks in advance for your explanation.

      posted in General Discussion
      boylucky
      boylucky
    • RE: Serial Gateway + NRF24 with sleep mode enabled there

      @wikibear - no problem 🙂

      posted in General Discussion
      boylucky
      boylucky
    • RE: P2P long range communication - RFM95 with mysensors

      @neverdie - by the way. Would be there some easy solution for RFM95 as a gateway? I mean following. There would be gateway or maybe better to say forwarder which would take data from NRF24 and will resend them via RFM95 to another RFM95 which would be connected to the gateway. Is there some direct way in mysensors? If not what about to have 2 nodes which would be connected via serial communication (RX and TX pins). One node would have NRF24 and second one would have RFM95. Node with NRF24 would be set as serial gateway. Then node with RFM95 would be only a simple sketch where serial communication received will be send via RFM95 as P2P communication to the gateway with RFM95 which will be then connected to internet via Wiznet 5100 for example.

      Reason why I would like to have it is the fact that the garden is without the external power source and I need to reduce it as much as possible. Then it is also far for the NRF24 to reach directly the gateway. I also want to reduce the cost of the network so I want to use mostly NRF24 as cheaper alternative.

      posted in Hardware
      boylucky
      boylucky
    • RE: P2P long range communication - RFM95 with mysensors

      Ok, great. Thanks.

      posted in Hardware
      boylucky
      boylucky
    • RE: P2P long range communication - RFM95 with mysensors

      ok, thanks. I will try it. Would you have some more info regarding the possible libraries and how does it work with mysensors experiences?

      By the way I already found some more comments on your page:
      https://www.openhardware.io/view/395/LoRa-Ra-01-ATmega328P-Node

      posted in Hardware
      boylucky
      boylucky
    • P2P long range communication - RFM95 with mysensors

      I would like to ask you regarding P2P LoRa modul - RFM95 or some other. I need to create P2P communication between far points (in first case about 400 meters in urban area, NRF24l01+ was not sufficient as there are trees and buildings between these points; in second case about 10 km far in unoccupied area). So I was thinking to do it with RFM95 module and arduino. I see there is many modules on the ebay. Would you have any advice which one to select? It need to operate in EU so 868 MHz. + What library then to use. I plan to use it with 2AA batteries.

      Thank you in advance for your help.

      posted in Hardware
      boylucky
      boylucky
    • RE: does MySensors use a guaranteed transport protocol or a best effort ?

      @mfalkvidd and @hek - ok, thanks for this info 🙂 I did not know that as I am new in mysensors. Good to know that it is already implemented in mysensors.
      Thanks.

      posted in General Discussion
      boylucky
      boylucky
    • RE: does MySensors use a guaranteed transport protocol or a best effort ?

      @dualarrow - what about to try implement a mechanism that would send the same message which was received by the controller or better by the gateway back to the node. Then the node would check if such message received and the node will be sure that the message arrived or in your question vice versa (node would send the message back to the gateway).

      posted in General Discussion
      boylucky
      boylucky
    • RE: Serial Gateway + NRF24 with sleep mode enabled there

      @wikibear - what do you mean exactely? If you mean to use it for specific time communication (gateway and sensor will know the exact time when to comunicate) then it is not suitable as the timer in the arduino is not that accurate. It would require to have real time chip included in both devices. It would not be a problem for the gateway but to have it in each sensor, it could make everything more expensive. So I prefere the way I am trying to do. Sensor will send data about every 15 minutes and the gateway will be on for 500ms after 8 seconds of sleep. During those 500ms it will check if the sensor is trying to send data, and if so then it will stay awake until the communication is done. Of course, the sleep and wake perion can be change, depend on the requirements (number of sensors and update periods of the sensors).

      posted in General Discussion
      boylucky
      boylucky
    • RE: Serial Gateway + NRF24 with sleep mode enabled there

      I have set MY_PARENT_NODE_IS_STATIC, MY_PARENT_NODE_ID, and perhaps MY_PASSIVE_NODE as you adviced.
      Regarding MY_TRANSPORT_WAIT_READY_MS I do not see how it could help with the sleep mode of the gateway. Can you describe more what did you mean?

      About isTransportReady (void) - I expected that when I use it it will avoid going to sleep if data are comming from NRF24 to be processed. But it did not behave this way. I used following (but tried many other modifications)

      #if defined(MY_REPEATER_FEATURE)
       while (!isTransportReady())
        {
           _process();
        }
        int8_t result = MY_SLEEP_NOT_POSSIBLE;	// default
        transportPowerDown();
        result = hwSleep(sleepingMS);
        startL();
        return result;
      #else
        uint32_t sleepingTimeMS = sleepingMS;
      

      But it happen that the gateway is going to sleep even the messages are comming. But I guess it only from the debuging of messages (maybe there is delay between the incomming messages and printing the debug output to serial).

      Regarding your advice about RF24_SET_ARD and RF24_SET_ARC - if I understand it correctly then I am not able to set a long retry period to be able to wait for the Gateway to wake up. Do you know if there is any other option how to set it there? For now I used the mentioned repeat function which is in the post above.

      Can I ask you if there is some settings which is telling to the node that it is sending ping commands to the gateway and how to disable it or use it especially for this scenarious when the node will be waiting the gateway to wake up and send the data then.

      posted in General Discussion
      boylucky
      boylucky
    • RE: Serial Gateway + NRF24 with sleep mode enabled there

      @mfalkvidd - Only difference with Sigfox LoRaWAN and P2P LoRa is from my point of view the amount of data you can send. With Sigfox LPWAN node you are limited to 140 messages per day with max 12 bytes of payload in one message. You can send only 4 downlink messages.

      posted in General Discussion
      boylucky
      boylucky
    • RE: Serial Gateway + NRF24 with sleep mode enabled there

      Currently LoRaWAN as Sigfox solution is used. But later on I would like to also test the LoRa for P2P communication as it would definitely suit better for such situations where garden is far from home. Till now I have no experience with P2P LoRa communication and modules.

      posted in General Discussion
      boylucky
      boylucky
    • RE: Serial Gateway + NRF24 with sleep mode enabled there

      @gohan - I am trying to build a solution for more scenarious. For a small garden with just couple of sensors I can imagine that the LPWAN with NRF24 will be good enough. Then for bigger gardens would be better to use long range radious or some other soulutions. In my case I am about 500m from the garden. There are buildings and trees between my home and garden. I wanted to use some cheap solution. So I wanted to make it with NRF24. I tested the long range NRF24 but it was not reliable for this distance with buildings and trees between. But like I said I would like to make a project where more solutions will be available to fit more scenarious to let people re-use it.

      posted in General Discussion
      boylucky
      boylucky
    • RE: Serial Gateway + NRF24 with sleep mode enabled there

      @mfalkvidd - thanks for your reply. I will have a look to what you suggested. Currently I solved the problem of node thinking that gateway is always on with this code on the node sketch (I used the default sketch for DHT11 sensor from mysensors and added following functions (first 2 are just to have possibility to power up and power down the DHT11 sensor from a pin, the third function to catch the gateway in the wake up mode):

      void powerUpDHT()
      {
        // power up DHT11 sensor - PIN 5
        digitalWrite(DHT_POWER_PIN , HIGH);
      }
      
      void powerDownDHT()
      {
        // power down DHT11 sensor - PIN 5
        digitalWrite(DHT_POWER_PIN, LOW);
      }
      
      
      void repeatSend(MyMessage &msg, int repeats)
      {
        int repeat = 0;
        int repeatdelay = 990;
        boolean sendOK = false;
      
        while ((sendOK == false) and (repeat < repeats)) {
          if (send(msg)) {
            sendOK = true;
            Serial.print("ACK packet received: ");
          } else {
            sendOK = false;
            Serial.print("Repeat sending: ");
            Serial.println(repeat);
            //repeatdelay += 250;
          } 
          repeat++;
          wait(repeatdelay);
        }
      }```
      posted in General Discussion
      boylucky
      boylucky
    • RE: Serial Gateway + NRF24 with sleep mode enabled there

      Just one more add. Looks I succeed with some stupid modification. Definitely not a good solultion but looks it is working for now.

      In file MyTransportNRF24.cpp I added this function

      void startL()
      {
      	RF24_startListening();
      }
      

      And in file MySensorsCore.cpp following modification in _sleep function

      #if defined(MY_REPEATER_FEATURE)
        int8_t result = MY_SLEEP_NOT_POSSIBLE;	// default
        transportPowerDown();
        result = hwSleep(sleepingMS);
        startL();
        return result;
      #else
        uint32_t sleepingTimeMS = sleepingMS;
      

      It is definitely stuppid solution but for now it looks it is working as I wanted 😊

      posted in General Discussion
      boylucky
      boylucky
    • RE: Serial Gateway + NRF24 with sleep mode enabled there

      @gohan - you are right. There is not much sense to have the gateway on the garden. To explain it a bit more. I wanted to create a device which would mix a LPWAN with NRF24. I already have some code for it which do not use mysensors at all. It is still work in progress but it collect data from couple of NRF24 and every 15 minutes it send the data via LPWAN Sigfox module to backend. I was thinking to implement similar solution with mysensors libaries. I understand that it does not give much sense to do so (especially in case that Sigfox LPWAN is very limited by transmited data and lets say no download link at all), but I would like to give it a try. I also need to say that I am new in mysensors and I did first testing of it just today 😊

      Another thing is that if I would be able to access some wifi network on the garden I would use ESP8266 as gateway with NRF24 if possible. Then I can imagine that it would give sense to have such device which would have power down mode enabled for most of the time which I can see like a good solution for smaller systems.

      But like I said, I am new in mysensors project so maybe I do not have enough overview about it yet, then sorry for asking stupid questions here.

      posted in General Discussion
      boylucky
      boylucky
    • Serial Gateway + NRF24 with sleep mode enabled there

      Hi all,
      I am creating a project where I want to reduce the power consumption of the Serial Gateway too. I would like to modify the mysensor library to enable sleep function also on the Serial Gateway. Would be that possible? My idea is as following:

      I would set up network where the nodes are sleeping for 15 minutes and then will wake up and send sensor data to Serial Gateway via NRF24. Serial Gateway (arduino + NRF24) would be sleeping for 8 seconds and wake up for 1 second and wait if any data received on the NRF24. If not then the gateway will go sleep again for 8 seconds. If any communication triggered then it will do all what is needed.
      The node will wake up every 15 minutes and will send sensors data to gateway. If no ack packet received back it will know that the gateway is sleeping and will resend the data again after 990 ms. It will repeat at most 8 times to be able to catch the serial gateway at the time when it is waked up.

      Just to make it more clear. This is going to be a garden project where no power supply is available. I am going to run everything on the batteries. I already tested different approach without mysensors solution. But I am thinking to implement mysensors there too.

      Any help will be appreciated.

      Thank you in advance.

      posted in General Discussion
      boylucky
      boylucky