Loading...
Searching...
No Matches
analog_shield Namespace Reference

Analog Shield library for the Phyduino Pico, in MicroPython. More...

Classes

class  Led
 One of the shield's LEDs, D1 (green) or D2 (red). More...
class  Encoder
 The shield's rotary encoder (ENC1) and its push switch. More...

Functions

 version ()
 Gets the library version.
 encoder ()
 Gets the shield's rotary encoder.
 set_output_pin (name)
 Selects the pin the amplifier's output is read on, to match jumper JP2.
 set_supply_volts (volts=5.0)
 Sets the voltage of the shield's +5V rail, for a more accurate offset.
 amplifier_gain ()
 The amplifier's (U2A) gain, from the shield's resistor values.
 amplifier_offset_volts ()
 The voltage the amplifier (U2A) takes off its output.
 output_volts ()
 Reads the signal at the end of the chain (TEMP_SIG) on A3 or A0.
 amplifier_volts ()
 Works out the amplifier's output (OPA_OUT), before the R14/R15 divider.
 sensor_volts ()
 Works out the sensor's voltage (SENSOR_IN) from the amplifier's output.
 raw_sensor_volts ()
 Reads the sensor's voltage (SENSOR_IN) directly, on A1.
 temperature_from_volts (volts)
 Converts an LMT84 output voltage to a temperature.
 temperature ()
 Reads the on-board LMT84 temperature sensor through the amplifier.
 pot_volts ()
 Reads the potentiometer, RV1, on A5.

Variables

 green_led = Led("D6")
 The green LED, D1 on the shield, on pin D6: a Led object.
 red_led = Led("D5")
 The red LED, D2 on the shield, on pin D5: a Led object.

Detailed Description

Analog Shield library for the Phyduino Pico, in MicroPython.

Copy this file to the board next to your own main.py, then:

import analog_shield as shield
shield.green_led.on()
print(shield.temperature()) # degrees C, from the on-board LMT84
print(shield.encoder().position())

Needs the Phyduino Pico firmware, which has phyduino.py built in. Set the shield's jumpers for a 3.3 V board: JP3 (VIO) on 3.3 V, JP4 on 5 V, JP1 on INT and JP2 on EXT (the amplifier to A3).

Shield part Pin
Green LED (D1), red LED (D2) D6, D5 (both on when low)
Encoder A, B, push switch D3, D4, D2 (low when closed)
Amplifier output A3 (JP2 on EXT) or A0 (JP2 on INT)
Sensor voltage before the amplifier A1
Potentiometer RV1 A5

Licence: GPL-3.0.