Git Product home page Git Product logo

maynuo_load's Introduction

Maynuo M9[78]xx Library

This repo contains a simple python3-based implementation of a wrapper for controlling Maynuo electronic loads. My load is an M9812. It is the only one I have tested.

Setup

maynuo.py is a simple library with few extra dependencies, except for serial which you can install via pip or your package manager, and crcmodbus, which you can install with pip.

A little warning

Most of the Maynuo products have a DB-9 connector on the back that looks like it is for RS-232. Though it is for serial, the voltage levels it expects are TTL, not RS-232, which uses 12V signals. If you hook up a "real" serial port to this connector, you will be unhappy.

You can use any of the common FTDI or similar USB-to-serial adapters, and wire them into a DB-9 cable. Alternatively, you can purchase one of Maynuo's cables for the purpose, which also provide galvanic isolation.

Use

Using the library is hopefully straightforward.

First, instantiate a library object:

import maynuo

port        = '/dev/ttyUSB0'
speed       = 9600
device_addr = 1

m = maynuo.MaynuoLoad(port, speed, device_addr)

Note that the speed and device_addr can be adjusted from the front panel of your load.

Once you have an object to work with, you can just issue it commands. For example, do run down a battery, you can do:

v_terminal = 3.000
i_run      = 1.000

m.setReg('BATT', 0)
m.battTest(i_run, v_terminal)
m.inputOn()
while True:
    op = m.getOperatingPoint()
    print(op)
    if op['v'] <= v_terminal or op['i'] <= 0:
        break

Note that in battery mode, you have to turn the input on, but the device itself will turn the input back off when the voltage drops below the terminal voltage you specified. The break in the snippet above is just so that the python exits; the unit will already have turned itself off when that clause is true.

In addition to battery discharge mode, you can easily set up any of the other simple modes with .setCC(current), .setCV(voltage), .setCR(resistance), and .setCP(power).

You can also access any named register on the device using .getReg(n) and .setReg(n,v)

There are many other modes and functions on these units that I have not explored, but it should be possible to access them all by the register interface provided.

Acknowledgements

This code was based in part on MaynuoPi

maynuo_load's People

Contributors

djacobowitz-cmt avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.