element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Remote Monitoring & Control
  • Challenges & Projects
  • Project14
  • Remote Monitoring & Control
  • More
  • Cancel
Remote Monitoring & Control
Blog LoRa Experimental Environmental Sensors (LoRaXes) - Temperature Sensor Working
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Remote Monitoring & Control to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ralphjy
  • Date Created: 28 Jul 2019 5:41 AM Date Created
  • Views 1150 views
  • Likes 5 likes
  • Comments 1 comment
  • bme280
  • remotemonitoringcontrolch
  • mkr wan 1300
  • wan_1300
Related
Recommended

LoRa Experimental Environmental Sensors (LoRaXes) - Temperature Sensor Working

ralphjy
ralphjy
28 Jul 2019

The temperature sensor that I selected is the BME280.  It measures humidity and barometric pressure in addition to temperature.  The particular version that I'm using interfaces over I2C.  There are other versions that will interface with I2C or SPI at the expense of a slightly larger PCB due to the additional 2 pins required for SPI.

 

image

 

I decide to test the temperature sensor code using my second MKR 1300 so that I could verify that it is also working.  The module that I am using is compatible with the Adafruit BME280 Arduino library so the part of the code that interfaces to the sensor is straightforward.  Then I needed to format the data for transmission to the TTN interface and also write a payload decoder for the data when it is received at the TTN console.

 

I should note that I'm still having some difficulty getting the devices to connect to TTN reliably.  Once I get connected everything works well but whenever I go through a program update cycle it takes multiple tries to reconnect.  Very frustrating in the development cycle.  The double reset that I thought was helping was just a 'red herring'.  It just coincidentally worked a few times in a row, but it really doesn't work consistently.  I've added a loop that attempts to connect for 10 times before quitting and that helps but doesn't completely solve the problem.  I tried changing connection modes from OTAA (over the air activation) to ABP (activating-by-personalization) but in ABP mode I don't see any traffic on my gateway even though the joinABP function returns a value indicated that I'm connected.  And I don't receive any data in the TTN console.  I probably don't have something set up correctly for that mode.  I have seen some references in forums that it may be the MKRWAN library that has issues.  I probably have to live with it for now.

 

Once I get connected things work fine.

 

Here's a log from the serial console on startup:

image

 

 

Here is a screenshot of the data in the TTN console:

image

 

And a closer look at one of the decoded JSON data packets:

image

 

And TTN has an integration that will provide temporary database storage (7 days).  Here is data extracted by query from the database:

 

[

  {

    "altitude": 35,

    "battery": 3.1,

    "bytes": "GlEQdCdqAV4BNg==",

    "device_id": "mkrwan2",

    "humidity": 42.12,

    "pressure": 1009,

    "raw": "GlEQdCdqAV4BNg==",

    "temperature": 27.370000000000005,

    "time": "2019-07-28T03:15:36.34884366Z"

  },

  {

    "altitude": 35,

    "battery": 3.1,

    "bytes": "GlMQbSdqAV4BNg==",

    "device_id": "mkrwan2",

    "humidity": 42.05,

    "pressure": 1009,

    "raw": "GlMQbSdqAV4BNg==",

    "temperature": 27.39,

    "time": "2019-07-28T03:16:36.335962617Z"

  },

  {

    "altitude": 35.3,

    "battery": 3.1,

    "bytes": "GlMQYSdqAWEBNg==",

    "device_id": "mkrwan2",

    "humidity": 41.93,

    "pressure": 1009,

    "raw": "GlMQYSdqAWEBNg==",

    "temperature": 27.39,

    "time": "2019-07-28T03:17:36.332603088Z"

  }

]

 

The altitude data is derived from a presumed barometric pressure at sea level, so it isn't very accurate and varies quite a bit over time.  I'm just going to rely on the GPS data for altitude.

 

I guess it's time to package everything up and hopefully I can work through some of these issues afterwards.

  • Sign in to reply
  • noorpuri
    noorpuri over 6 years ago

    Add few lines about BME280 sensor features. So reader will be able to know about sensor instantly, rather to open or search product web page.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube