03/25/2020 at 12:17 •
Today I got an email from Mouser. They cancelled my Melexis sensor order...
Dear Mr ...,
First of all I would like to thank you for your order!
We have received information from the manufacturer Melexis that due to the worldwide situation and high demand of the temp. sensor 482-90614ESFDCI000SP an allocation status has been created and therefore first the medical applications will be supplied and orders of other private use have to be cancelled.
Unfortunately I have to inform you that we have to cancel the above order.
03/01/2020 at 17:30 •
Before I start programming, I thought about how the graphical user interface could look like. I decided that the time and date cannot be set manually. It always annoys me when I have to set a clock manually. I use TimeSerial here. To do this, the thermometer is connected to the computer via USB and then a small Processing program is called. One mouse click and the current time and date on the computer is transferred to the thermometer. Details can be found here.
Intro starts when the ON-button is pressed. After the intro, the main menu is called up,
through which sub menues you can scroll by
moving the joystick to the left or right. If the
center button on the joystick is pressed for
sub-menu "OFF", the device switches off.
The device also has an automatic shutdown.
If the joystick is not moved for two minutes, the
device will also switch off, no matter if you are
in the main menu or a submenu.
Sub-menu "MODE", which can be accessed
by pressing the center button on the joystick.
Here you can choose between ear or temporal
artery temperature measurement.
Sub-menu "UNIT", which can be accessed by
pressing the center button on the joystick. Here
you can choose between °C and °F. Default
setting is °C.
Submenu "CLAS", which can be accessed by
pressing the center button on the joystick.
Here the thermometer asks questions about
symptoms and calculates how likely it is that
you have caught a flu or cold.
Submenu "TIME", here you do not need to
press the center button on the joystick. The
time is shown immediately in the upper left
corner of the display.
Submenu "DATE", here you do not need to
press the center button on the joystick. The
date is shown immediately in the upper left
corner of the display.
02/29/2020 at 18:43 •
Self-tapping screws, M2 and M2.2, in various lengths are required for assembly. Holes in 3D printed parts are usually smaller than dimensioned. The drill holes can be re-cut with an appropriate drill bit. Additionally two spacers with a length of 6mm are needed. I use here pictures extracted from the 3-D drawing, because they are much clearer and easier to read than photos.
First the buttons for the tactile switch and the miniature joystick are attached and fixed with a drop of super glue. Here you have to be very careful not to let the superglue penetrate the switch housings, otherwise they are ruined and have to be replaced.
After the batteries are inserted, the cover of the battery box is fixed with a self-tapping screw M2x4.
02/26/2020 at 14:12 •
In this log I will explain how I use a naive Bayes classifier to distinguish between flu and common cold by just knowing a few symptoms.
A naive Bayes classifier is based on applying Bayes' theorem with the naive assumption that the data are independent from each other. Bayes' theorem can be written as
P(h): Probability of hypothesis h before seeing any data d and
P(d|h): Probability of the data if the hypothesis h is true.
The data evidence is given by
where P(h|d) is the probability of hypothesis h after having seen the data d.
Generally we want the most probable hypothesis given training data. This is the maximum a posteriori hypothesis
where H is the hypothesis set or space.
If our data d has several attributes, the naive Bayes assumption can be used. Attributes a that describe data instances are conditionally independent given the classification hypothesis
I didn't get any data how many people catching a common cold a year, but this can easily be fixed. I know that every human depending on the age catches a cold 3-15 times a year. Taking the average of 9 times a year and assuming a world population of 7·109, we have 63·109 common cold cases a year. Around 5·106 people will get the flu per year. This lead as to the following probabilities:
That means only one of approx. 12500 patients with common cold/flu like symptoms has actually flu!
Next we need to know more about the symptoms. How often occurs a certain symptom when you have common cold or flu? After a bit of search, I got the needed data, see here, and we can derive our probability-look-up table for supervised learning:
Prob Flu Common cold P(h) 0.00008 0.99992 P(Fatigue|h) 0.8 0.225 P(Fever|h) 0.9 0.005 P(Chills|h) 0.9 0.1 P(Sore throat|h) 0.55 0.5 P(Cough|h) 0.9 0.4 P(Headache|h) 0.85 0.25 P(Muscle pain|h) 0.675 0.1 P(Sneezing|h) 0.25 0.9
Finally we can compute our classification hypothesis:
You certainly know this, but let's mention it on that point: the probability that an event A is not occurring is given by
Multiplying a lot of probabilities, which are between 0 and 1 by definition, can result in floating-point underflow, but this can be avoided easily. Since
we can just summing logs of probabilities rather than multiplying probabilities. The class with highest final un-normalized log probability score is still the most probable. Hence
02/20/2020 at 14:33 •
First batch of housing parts, 3-D printed by Shapeways. So far everything fits nicely:
02/13/2020 at 16:25 •
As usual I start with the creation of the schematic for a project. As already mentioned that the circuit is powered by two 1.5 V alkaline batteries. The LT1300 forms with L1, D1, C2 and C3 a 5V step-up converter. The 5V output voltage is guaranteed to a minimum input voltage of 1.8V. The 5V are then feeded into the Teensy.
Q1, R3 and SW1 form a simple latching style power circuit. On power up the R3 resistor pulls up the gate on the U1 p-channel mosfet which prevents current from flowing through U1. When the user presses SW1, the gate on U1 gets pulled to ground which allows the current to flow, the LT1300 and the Teensy turn on. The Teensy then drives the GPIO pin to ground. When the user releases SW1 the GPIO pin keeps the gate low. The Teensy (or user) then just Hi-Zs the GPIO pin when it needs to shutdown. This way it can make sure the data is safe when it shuts down.
Resistors R4 and R5 are wired as voltage divider to monitor the battery voltage. R1 and R2 are pullup resistors for the I2C bus, R6 to R10 are pullup resistors for the miniature joystick. PZ1 serves as an acoustic signal generator. BAT1 feeds the internal RTC of the Teensy. For this purpose a 32.768 kHz crystal must be soldered to the bottom of the Teensy board, for details see here.
Since we're going to be powereing the Teensy from the 5V step-up converter, we want to cut the jumper that bridges the USB bus voltage to the Teensy power input.