A software engineer named Liam Zebedee got fed up with the challenges of life with diabetes, so he decided to hack his insulin pump and turn it into a brand new, high-tech “pancreas.”

Zebedee detailed the process of finding and ordering parts, coding the software for a smart insulin pump, and assembling the final product in his blog. At the end, he shared pictures of his new rig — a small module running his software on an open-source operating system, and the actual insulin pump that it controls.

At the end of the day, Zebedee paid $979 for hardware and $225 in monthly costs for the glucose sensors, which last about 14 days each, and subscriptions to developer software. But that excludes the pump he was already using and a monthly supply of insulin.

The ultimate goal, Zebedee writes, was to take the hassle out of managing diabetes and take back control of his own medical care — he explained at length his frustration with doctors and hospitals that he felt didn’t pay enough attention to his problems. So his artificial pancreas was designed function as similarly to a biological organ as possible.

That means that it automatically monitors how much sugar is in his blood and dispenses the proper amount of insulin while accounting for the impacts of exercising, drinking alcohol, how well he sleeps, and his unpredictable fluctuations in insulin resistance.

“So I know that it’s pretty insane to run your basic metabolism on untyped JavaScript code,” Zebedee writes. “But if you were in my shoes, you’d realise it was safer than going to the hospital, intentionally or not.”