//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;
santua25
copilot
-
Capacitor (C1)
- Part Number: C0603X5R106M250NT
- Capacitance: 10 µF
- Pins: P1, P2
-
LED (LED1)
- Part Number: WP7113SRD/D
- Forward Voltage: 1.85V
- Pins: K (Cathode), A (Anode)
-
AC Input Connector (AC220V)
- Part Number: 691137710002
- Pins: P1, P2
-
Bridge Rectifier (D1)
- Part Number: GBU6K
- Pins: P3 (AC Input 1), - (Cathode), P2 (AC Input 2), + (Anode)
-
Step-Down Transformer (STEPDOWNTRANSFORMER220V−12V)
- Part Number: E141
- Pins: 4 pins (assumed to be two pairs of AC connections)
-
Resistor (R1)
- Resistance: 500 Ohms
- Pins: P1, P2
Assumptions and Project Description-
AC Input and Step-Down Transformer
- Connect AC220V:P1 to STEPDOWNTRANSFORMER220V−12V: .
- Connect AC220V:P2 to STEPDOWNTRANSFORMER220V−12V: .
-
Secondary of Transformer to Bridge Rectifier
- Connect STEPDOWNTRANSFORMER220V−12V: to D1:P3 and D1:P2.
- Connect STEPDOWNTRANSFORMER220V−12V: to D1:P3 and D1:P2.
-
Output of Bridge Rectifier to Filtering Capacitor
- Connect D1:+ to C1:P1.
- Connect D1:− to C1:P2.
-
LED and Resistor in series:
- Connect C1:P1 to R1:P1.
- Connect R1:P2 to LED1:A.
- Connect LED1:K to C1:P2.
Steps and Key Concepts-
AC Power Input:
- The project will receive AC mains power (220V) from the [AC 220V](AC 220V) connector.
-
Step-Down Transformer:
- The transformer (STEPDOWNTRANSFORMER220V−12V) brings the high voltage AC down to a lower AC voltage (12V).
-
Bridge Rectifier Circuit:
- D1 converts the AC voltage from the transformer into DC voltage.
-
Filtering Capacitor:
- C1 smoothes the rectified DC voltage.
-
Current Limiting Resistor:
- R1 limits the current through the LED to prevent damage.
-
LED:
- LED1 is the final load, lighting up to indicate power is flowing through the circuit.
Conclusion