Hello friends, I hope you all are doing great. Today, I am going to share the Raspberry Pi 5 Hydrogen Fuel Cell Monitor in Proteus Simulation, the sixty-fourth project of our IoT Projects series. If you have searched for a fuel cell monitoring project, an INA219 project on the Raspberry Pi, or a Proteus simulation of a PEM fuel cell, here is a complete one. A small 12 W hydrogen fuel cell stack feeds an electronic load, an INA219 sensor sits in its positive line, and a Raspberry Pi 5 watches it all. As you turn the load up, the Pi records the stack's polarization curve point by point, works out how much hydrogen it is burning and how efficient it is, and shows everything on an OLED and on a dashboard. Then the hydrogen pressure drops, and the Pi notices the stack starving long before its own controller has to switch it off.

Fuel cells are turning up everywhere: in buses, forklifts, backup power for telecom towers, drones and school science kits. They all have the same weak spot: a fuel cell that does not get enough hydrogen or air still gives a voltage, just a lower one, and the cells can be damaged if the load keeps pulling. In this tutorial, we will go through the circuit, see what happens inside a PEM cell, read the three regions of the polarization curve, count the hydrogen with Faraday's law, work out the efficiency against the hydrogen's energy, and build a health check that compares the stack with its own curve. Then we run the simulation: a load sweep, a starving stack, a shutdown and a restart. At the end, you can download the project with the program and every library file.

NOTICE: Our team has put a lot of effort into this project: the circuit, the code and every part in the simulation are our own work, and you get them all free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below. And if our free projects help you, you can buy us a coffee. So, let's get started with the Raspberry Pi 5 hydrogen fuel cell monitor in Proteus simulation:

Figure: The fuel cell monitor in a Proteus simulation: the stack starving, the ALARM LED on.
Figure: The project working in the Proteus simulation (an animation of the main steps).

What Does This Fuel Cell Monitor Do?

  • Measures the stack: an INA219 in the positive line reads the stack's voltage and current over I2C, so the Pi knows the power at every moment.
  • Records the polarization curve: each time the load current has been steady for 2 seconds, the Pi stores a point, the volts at that current, and the stack's resistance between two points.
  • Counts the hydrogen: Faraday's law turns the current into litres of hydrogen per minute, adds up what is used, and tells how long a 10 L canister lasts at this load.
  • Works out the efficiency: the electric power against the energy in the hydrogen the stack takes.
  • Catches starvation: if the voltage falls 0.6 V under the stack's own curve at the same current, the Pi says STARVING and lights the ALARM LED.
  • Logs the shutdowns: when the stack's controller switches the output off, the Pi records it with the last good voltage and current.
  • Shows it all: an OLED with eight lines of figures, and a dashboard on a laptop or a phone with the measured curve drawn by the Pi.

It is a great project for learning how fuel cells behave and how a small computer can test one: electrochemistry in plain numbers, an I2C power monitor, a curve built from live measurements, and a fault detector that needs no extra sensor. In the simulation, the fuel cell's pop-up shows the hydrogen path, the stack's temperature and the curve the model is following, and the INA219's pop-up shows the shunt, the registers and every I2C byte, so you can check each of the Pi's numbers against an independent judge.

Components Used in the Proteus Simulation

All the parts come from our Proteus libraries, each with its own tutorial. The DC electronic load comes with the INA219 library. The project zip at the end includes every LIB and DLL file and the TEPPi runtime that runs Python in Proteus.

The parts of the fuel cell monitor and their library posts
PartProteus deviceLibrary postConnection
Raspberry Pi 5RASPBERRY PI 5Raspberry Pi 5 Library for ProteusPI1, fuel_monitor.py, Ethernet 192.168.1.51
12 W PEM fuel cell stackFUELCELL12WTEPPEM Hydrogen Fuel Cell Library for ProteusFC1: + to the INA219's VIN+, - to GND
INA219 current sensorINA219ADVTEPINA219 Current Sensor Library for ProteusU1, I2C at 0x40, VIN+ / VIN- in the + line
DC electronic loadDCLOADTEPINA219 Current Sensor Library for ProteusLD1: + from VIN-, - to GND
SSD1306 OLED 128x64OLED12864WHITEADVTEPOLED SSD1306 Library for ProteusOLED1, I2C at 0x3C
Red 5 mm LEDLED5MMREDTEP5mm LED LibraryD1 ALARM, GPIO23 through R1
ResistorRESISTOR4BANDTEPResistor LibraryR1 220 ohm
Laptop WiFi MonitorLAPTOP WIFI MONITORLaptop WiFi MonitorPC1
Mobile WiFi MonitorMOBILE WIFI MONITORMobile WiFi MonitorMOB1

Proteus Simulation of the Fuel Cell Monitor: the Circuit

Figure: The complete circuit of the fuel cell monitor on an A3 Proteus sheet.
The connections of the fuel cell monitor
PartPinsRaspberry Pi 5 / supply
FC1 the stack+ / -U1 VIN+ / GND
U1 INA219VIN- / VCC / GNDLD1 + / +3.3V / GND
U1, OLED1SDA / SCLGPIO2 (pin 3) / GPIO3 (pin 5)
OLED1VCC / GND+3.3V / GND
LD1 the load+ / -U1 VIN- / GND
D1 ALARMA (through R1) / KGPIO23 (pin 16) / GND

The INA219 is a high-side sensor: its 0.1 ohm shunt sits in the positive line, between the stack (VIN+) and the load (VIN-), and the ground stays common to everything. The chip measures two voltages: the drop across the shunt, which is the current times 0.1 ohm, and the bus voltage from VIN- to ground. The load is a constant-current sink: whatever the stack's voltage, it draws the current you set, which is exactly what you need to trace a curve point by point. The INA219's VCC is a real analog supply pin in its model, so it gets the +3.3V supply, not a net label; the OLED shares the I2C bus and the same 3.3 V. The stack's own small controller is inside the fuel cell part: it opens the hydrogen valve, purges the cells at start-up, and switches the output off if the voltage falls under 6 V, the current passes 3 A or the stack gets hotter than 55 °C.

How a PEM Fuel Cell Works

Hydrogen In, Electricity and Water Out

A PEM (proton exchange membrane) cell is a thin sandwich: two porous electrodes with a platinum catalyst, and between them a plastic membrane that lets protons through but not electrons. At the anode, each hydrogen molecule splits into two protons and two electrons. The protons cross the membrane; the electrons cannot, so they take the long way round, through the wires and the load, and that is the electric current. At the cathode, the protons, the electrons and oxygen from the air meet and make water. Nothing burns, and the only exhaust is water and a little heat. One cell gives about 1 V with no load, far too little to be useful, so cells are stacked in series. This stack has 13 cells: about 0.95 V each, 12.35 V with nothing connected, and the maker rates it at 7.8 V and 1.5 A, about 12 W.

The Polarization Curve and Its Three Regions

The more current you take, the lower the voltage, and the graph of volts against amps is the polarization curve, the most important chart of any fuel cell. It has three regions. At very small currents, the voltage drops quickly: the reaction needs a push to get going, and that push, the activation loss, grows with the logarithm of the current. In the middle, the curve is nearly a straight line: the membrane and the contacts have resistance, and the ohmic loss is simply current times resistance. Near the end, the voltage falls off a cliff: the gases cannot reach the catalyst fast enough, the concentration loss, and the current hits a limit. The fuel cell library models each cell as V = E - b ln(1 + I / I0) - r I + c ln(1 - I / Ilim), with E = 0.95 V, b = 0.045 V, I0 = 0.02 A, r = 0.0954 ohm, c = 0.04 V and a limiting current of 4 A at 0.5 bar of hydrogen.

Worked example at the rated 1.5 A: the activation loss is 0.045 x ln(76) = 0.195 V, the ohmic loss 0.0954 x 1.5 = 0.143 V, and the concentration term 0.04 x ln(1 - 1.5 / 4) = -0.019 V. One cell gives 0.95 - 0.195 - 0.143 - 0.019 = 0.593 V, and the 13 cells 7.71 V. At only 20 mA the activation loss alone takes 0.031 V from each cell, 0.4 V from the stack, which is why the first point of the curve is 11.90 V and not 12.35 V.

Power and Where to Run the Stack

The power is volts times amps. It starts at zero, rises as the current grows, and falls again near the limiting current when the voltage collapses faster than the current rises. For this stack, the model's power peaks near 2.4 A, just above the controller's 6 V cut-off, at about 14.6 W. Running a fuel cell at its maximum power is a bad idea anyway: the lower the voltage, the more of the hydrogen's energy becomes heat. That is why the rated point is 1.5 A, where the stack gives 12 W at a comfortable 7.8 V and a sensible efficiency.

How Much Hydrogen? Faraday's Law

Every hydrogen molecule gives exactly two electrons, so the current tells you exactly how many molecules react. The Faraday constant, 96485 coulombs, is the charge of one mole of electrons. One ampere is one coulomb a second, so one cell reacts I / (2 x 96485) moles of hydrogen a second, and the 13 cells in series, which all carry the same current, 13 times that. Worked example at 1.5 A: 13 x 1.5 / 192970 = 0.000101 mol/s. A mole of gas at 25 °C takes 24.47 litres, so that is 2.47 mL/s or 0.148 L/min. A real stack takes a little more than it reacts, because it purges the anode now and then to clear water and nitrogen; this one takes a fifth more, 0.178 L/min, which matches the maker's 0.18 L/min at the rated power. The program works this out as 0.1187 L/min for every ampere.

Efficiency Against the Hydrogen's Energy

A mole of hydrogen holds about 242 kJ of useful energy, its lower heating value (LHV). If all of it became electricity, each cell would give 242000 / (2 x 96485) = 1.254 V. So the voltage efficiency of a cell is simply its voltage divided by 1.254 V, and the purge costs another factor of 1.20. Worked example at 1.5 A: 0.593 / 1.254 = 47.3 %, divided by 1.20 = 39 %, the maker's 40 % at full power. At 20 mA the same sum gives 61 %: a lightly loaded fuel cell is very efficient, but it makes little power. The rest becomes heat: at 1.5 A, 1.5 x (13 x 1.254 - 7.71) = 12.9 W, about as much heat as electricity, which the stack's fan carries away.

Catching Starvation with the Stack's Own Curve

The limiting current depends on the hydrogen pressure: 4 A at the rated 0.5 bar, but only 1.6 A at 0.2 bar and 0.8 A at 0.1 bar. If the pressure falls while the load stays at 1.5 A, the stack is suddenly working near its new limit, and the concentration loss grows: 0.04 x ln(1 - 1.5 / 1.6) = -0.111 V a cell instead of -0.019 V, 1.2 V less from the stack. The trouble is that 6.48 V on its own looks perfectly normal: it is what a healthy stack gives at about 2.2 A. A voltage limit cannot tell a starving stack from a busy one. What gives it away is the voltage at this current, compared with what this very stack gave at the same current when it was healthy. That is why the Pi records the curve first: it becomes the reference. At any current, the Pi reads the expected voltage off its curve, a straight line between the two nearest points, and if the stack is more than 0.6 V under it for a full second, it is starving.

Why the Controller Cuts Off at 6 V

A starving cell is in real danger. When one cell in a stack runs out of hydrogen while the others still push current through it, its voltage can go negative, and then it starts eating its own catalyst support and membrane. The stack's controller protects against the worst of this: under 6 V for a tenth of a second, the output goes off and stays off until someone presses Start. The Pi's STARVING warning comes earlier, while the stack is still delivering power, so a real system could lower the load or check the hydrogen before the controller has to step in.

Measuring the Stack with the INA219

