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 Current Sense Amplifiers
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Current Sense Amplifiers
  • More
  • Cancel
Experimenting with Current Sense Amplifiers
Challenge Blog Blog #5: My Python and C Libraries are available now
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: misaz
  • Date Created: 25 Apr 2022 3:13 PM Date Created
  • Views 1379 views
  • Likes 8 likes
  • Comments 5 comments
  • Current 6 Click
  • MikroE Click Board
  • raspberry pi
  • csa
  • current sense amplifier
  • MAX40080
  • Experimenting with Current Sense Amplifiers
Related
Recommended

Blog #5: My Python and C Libraries are available now

misaz
misaz
25 Apr 2022

Hello everyone. I welcome you to my 5th blog post as part of Experimenting with Current Sense Amplifiers Design Challenge. This blog is very short because I am very busy at the time of writing this blog post and I have no time to write proper blog.

Last weekend I published first version of both my Libraries targeting MAX40080 CSA sensor which we use as part of design challenge. Both Libraries are at available online the Github.

Python library for Raspberry Pi is at: https://github.com/misaz/MAX40080-PythonLibrary

C library for microcontrollers is at: https://github.com/misaz/MAX40080-Library

Both Libraries were partially tested, and at least basic features should work.

C Library

C Library contains implemented 4 examples that are linked at main page of library:

image

If you click at description link, you will get redirected to the details page of corresponding example. All examples are currently implemented for MAX32625 MCU. For now, if you use different MCU then you will need to port the library yourself. Later I plan to add support for some other platforms. Every example description page contains description of example, example code, detailed description of every part of code and MAX32625 port specific details.

Python Library

I originally want to develop only C library but based on multiple requests I created Python library also. It is simple and support only basic features of sensor for now. You can install it by executing following command in terminal:

pip3 install git+https://github.com/misaz/MAX40080-PythonLibrary

Then, you can create very simple Python file max40080_test.py with following content:

from max40080 import MAX40080

max = MAX40080()
max.configure()
print(max.read_current())

And then you can execute your python script:

python3 max40080_test.py

You should see one current measurement on the screen.

Library provides 7 functions to you. They are mentioned (with optional parameters) at main page in Github repo:

image

Feedback

Both libraries are available to everyone. Everyone can freely use them. Even I tested them, they may still be some bugs. Kindle report them below in comments or at GitHub.

Last words

For now, it is all. Thank you for reading this blog. Soon I will post more detailed blogs about my libraries. Because I am very busy this week I will complete and post these blogs at the end of the week or most probably at the weekend.

Next blog: Blog #6: MAX40080 C Library

  • Sign in to reply
Parents
  • guillengap
    guillengap over 3 years ago

    Hi misaz  Thanks for sharing your libraries, just two small things: 1) Is it possible to use your C++ library on a MAX32620FTHR board in Mbed OS?; and 2) Is it possible to measure microamps with your python library? ... good luck

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • misaz
    misaz over 3 years ago in reply to guillengap

    Thank you for feedback.

    1) Yes it is but I dont have MAX32620FTHR, so I cant test it. But I have different Mbed OS enabled board, so I will provide port maybe this weekend.

    2) Python library returns value in Amperes, so you can multiple it by 1000000 for getting uA, but note that conversion to uA does not make sense very much because resolution of sensor with 10mOhm shunt resistor is 1.22 mA. For conversion to mA instead of uA just multiple value by 1000.

    If you are adavenced user and want to reduce floating point computation error, you can update directly source code of the library (https://github.com/misaz/MAX40080-PythonLibrary/blob/main/max40080/max40080.py). Change constant 1.25 to 1250 in functions read_current and read_current_and_voltage functions. You can download library source code directly to your project folder or you can edit file on your disk. By default pip3 installed it to the ~/.local/lib/python3.9/site-packages/max40080/max40080.py file. You need to replace python version in the path.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • misaz
    misaz over 3 years ago in reply to misaz

    Update 2022-05-02: I am very busy at this time so I was unable to port library to Mbed this weekend, so I will try next weekend.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • misaz
    misaz over 3 years ago in reply to misaz

    Update 2022-05-02: I am very busy at this time so I was unable to port library to Mbed this weekend, so I will try next weekend.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
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