10/10/2019

Satellite dilemma وباء الأقمار الصناعية

03/10/2019

The one runway challenge between A380 landing and A350 takeoff

29/09/2019

غزو الروبوتات The Robots Invasion

28/09/2019

ماهي الحنشلة E-Theft

27/09/2019

Jellyfish قنديل البحر

01/09/2019

محرك يستمد طاقته من حرارة الجسم البشري A motor driven by Human-body heat

27/08/2019

الطب الصيني خارطة القدم الصحية Chinese medics

22/08/2019

The Universe scale مامدى حجم الكون ابتداءاً من شمسنا ومجرتنا

11/08/2019

سأم مهندس البرمجيات الذي يسمى ليام زبيدي من التعايش مع المتاعب التي يسببها مرض السكري، ولذا قرر أن يخترق مضخته للأنسولين ويحولها إلى بنكرياس اصطناعي عالي التقنية. I’m a cyborg now! (On Building My Own Artificial Pancreas

سأم مهندس البرمجيات الذي يسمى ليام زبيدي من التعايش مع المتاعب التي يسببها مرض السكري، ولذا قرر أن يخترق مضخته للأنسولين ويحولها إلى بنكرياس اصطناعي عالي التقنية.

Given the choice between a) changing my lifestyle to be boring and b) hacking my metabolism, I chose the easier option. I built an artificial pancreas using OpenAPS! And it’s changing my life.

What’s an artificial pancreas?

• When your pancreas is not munted like mine, it produces insulin

• But more importantly, it knows when and how much insulin to produce – in response to the amount of glucose in your blood

• Everything affects this:

• – Food. Diabetics have to give themselves insulin for carbohydrates, using personal ratios we guess and refine. Different foods have different amounts of carbohydrates, which release at different speeds (glycaemic index). Companies are legally allowed to include an error margin of up to 10% on their nutritional information.

• – When you wake up (dawn phenoemenon / residual insulin effects – you need more insulin)

• – Illness and stress (you need more insulin)

• – Your current levels. Your body is more insulin resistant when your levels are higher than they should be.

• – Alcohol (occupies the liver, but only after more than one beer – you need less insulin)

• – Exercise (adrenaline makes it temporarily go up, and stabilises in the long run)

• – Sleep quality (makes metabolism more or less volatile)

• For diabetics, we are running mathematical optimizations of complex control systems, 24-7-365. Pulling levers, making guesses, trying to reduce our margins of error.

• An artificial pancreas is just this – but 80% is automated.

This post is a little blog of my experience building such a system. I’ve outlined the tech and costs of buying it, the research involved and assembly. And most of all – the actual human impact it is making on my life. Let’s begin!

The Tech Stack

FreeStyle Libre CGM – continuous glucose monitoring

Miaomiao transmitter – transmits the Libre (which is NFC-based) readings via Bluetooth to my phone

Nightscout deployment on Heroku – an open-source frontend/backend for T1 Diabetes data hosting and visualisation

• self-signed xDrip app – an open-source app which receives readings via Bluetooth, and sends them to Nightscout

• Medtronic Insulin Pump – to inject insulin

Intel Edison + Explorer HAT – a Linux electronic board with WiFi and support for 900MhZ radio comms

4400mA Lithium Ion battery – to power the “rig” on-the-go

OpenAPS – the ‘operating system’ of the artificial pancreas rig. Downloads readings from Nightscout, dynamically predicts and adjusts background insulin delivery on the insulin pump via radio, uploads all of this data to Nightscout for continuous monitoring.

Costs

Costs are in AUD and EUR.

Insulin pump – I already had this from years ago, but usually around €3100/$5000.

FreeStyle Libre CGM – €70/$112 for the reader (one time cost), and €70/$112 per sensor (which lasts 14 days, so €140/$225/month)

Miaomiao – this was €200/$322

Hosting Nightscout on Heroku. Free.

xDrip app. The app is open-source, but since Apple doesn’t allow it in App Stores, I had to purchase a 1 year developer license to sign and install it on my phone. €93/$150

Intel Edison. Even though these boards are no longer sold by Intel, it was still rather cheap. €57/$92 (including shipping of €12/$20).

Explorer HAT. This piece is a bespoke product made by a company called Enhanced Radio in the US. €68/$109, although I had to pay Dutch import tax of like €20/$32 because I forgot this was outside the US.

Lithium Ion battery. Opted for a battery twice the capacity as the docs, just to err on the side of caution. €50/$81 (including shipping of €22/$36, and taxes €8/$13).