The INA219 has six 16-bit registers that the Pi reads over I2C at address 0x40. The configuration register is set to 0x399F: a 32 V bus range, the shunt range of plus or minus 320 mV (enough for 3.2 A through 0.1 ohm), 12-bit conversions, and continuous measuring. The bus voltage register holds the voltage in steps of 4 mV in its upper 13 bits; the shunt voltage register in steps of 10 uV. The chip can also do the division for you: with a current step of 0.1 mA chosen, the calibration value is 0.04096 / (0.0001 x 0.1) = 4096, and then the current register reads straight in units of 0.1 mA. One detail matters here: the bus voltage is measured at VIN-, after the shunt. At 1.5 A the shunt drops 0.15 V, so the Pi adds the shunt voltage to the bus voltage to get the stack's own voltage. The INA219's power register, by contrast, multiplies the bus voltage, which is the power that reaches the load, 0.225 W less than the stack delivers.

The Python Code Explained

The program is fuel_monitor.py. It uses lgpio, the GPIO library of Raspberry Pi OS, for the I2C bus and the LED, and Python's own http.server and threading for the dashboard. The INA219 is set up with two writes, the configuration and the calibration:

        self.write(0x00, 0x399F)                                # CONFIG
        self.write(0x05, 4096)                                  # CALIBRATION = 0.04096 / (0.1 mA x 0.1 ohm)

Each measurement reads three registers and turns them into volts and amps:

        shunt = self.read(0x01, True) * 0.00001                 # SHUNT VOLTAGE: 10 uV a step
        bus = (self.read(0x02) >> 3) * 0.004                    # BUS VOLTAGE (VIN- to ground): bits 15 - 3, 4 mV a step
        amps = self.read(0x04, True) * 0.0001                   # CURRENT: 0.1 mA a step

The hydrogen by Faraday's law, with the purge, in litres a minute:

    return CELLS * amps / (2 * FARADAY) * MOLAR_L * PURGE * 60

The efficiency against the hydrogen's energy:

    return volts / CELLS / LHV_CELL_V / PURGE * 100 if amps > 0.005 else 0.0

The hydrogen used is added up every loop, and the canister's time left follows from it:

            s['used'] += flow * dt / 60; s['wh'] += p * dt / 3600
        left = (CANISTER_L - used) / flow if flow > 0.001 else None

The current has to stay within 10 mA to count as steady; any bigger change restarts the clock:

        if steady_i is None or abs(i - steady_i) > STEADY_A:
            steady_i, steady_since, judge_since = i, t, None

A new point of the curve needs a healthy, running stack, 2 seconds of steady current, and a voltage above the cut-off:

        if state == 'RUNNING' and t - steady_since >= STEADY_S and v > CUTOFF_V and (under is None or under < HEALTHY_V):

The expected voltage at any current is read off the curve, on a straight line between the two nearest points:

    for (a0, v0), (a1, v1) in zip(pts, pts[1:]):
        if amps <= a1:
            return v0 + (v1 - v0) * (amps - a0) / (a1 - a0)

The thresholds of the health check:

STARVE_V, HEALTHY_V, JUDGE_S = 0.6, 0.3, 1.0                    # under the curve by 0.6 V for 1 s: STARVING; within 0.3 V: healthy again

A stack that has been under its curve by more than 0.6 V for a second is starving:

            if state == 'RUNNING' and under > STARVE_V:

An output that falls to nothing means the controller has switched the stack off:

        if v < 1.0:
            if state in ('RUNNING', 'STARVING'):
                state = 'SHUT DOWN'

The ALARM LED follows the state:

        lgpio.gpio_write(chip, ALARM, 1 if state in ('STARVING', 'SHUT DOWN') else 0)

The monitor runs four times a second in its own thread, and all the I2C traffic, the INA219 and the OLED, stays in that thread. The OLED gets a frame only when its text has changed. Each new point prints the stack's resistance from the point before it, which shows the curve flattening from the activation region into the ohmic region. The dashboard's pages are / (the dashboard), /clear (start a new curve), /curve.bmp (a 240 x 120 picture of the measured volts and watts against the current, drawn by the Pi) and /data (everything as JSON).

