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
Experimenting with Waterproof Connectors
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Waterproof Connectors
  • More
  • Cancel
Experimenting with Waterproof Connectors
Blog Panda Enclosure - Extra Credit Blog #3 - Sensor Software Development
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experimenting with Waterproof Connectors to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ralphjy
  • Date Created: 5 May 2023 6:51 PM Date Created
  • Views 1056 views
  • Likes 9 likes
  • Comments 6 comments
  • lattepanda
  • mqtt
  • hammond ip68 enclosure
  • arduino leonardo
  • wmic
  • water leak sensor
  • node-red
  • thermistor
  • open hardware monitor
  • bme680
  • experimenting with Waterproof Connectors
Related
Recommended

Panda Enclosure - Extra Credit Blog #3 - Sensor Software Development

ralphjy
ralphjy
5 May 2023

I am making good progress toward completing the sensor software that I need for my thermal and submersion testing.  I thought it would be a good time to elaborate what I am doing.  The final implementation details and code will be covered in the Final Summary Blog.

I am going to implement the following sensors:

  1. lattePanda core temperature and power
  2. enclosure environment (temperature, humidity, pressure, gas, altitude)
  3. internal thermistor
  4. external thermistor
  5. water leak detector (this is a new addition)

image

Software Selection

Limited space on C drive

I thought that it is necessary to mention that I made different software choices than I might normally have used for development because of the lack of "disk" space on the lattePanda.  The units that were provided for the challenge had 2GB of RAM and 32GB of eMMC memory that is used for the Windows C drive.  I had hoped that there might be 10GB of free space on the drive, but out-of-the box there was only 4-5GB available (this value varies because the disk is also used for swap space).

image

I had hoped for some low hanging fruit (files to delete), but there was nothing obvious like restore points or downloaded update files to delete.

image

A quick look showed that WIndows itself (not surprisingly) was the biggest culprit.

image

And the largest component was WinSxS.  What is WinSxS?  WinSxS (short for “Windows Side by Side”) is a folder where Windows stores files required for installing Windows and backups or versions of those files.  Whenever you need to recover system files or add or remove Windows features, this is where Windows will search for the files required to perform an action.

image

Of course, Microsoft has a caveat:

image

But it provides a tool in Task Scheduler - StartComponentCleanup - to do the job safely.

image

Unfortunately, it is set to run automatically and has run in the past week - so that doesn't help (although I did try re-running it).

So, that leaves me with a couple of options:

  1. Use a different OS with a smaller disk footprint - like Linux (I think that one of the other challengers is doing this)
  2. Restrict development software to tools that do not have a large disk space requirement

I decided for option 2 as the simplest for moving ahead with the challenge.  Maybe to make the lattePanda more useful after the challenge I'll switch to Linux.

 

Selected tools

My primary requirements are to operate sensors using the integrated Arduino co-processor and to make the sensor data available remotely.

Here are the set of tools that I decided to use:

  1. TightVNC
  2. Open Hardware Monitor
  3. Arduino IDE (version 1.8.16 was already pre-installed)
  4. Node.js
  5. Node-Red

The total footprint for the software that I'm using is about 500MB and the largest component is the Arduino IDE which was already installed (350MB).

 

BME680 Program

Shown below is the hardware setup.  I am using an Adafruit BME680 module with QWIIC connectors and I have it plugged into the Arduino header I2C pins on the lattePanda using a QWIIC to male pin cable..

image

image

The integrated Arduino component shows up in the IDE as a "LattePanda Leonardo" board on COM3:

image

I needed to install the Adafruit_Sensor and Adafruit_BME680 libraries.  Running the "bme680test" example from the Adafruit_BME680 library produced the following output:

image

  

Thermistor Program

Shown below are the 100K NTC (negative temperature coefficient) thermistors that I am using.

image

The internal thermistor will be connected between the A1 pin and +5V with a 100K pulldown between A1 and ground as shown below.  I haven't decided which point on the lattePanda board that I will monitor with it.  I'll try getting a thermal image of the board to see if there are any points of interest.  The external thermistor will have the same attachment to A2.

image

Doing an analogRead(A1) at 1 second intervals produces a fairly noisy plot.  I'll probably need to add a capacitor across the pulldown resistor.

image

A quick try using a 30 point moving average does a good job of smoothing.  The peak is caused by holding the thermistor between my fingers.  I'll need to take some data to get an analog value to temperature correlation.

image

  

Uploading Sensor Data

The lattePanda documentation recommends using Arduino Firmata and Windows apps written with C# using Visual Studio to interface with GPIO pins and sensors on the Arduino.  I decided not to go that route because of the lack of availability of free disk space.  A similar approach using Firmata with Python would require less disk space, but I decided the simplest approach would be to interface the Arduino program communicating with Node-Red through the Serial Port using JSON strings.  Node-Red will also allow me to access the Open Hardware Monitor data using WMIC.

Install node.js

I downloaded the 64-bit Windows Installer (.msi) and installed node.js.  This is required to run Node-Red.

Install Node-Red

Node-Red is installed using the package manager from the command prompt - npm install -g --unsafe-perm node-red.
I did not install node.js build tools because they require too much disk space. 

Within Node-Red I needed to install two additional pallettes to get the serial port interface and dashboard nodes.  My current pallette looks like this:

image

 

Arduino Program Changes

I want to format the sensor data as JSON strings to upload via the serial port.  This required adding the ArduinoJson library to my program to include the formatting functions.

image

 

Node-Red Flow

Interface Nodes

I need 3 communication interfaces (nodes) to process the sensor data:

  1. Serial Port to get data from the Arduino
  2. Exec to get data from the Open Hardware Monitor
  3. MQTT to upload the data to the network

 

Serial Port Nodes

image

image

image

 

Exec Node

image

image

image

I am using WMIC (Windows Management Instrumentation command-line) to read the outputs from the Open Hardware Monitor (OHM).  OHM needs to be running.

image

Then the following command line will e.g. extract the CPU Core #1 Temperature:

wmic /namespace:\\root\OpenHardwareMonitor path sensor where "Name like '%CPU Core #1%' and SensorType='Temperature'" get Value /value

This is the command that I am using in the exec node.

 

MQTT Nodes

image

This particular node is configured to send data to a Node-Red Dashboard that I have running on a RPi4 on my LAN.

image

image

 

lattePanda Flow

image

 

Node-Red-Dashboard

image

Next Steps

I need to finish the Arduino program to add the two thermistors and the water leak detector.  This will require some testing and calibration.

I am still waiting for the boot/backshell for the external RJ45 cable.  This will require drilling a couple of mounting holes in the enclosure, so I can't assemble the enclosure until that is finished.

I am also trying to figure out how to fixture the submersion test.  I am not going to test it at the rated 1 meter depth as I am not equipped to do that.  I just want to test it fully submerged in a setup where I can abort quickly if a large leak is visually detected.

  • Sign in to reply
  • me_Cris
    me_Cris over 2 years ago

    This is very nice. I heard about MQTT, but I didn't know what I could use it for. But I'm still curious.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • JWx
    JWx over 2 years ago

    Great, detailed post!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 2 years ago

    Nice update.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • beacon_dave
    beacon_dave over 2 years ago in reply to ralphjy

    Yes, that was earlier on today. I've not really been following it though.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ralphjy
    ralphjy over 2 years ago in reply to beacon_dave

    Thanks, but I went down the dism rathole before looking for image corruption and also scanned the drive with sfc.

    The size reported for WinSxS was accurate.

    image

    I guess the coronation must be over?

    • 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