//This example code shows how to use Flux's API (https://docs.flux.ai/reference/api-overview) to add an LED simulator model to a part.
//It also changes the symbol to signal schematic users when the LED is turned on and when it's turned off based on simulator data.
//You can find this part in use in the Astable multivibrator example in your profile.
//Assigning the object ID of the terminals in the schematic editor to two variables
const anodeTerminalId = "63b04c1b-436c-3804-2af5-f29f2e88399c"; // Anode terminal ID
const cathodeTerminalId = "e5f77de8-474b-cc14-8e87-78778e0da1c6"; // Cathode terminal ID
//Get terminal objects by ID.
const anodeTerminal = flux.getNodeById(anodeTerminalId, "elementTerminal");
const cathodeTerminal = flux.getNodeById(cathodeTerminalId, "elementTerminal");
//Create the output nodes that will be visible to users in the simulator tab on the schematic
const outputVoltage = flux.createOutputNode("vout");
const inputVoltage = flux.createOutputNode("vin");
const current = flux.createOutputNode("I");
const voltageDrop = flux.createOutputNode("vdrop");
//Setting up basic parameters of an LED. You can modify these parameters and see how the simulation changes when you put it in a project
const seriesResistance = 0.42;
const emissionCoefficient = 3.73;
const saturationCurrent = 93.2e-12;
cartolin
Image
copilot
- Op-Amp: LM741
- Resistors:
- R1: 10kΩ
- R2: 10kΩ
- R3: 5.6kΩ (Need two units)
- Capacitors:
- C1: 0.1µF
- C2: 0.1µF
- Voltage Source: AC Voltage Source for input
- Power Supply:
- Positive Voltage: +12V
- Negative Voltage: -12V
Circuit Connections-
Op-Amp LM741:
- Connect V+ (pin 7) to +12V power supply.
- Connect V- (pin 4) to -12V power supply.
- Connect non-inverting input (pin 3) to the junction of R1:2.
- Connect inverting input (pin 2) to the junction of R3:1 and C2:2.
- Connect output (pin 6) to the junction of R2:1.
-
Resistors:
- Connect R1 to the AC voltage source positive end.
- Ground R1.
- Connect R2 to the op-amp output (pin 6).
- Ground R2.
- Connect R3 to the junction of C2:2 and op-amp (pin 2).
- Ground R3.
-
Capacitors:
- Connect C1 to the AC voltage source positive end.
- Connect C1 to ground.
- Connect C2 to the junction of R3:1 and op-amp (pin 2).
- Connect C2 to ground.
Power Supply and Signal Inputcartolin
copilot