How to Run the Proteus Simulation

  1. Download the project zip below and install the library files and the TEPPi folder (the steps are under the download button).
  2. Open Pi-5-Fuel-Cell-Monitor.pdsprj from the Proteus Simulation folder. Keep fuel_monitor.py and the DLL files next to it.
  3. Press Play. The stack gives 11.9 V at 20 mA; after 2 seconds the Pi records the first point.
  4. On the INA219's pop-up (U1), press SERVO 250 mA, MOTOR 800 mA and LAMP 1.5 A, a few seconds apart, then +100 five times for 2.0 A.
  5. Press LAMP 1.5 A again. On the fuel cell's pop-up (FC1), press 0.2: the Pi says STARVING. Press 0.1: the stack shuts down.
  6. Press 0.5 bar and Start: about 20 seconds later the stack runs again. Open the Laptop or the Mobile WiFi Monitor and press Go for the dashboard.

Simulation Results: the Fuel Cell Monitor in Proteus

Here is the run that made the screenshots of this tutorial, 69 seconds of simulation: a load sweep from 20 mA to 2 A, a drop in the hydrogen pressure, a shutdown and a restart. The times are the program's own clock, as it printed them on the Pi's terminal; the parts' numbers come from their pop-ups.

The First Point at 20 mA

The stack starts with hydrogen at the rated 0.5 bar and the load at 20 mA. The Pi sees it running at once, and after 2 seconds of steady current it records the first point: "11.90 V at 0.02 A = 0.24 W, 0.915 V a cell, 61 % efficient". The fuel cell's pop-up agrees: RUNNING, 11.90 V at 0.02 A, 61 % of the hydrogen's energy, the stack at 25 °C. The OLED shows 70 hours left on the canister at this tiny load.

Figure: The stack at 20 mA.
Figure: The stack: 11.90 V at 20 mA.
Figure: The OLED: the first point.
Figure: The dashboard: one point.

Sweeping the Load: the Polarization Curve

The load's presets on the INA219's pop-up step the current up, and each step becomes a point: "10.48 V at 0.25 A" at 11.0 s, "9.07 V at 0.80 A" at 13.8 s and "7.71 V at 1.50 A = 11.57 W, 0.593 V a cell, 39 % efficient" at 16.6 s, exactly the 0.593 V a cell and 39 % worked out above. The hydrogen flow at 1.5 A is 0.178 L/min, on the OLED and on the fuel cell's pop-up alike, and the canister would last 56 minutes. The INA219's pop-up shows where the numbers come from: 150.01 mV across the shunt, a bus voltage of 7.560 V, and a current register of 0x3A99, 15001 steps of 0.1 mA. The bus plus the shunt is the stack's 7.71 V. The chip's own power register says 11.340 W, the power that reaches the load; the Pi's 11.57 W includes the 0.225 W the shunt takes.

Figure: The stack at its rated 1.5 A.
Figure: The stack: 7.71 V at 1.5 A.
Figure: The INA219: the shunt and the registers.
Figure: The OLED at 1.5 A.

Five presses of +100 take the load to 2.0 A, and at 24.7 s the fifth point arrives: "6.81 V at 2.00 A = 13.62 W, 35 % efficient". The resistances between the points tell the story of the three regions: 6.18 ohm from 20 mA to 250 mA, where the activation loss is steep, then 2.56 ohm, 1.94 ohm and finally 1.80 ohm from 1.5 A to 2.0 A. That last figure is the membranes' 13 x 0.0954 = 1.24 ohm, plus what is left of the activation slope, 13 x 0.045 / 1.75 = 0.33 ohm, plus the first sign of the concentration loss, 13 x 0.04 / 2.25 = 0.23 ohm: 1.80 ohm. The dashboard draws the curve: the volts falling, the watts rising towards the 2 A point.