OpenAPS. Open-source 😉

Total fixed costs (excluding pump):

€608/$979

Total monthly costs (excluding insulin):

€140/$225

The timeline

Stage 1: Research

There was quite a lot of research involved, and definitely more to come. Some things I had to understand:

• which insulin pump I had, and whether it could be hacked to run this system

• comparing the different open-source systems. There’s another called Loop, which is an iOS app, that uses a custom board called RileyLink. There’s also an Android port, called AndroidAPS.

• whether I could get this working with FreeStyle Libre – which is the cheapest and most easily-purchasable CGM (you can’t just buy these things off Amazon) but definitely not the most ubiquitous.

• after choosing to build on OpenAPS, having to decide which of the Intel Edison or Raspberry Pi I would choose. I ended up selecting the Edison, since it’s got much better power efficiency than the Pi.

Estimate: 7 hours

Stage 2: Ordering

All of these parts came from different places:

• The Edison has been out-of-production for 2 years now. I had to do a bit of sleuthing on Amazon and various other sites to find one. Eventually I found a seller on eBay who shipped from the US.

• The Explorer HAT was ordered from the US, easily through the one supplier.

• The Miaomiao took the longest out of all (2-3 weeks), coming from some dodgy place in China (despite being a Brazilian company).

• The battery (and some extra assembly bits) was ordered from Adafruit (a very reputable online electronics company), again coming from the US, but different shipping company.

Total time waiting: 3 weeks

I spent my $1000, sent them to my business address, and then went to Sweden and Finland while I was waiting.

This also misses the part where I had to go to the Dutch post office to pickup one of the packages, because apparently I owed import taxes on it.

Stage 3: Assembly

I was so excited to get this thing setup.

Estimated time: 9 hours

This stage took the longest. Why?

• 1 hour in total. I had to read the OpenAPS documentation, which is long. Very long.

• 2 hours. Downloading Jubilinux and properly flashing the Edison, over a microUSB cable. Fun fact – there are microUSBs cables that support data, and ones that don’t!

• 2.5 hours. Downloading packages/dependencies using APT and NPM on a microcomputer. Then downloading them again, because OpenAPS is just a collection of rudimentary Bash scripts.

• 1 hour. I had to buy an Apple Developer License and learn how sign and install this xDrip app.

• 1 hour. Getting Nightscout setup on Heroku, with proper authentication and specific plugins for the OpenAPS system. Then adding these credentials to xDrip on my phone, and to OpenAPS

• 2 hours. Debugging why my loop was not running properly. For some reason, it couldn’t get the levels from Nightscout. I spent some time, cat ‘ing various logs, before I jumped into the nightscout/intend-to-bolus channel on Gitter. Within an hour, the very friendly folks were able to help me – we found the source of the issue was with the Tomato uploader, and I swapped to using Xdrip.

More >>>>>>>

09/08/2019

هل الدحيح ينشر العلم أم الإلحاد والخرافات؟

04/08/2019

The famous 8÷2(2+2)=? math problem solution

img_8355

 

 

القاعدة هي أن العمليات ذات الرتب الأعلى لها أولوية أكبر في الإجراء. وهنا نواجه مشكلة صغيرة وهي أن بعض العمليات لها نفس الرتبة، فالجمع والطرح من الرتبة الأولى، والضرب والقسمة من الرتبة الثانية. في هذه الحالة تجرى العمليات من اليسار إلى اليمين، إذ أن اتجاه إجراء العمليات لا يؤثر على ناتج الجمع أو الضرب، بينما القاعدة في الاتجاه هي الإجراء من اليسار إلى اليمين في الطرح والقسمة. وهكذا فإن ترتيب إجراء العمليات الحسابية في التعبيرات المعقدة هو كالآتي:

1 الأقواس (يتم تقييمها من الداخل إلى الخارج)

2 الرفع إلى أس (رتبة ثالثة)

3 الضرب والقسمة (رتبة ثانية) وفي حالة وجود الاثنين معاً يتم إجراء العمليات من اليسار إلى اليمين بالترتيب

4 الجمع والطرح (رتبة أولى) وفي حالة وجود الاثنين معاً يتم إجراء العمليات من اليسار إلى اليمين بالترتيب

16/07/2019

الذكاء الإصطناعي – AI هوايتي – د. محمد قاسم

21/06/2019

نبض الدماغ Brain beats 💗

19/06/2019

Mirror making كيفية عملية تصنيع المرايا