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
NI LabVIEW Community
  • Products
  • Dev Tools
  • NI LabVIEW Community
  • More
  • Cancel
NI LabVIEW Community
LabVIEW Challenge Blogs Solar Home System Monitoring using LabVIEW & Raspberry Pi Pico
  • Blog
  • LabVIEW Challenge Blogs
  • Forum
  • Documents
  • Quiz
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join NI LabVIEW Community to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: taifur
  • Date Created: 25 Oct 2023 4:27 PM Date Created
  • Views 3003 views
  • Likes 8 likes
  • Comments 15 comments
  • test automation
  • labview 2023
  • pico and labview
  • LAbVIEW challenge
  • visa
  • A Course in LabVIEW and Test Automation
  • scpi
Related
Recommended

Solar Home System Monitoring using LabVIEW & Raspberry Pi Pico

taifur
taifur
25 Oct 2023

Introduction

In this blog post, I will show how I made a monitoring system for my home solar using LabVIEW and Raspberry Pi Pico. I was aware of the National Instrument LabVIEW program but had never used it before. After enrolling in NI LabVIEW RoadTest I downloaded the Community Edition of LabVIEW and started exploring it. Soon I discovered the potential of LabVIEW and realized the easiness of the tool. I completed all the lessons and quizzes from the RoadTest page and from lesson 10 I came to know about the SCPI tool for communication with Raspberry Pi Pico from the LabVIEW. I read "Have you worked with the Pico SCPI labTool?" by shabaz and "Program the Pico SCPI labTool" by Jan Cumps and got a clear idea about VISA and SCPI tools. Thanks to both of them for their contribution.

I downloaded the Pico Firmware and LabVIEW Virtual Instrument driver with examples from GitHub. I transferred the pico_scpi_usbtmc_labtool.uf2  to my Raspberry Pi Pico, connected an LED to GPIO 22, and opened the Example_digital_out_control.vi with the LabVIEW community edition.

image

image

I turned on the Enable Pin switch and ran the model. The LED was turned on. The VISA resource may not directly appear in the VISA resource control box. After connecting the Pi Pico to my computer using the USB cable I clicked on the dropdown icon from the right side of the VISA resource control box and clicked the Refresh. The VISA resource successfully appeared and was selected.

image

Monitoring Solar Panel & Battery

In my village, I installed a 700W solar system for my home. A few of my neighboring home also uses solar energy. My goal is to build a solar mini-grid by connecting all the homes so that we can share the energy whenever required. I want to automate the system with the help of LabVIEW. As a very first step, I want to measure some important parameters of my own solar home system and monitor the parameters using NI LabVIEW. I will use Raspberry Pi Pico for interfacing the system with the computer. First I want to monitor the solar panel voltage, battery voltage, charging current, and load current. For measuring 4 parameters I need four analog inputs.

The Pico Firmware currently supports two analog inputs (GPIO26 and GPIO28). It can be extended by modifying the firmware but there is an alternative solution. I can easily connect up to 4 analog sensors by using an ADS1115 module through the I2C0 port of the Pico. Thanks shabaz for bringing this functionality to the Pico firmware.

I connected the ADS1115 ADC module to Pico I2C0 (GPIO4[SDA], GPIO5[SCL]) to enable the get analog input (high resolution) function. The example folder does not contain any example for reading analog values with ADS1115. So, I made one myself with the VI library provided with the example.

image

I was able to successfully read the analog value from the ADS1115 module. The following image shows the connection between the Pi Pico and the ADS1115 module.

image

For measuring current I used a Hall sensor-based ACS712 current sensor module which is capable of measuring both DC and AC current. The ACS712 sensor is 5V compatible and provides analog output, so the output of the sensor can be connected directly to the input of the ADS1115. I used the ACS712 for measuring both the charging current and the load current. image

My solar system is a 12V system. The battery voltage is 12V and the open circuit voltage for the panel is around 22V. The voltage can not feed directly to the ADS1115 sensor. I used a simple resistor voltage divider to make the voltage compatible with the sensor.

For calculating the value of the resistors for the voltage divider I need to know the gain set for the ADS1115 in Pico Firmware. So I opened the source of the firmware and found the following ADC strategy in the comment block.

image

The ADS1115 is configured to read a maximum of 2.048V. So, I need to convert the output voltage from the battery and the solar panel to 2.048V using a voltage divider circuit.

The open circuit voltage of the solar panel is 22V. So I used 2K (1K + 1K) and 20K (10K + 10K) resistors to produce approximately 2V output for 22V panel voltage. Similarly for measuring battery voltage, I used one 10K and two 1K resistors for dividing the voltage. The schematic is shown in the figure below.

image

I modified the block diagram to convert the raw analog value to the voltage. 2.048 is the maximum voltage when the analog value is 32767. So, I multiply the analog value with the ratio of 2.048 and 32767 to get the voltage. Finally, I multiply the voltage by 6 to get the actual voltage as the voltage divider circuit provides 2V for 12V input.

image

I checked the circuit by providing variable voltage from a power supply and I was getting almost accurate results from the VI. The test circuit arrangement is shown in the image below.

image

The final circuit looks like the Fritzing schematic presented below. I did not find any 12V battery in the Fritzing library. So, I represented it with a 9V battery for reference purposes. The load is represented by an LED. The charge controller is shown by a comment block. 

image

The complete LabVIEW block diagram is shown in the screenshot given below. All 4 channels of the ADS1115 module are used for data collection. Every channel is read with a 100ms delay.

image

A close-up view of the part of the block diagram is as follows from where current and voltage calculation can be observed very clearly.

image

A screenshot of the front panel is illustrated by the screenshot attached below.

image

When the system is running the front panel shows the data collected from the Raspberry Pi Pico as given below:

image

  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 1 year ago +1
    If you want to have the analog hires example included in the LabVIEW driver, and have a github account, let me know. We could get it included in the next release, and you'd be flagged as the contributor…
  • DAB
    DAB over 1 year ago +1
    Nice project.
  • Jan Cumps
    Jan Cumps over 1 year ago in reply to taifur +1
    taifur , here's how to contribute it: Got to my repo and fork it. Use the checkbox to fork all branches, not only main clone your fork git clone github.com/.../pico_scpi_labtool_labview_driver…
  • Jan Cumps
    Jan Cumps over 1 year ago in reply to taifur

    Got it! Thank you.

    Currently in the development branch.

    image

    Next release it 'll be part of the main distribution.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • taifur
    taifur over 1 year ago in reply to Jan Cumps

    This is the file for 22.3 : drive.google.com/.../view

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 1 year ago in reply to Jan Cumps

    alternative, export as older version, and upload the Example_analog_read_highres.vi here.

    I'll then take it from there ...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 1 year ago in reply to taifur

     taifur , I got the pull request. You've done this right.

    One issue though - my lib is for an older version of LabVIEW.

    Can you:

    • make a temporary copy of your project
    • open that project (not the VI) in Labview project explorer
    • File - Save as previous version
    • choose 22.3 if you can. Else 21.0
    • copy the Example_analog_read_highres.vi VI to the github folder again (not the solar monitoring one)
    • git commit -a -m "lowered version of hires analog example"

    • git push

    and create a follow up pull request into my develop-set-7 branch?

    You can then delete the temporary copy of the project

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • taifur
    taifur over 1 year ago in reply to Jan Cumps

    Done accordingly.

    image

    • 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