Figure: Five points at 2.0 A.
Figure: The stack at 2.0 A.
Figure: The dashboard: the measured curve.

The Hydrogen Runs Low: STARVING

Back at 1.5 A, the hydrogen pressure on the fuel cell's pop-up drops to 0.2 bar. The voltage falls to 6.48 V, still comfortably above the 6 V cut-off, and nothing else would notice. The Pi does: at 34.4 s, "STARVING: 6.48 V at 1.50 A, 1.23 V under its own curve (7.71 V) - check the hydrogen". The 1.23 V matches the 1.2 V the concentration loss predicted. The ALARM LED lights, the OLED shows how far under the curve the stack is, and the fuel cell's own pop-up turns amber: STARVING, the reactants allow 1.6 A at most. The efficiency has dropped to 33 %, and 14.7 W of heat now goes into the stack.

Figure: STARVING: the ALARM LED on.
Figure: The stack: starving at 0.2 bar.
Figure: The OLED: under the curve.
Figure: The phone: STARVING.

0.1 bar: the Shutdown

At 0.1 bar the limiting current is 0.8 A, but the load still wants 1.5 A. The voltage collapses, the controller sees it under 6 V for a tenth of a second and switches the output off: LOW VOLTAGE SHUTDOWN on the pop-up. The Pi logs it at 38.5 s: "the stack SHUT DOWN - its output is off (it last gave 2.65 V at 1.50 A; its controller stops it under 6 V)". The 2.65 V is a real reading: the Pi measures four times a second, and one of its readings landed inside the tenth of a second when the voltage was falling through the cut-off and the load was still pulling its 1.5 A. The OLED and the dashboard show SHUT DOWN, the hydrogen flow is zero, and the five points of the curve are still there for later.

Figure: The stack shut down.
Figure: The stack: LOW VOLTAGE SHUTDOWN.
Figure: The OLED: SHUT DOWN.
Figure: The dashboard: SHUT DOWN.

Hydrogen Back and Start

0.5 bar and Start on the pop-up: the controller opens the valve and purges the anode for about 20 seconds, and at 61.7 s the Pi sees "the stack is running: 7.72 V at 1.50 A (0.594 V a cell)". The dashboard shows 11.58 W and 39 %, back on its curve, a hundredth of a volt better than before because the stack is now 27 °C warm and its membranes conduct slightly better. The canister would last 56 minutes again, the whole run used 0.10 L of hydrogen, and the Pi's terminal holds every point and every event.

Figure: Running again.
Figure: The stack: running again.
Figure: The dashboard: running again.
Figure: The terminal: the whole run.
The results of the fuel cell monitor simulation
WhatResult
20 mA11.90 V, 61 % (the activation loss: 0.4 V)
1.5 A (rated)7.71 V, 11.57 W, 39 %, 0.178 L/min of hydrogen, 56 minutes from 10 L
2.0 A6.81 V, 13.62 W, 35 %, 0.237 L/min
Resistance between points6.18, 2.56, 1.94, 1.80 ohm (the curve flattening)
0.2 bar at 1.5 ASTARVING: 6.48 V, 1.23 V under the curve
0.1 barLOW VOLTAGE shutdown, logged by the Pi
0.5 bar + Startrunning again after about 20 s: 7.72 V
Simulation69 s of simulation

Download the Project Files

Click the button below to download Raspberry-Pi-5-Hydrogen-Fuel-Cell-Monitor-INA219-Proteus-Simulation-v1.0.zip (about 14.4 MB, without the source code of the models):

Raspberry Pi 5 Hydrogen Fuel Cell Monitor: INA219 Proteus Simulation V1.0
  • Proteus Simulation: Pi-5-Fuel-Cell-Monitor.pdsprj, fuel_monitor.py and copies of the models.
  • Python Code: fuel_monitor.py, the program.
  • Proteus Library Files: the LIB files of the Raspberry Pi 5, the PEM fuel cell, the INA219 and its DC load, the OLED, the LED, the resistor and the two WiFi Monitors.
  • Proteus Model Files: the DLL models and the TEPPi folder (Python 3.11 and the runtime).
  • README.txt: the installation steps, the properties, the test results and the links to every library post.

