Skip to content

This is a place to keep and update the bioreactor code.

License

Notifications You must be signed in to change notification settings

chiq2045/bioreactor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modules

ezophnumberLike

Communicate with the EZO pH device and sensor

mh_z16number

Make a new instance of the MH_Z16 sensor with SC16IS750PW I2C/UART bridge

max38155k

Communicate with the MAX38155k device and sensor

Typedefs

numberLike : number | string

A number, or a string containing a number.

pin : Object

A number, or a string containing a number.

ezoph ⇒ numberLike

Communicate with the EZO pH device and sensor

Returns: numberLike - value - the output of the device. this can be anything from the pH to the current status of the device. Properties

Name Type Description
i2c Object an i2c object
address number address of the device
ph numberLike the last pH value read
timeout number the time taken to carry out operation, in ms. defaults to 900, the longest time needed for any operation.

ezoph.connect()

This is 'exported' so it can be used with require('ezoph.js').connect(pin1,pin2)

Kind: static method of ezoph Example (How to use ezoph module)

//create a new instance of ph sensor
var i2c = new I2C();     // create new i2c object
var phAddress = 0x63;    // EZO pH i2c address
var sda = D23;           // setup i2c pins
var scl = D22;
i2c.setup({              // setup I2C bus
  scl:scl,
  sda:sda
});
phSensor = new ( require('ezoph') )( i2c, phAddress );

ezoph~ezoph/read() ⇒ numberLike

Reads ph

Kind: inner method of ezoph Returns: numberLike - data - value returned from device

ezoph~ezoph/calMid() ⇒ numberLike

Single point calibration at midpoint

Kind: inner method of ezoph Returns: numberLike - data - 1 if successful 2,254,255 if unsuccessful

ezoph~ezoph/calLow() ⇒ numberLike

Two point calibration at low point

Kind: inner method of ezoph Returns: numberLike - data - 1 if successful, 2,254,255 if unsuccessful

ezoph~ezoph/calHigh() ⇒ numberLike

Three point calibration at high point

Kind: inner method of ezoph Returns: numberLike - data - 1 if successful, 2,254,255 if unsuccessful

ezoph~ezoph/command(callback, comm) ⇒ numberLike

Sends specific command to ezo ph circuit

Kind: inner method of ezoph Returns: numberLike - data - 1 if successful, 2,254,255 if unsuccessful

Param Type Description
callback function
comm numberLike command to send to circuit, ie. 'sleep', or 'i'

ezoph~ezoph/clear()

Clears the command and data arrays (used before sending a new command)

Kind: inner method of ezoph

ezoph~ezoph/sendCommand(comm)

Read a command as a string

Kind: inner method of ezoph

Param Type Description
comm numberLike the command that the device will carry out

ezoph~ezoph/getData(callback, timeout)

Retreive data from device

Kind: inner method of ezoph

Param Type Description
callback function value of the data reived from device
timeout int the amount of time needed for the device to complete function. minimum is 900

mh_z16 ⇒ number

Make a new instance of the MH_Z16 sensor with SC16IS750PW I2C/UART bridge

Returns: number - - the co2 concentration measured by the device

Param Type Description
i2c Object an instance of an I2C object
address number the address of device (default is 0x9a)

Properties

Name Type Description
ppm number the last measured co2 concentration (can be used for debug)

mh_z16.connect()

This is 'exported' so it can be used with require('mh_z16.js').connect(pin1,pin2)

Kind: static method of mh_z16 Example (How to use mh_z16 module)

//create a new instance of ph sensor
var i2c = new I2C();     // create new i2c object
var co2Address = 0x47;    // EZO pH i2c address
var sda = D23;           // setup i2c pins
var scl = D22;
i2c.setup({              // setup I2C bus
  scl:scl,
  sda:sda
});
phSensor = new ( require('mh_z16') )( i2c, co2Address );

mh_z16~mh_z16/begin()

Initializes the mh_z16 sensor

Kind: inner method of mh_z16

mh_z16~mh_z16/calZero()

Calibrate the zero level for ppm Must be done in normal air ~ 400ppm

Kind: inner method of mh_z16

mh_z16~mh_z16/send(data)

Send data to the MH_Z16

Kind: inner method of mh_z16

Param Type Description
data Array an array of 9 integers to send to the device

mh_z16~mh_z16/parse(data) ⇒ Array

parse the device data and calculate ppm bytes (2 - 5) are the actual values of the co2

Kind: inner method of mh_z16 Returns: Array - ppm - an integer value of the ppm concentration

Param Type Description
data Array a 9 element array

mh_z16~resultCallback ⇒ number

Measure the co2 Concentration

Kind: inner typedef of mh_z16 Returns: number - - the value of the concentration, or 0, when there is a problem Example (How to use mh_z16.measure)

// if the concentration is to be stored in a variable ppm then:
mh_z16.measure( ()=>{} );
ppm = mh_z16.ppm

mh_z16~resultCallback : function

Receive data from device

Kind: inner typedef of mh_z16

max38155k

Communicate with the MAX38155k device and sensor

Param Type Description
spi Object an SPI object
sck pin the pin that the spi clock is connected to
miso pin the pin that the spi MISO connected to
cs pin chip select for the device

Properties

Name Type Description
temp number the last temperature that the sensor recorded
data Array the array that holds the data from the sensor (for debug)

exports ⏏

This is 'exported' so it can be used with require('max31855k.js').connect(pin1,pin2)

Kind: Exported member Example (How to use max31855k module)

//create a new instance of ph sensor
var spi = new SPI();     // create new spi object
var phAddress = 0x63;    // EZO pH i2c address
var miso = D25;          // setup spi pins
var cs = D33;
var sck = D32;
tempSensor = new ( require('max31855k') )( spi, sck, miso, cs );

exports~ezoph/begin()

Initialize the spi bus (only needs to be run once)

Kind: inner method of exports

exports~ezoph/readC() ⇒ number

Reads temperature in Celsius

Kind: inner method of exports Returns: number - temp - the current temparature read from the sensor in Celsius

exports~ezoph/readF() ⇒ number

Reads temperature in Farenheit

Kind: inner method of exports Returns: number - temp - the current temparature read from the sensor in Farenheit

exports~ezoph/readK() ⇒ number

Reads temperature in Kelvin

Kind: inner method of exports Returns: number - temp - the current temparature read from the sensor in Kelvin

exports~ezoph/readR() ⇒ number

Reads temperature in Rankine

Kind: inner method of exports Returns: number - temp - the current temparature read from the sensor in Rankine

numberLike : number | string

A number, or a string containing a number.

Kind: global typedef

pin : Object

A number, or a string containing a number.

Kind: global typedef

About

This is a place to keep and update the bioreactor code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published