No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.

How to Install the Project Files

  1. Close Proteus and extract the whole zip file, for example to your Desktop.
  2. Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
  3. Copy the files and the TEPPi folder from Proteus Model Files into the MODELS folder.
  4. Start Proteus and open the project from the Proteus Simulation folder.

Changing the Code

fuel_monitor.py is plain Python: edit it next to the project and press Play again; PI1's PROGRAM property names the file it runs. The canister size, the steady time, the step between points and the starvation thresholds are at the top. In FC1's properties, H2 sets the hydrogen pressure (DEMO plays a pressure profile by itself), FAN the fan, AMBIENT the room temperature and SPEED how fast the slow processes run; LD1's CURRENT is the load in milliamps. The same program runs on a real Raspberry Pi 5 with Raspberry Pi OS, where lgpio is already installed; enable I2C with raspi-config.

Ideas to Extend the Project

  • Sweep the load automatically with a programmable electronic load, and fit the curve's five constants to the points.
  • Add a hydrogen pressure sensor and compare the starvation the Pi infers with the pressure it measures.
  • Track the stack's resistance over weeks: a membrane that dries out or ages shows up as a steeper ohmic region.
  • Let the Pi lower the load itself when the stack starts starving, like a real fuel cell power system does.
  • Charge a battery from the stack through a DC-DC converter and let the Pi share the load between them.
  • Log every point to a CSV file and plot the curves of different days on one chart.

From Simulation to Real Hardware

  • Hydrogen safety first: work outdoors or with good ventilation, keep sparks and flames away, use a proper regulator, and never store hydrogen in a closed room.
  • Use a metal-hydride canister: educational stacks run at about 0.5 bar from small hydride canisters, much safer than high-pressure cylinders.
  • Check the shunt's range: 0.1 ohm and plus or minus 320 mV allow 3.2 A; a bigger stack needs a smaller shunt and a new calibration value.
  • Mind the water: a PEM stack makes water; keep the electronics away from its outlet.
  • Let it warm up: a cold stack gives less; record the curve at a steady temperature, or record the temperature with it.

Troubleshooting

  • The INA219 reads nothing: its VCC must be on a real 3.3 V supply, and SDA / SCL on GPIO2 / GPIO3.
  • No TEP DC load on VIN-: the INA219's VIN- must go straight to the load's + pin.
  • The stack says OFF: the hydrogen must be at least 0.05 bar (0.45 - 0.55 bar is right); after a shutdown, press Start.
  • The stack shuts down above about 2.4 A: its voltage falls under 6 V and the controller switches the output off.
  • No new points: the current must be steady for 2 seconds and 50 mA away from every point already stored.

Limitations of the Simulation

  • The stack is the library's model: a curve with five constants, a limiting current set by the hydrogen and the air, and a simple heat balance; a real stack also changes with humidity and age.
  • The hydrogen pressure is set by hand on the pop-up; there is no regulator or canister model.
  • The program uses a 25 °C molar volume and the stack's fixed purge share; a real purge comes in pulses.
  • The network to the laptop and the phone is simulated inside Proteus.
  • Raspberry Pi is a trademark of Raspberry Pi Ltd and the INA219 a product of Texas Instruments; this project is not made or endorsed by them or by Labcenter.

So, that was all about the Raspberry Pi 5 Hydrogen Fuel Cell Monitor in Proteus Simulation. I hope it helps you understand how a PEM fuel cell turns hydrogen into electricity, what the three regions of its polarization curve mean, how Faraday's law counts the hydrogen, and how a stack's own curve can warn you that it is starving, all tested in a simulation before you open a hydrogen valve. More IoT projects with the Raspberry Pi 5 and the ESP32 are coming in this series. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!