Thursday 8 May 2014

Halal or Not Halal? That is the Question.

Today's news is full of stories that Halal meat is being sold in the UK without being labelled as such. Now let's get this clear: according to the BBC, 90% of UK Halal meat is from animals which have been pre-stunned, so they conform to legal requirements without the religious exemption. So what's the issue?
During the Foot & Mouth crisis, having seen videos of a man running around a field with a bolt gun after a sheep, I decided to look into legal slaughter practices, (he should have been imprisoned in my opinion), and in doing so I also looked into Halal practices.
The biggest issue for me, way bigger than whether someone speaks magic spells over my food, is that correctly carried out, to the spirit and letter of the law, legal slaughter in the UK is as humane as it's reasonably practical to be. And in my view it's far preferable to death from predation or disease in the wild.
The problem I have is that human nature does not pre-dispose us to treat other humans, let alone other animals, with the dignity, respect and humanity required when there is so much potential for suffering. So we need far greater safeguards against the darker side of our nature in the slaughtering process. I have some in mind, which include routine oversight by independent observers, but the cost would be unacceptable to many people who just want a cheap meal to feed their families.
There are three main requirements for the practice of Halal slaughter: ritual cleanliness; hygienic cleanliness; and minimising the suffering of the animal being slaughtered. Whatever you think of Islam today, these requirements clearly underlie Halal practices and they are entirely consistent with the best ethical practice in humane animal slaughter.
Considering the time when these requirements were established, there was not the knowledge of disease causes we have today, and the distinction between ritual and hygienic cleanliness was entirely blurred. Speaking magic spells over the animal was just as important as ensuring that the animal did not have a communicable disease. The strict requirements of the blade, and the manner in which it is used, are clearly intended to minimise pain and bring about unconsciousness as quickly as possible, both requirements for humane slaughter.
The prohibition on pre-stunning prevents botched attempts which could cause unimaginably greater suffering than a clean Halal kill. And given the state of knowledge over a thousand years ago, when these requirements were founded, I cannot in all conscience condemn it. And having read the scientific literature examining both sides, I find it hard even to insist on pre-stunning, but on balance I do support it.
So, the Halal requirements for cleanliness and the humane treatment of animals are precisely the same as those which underlie our legal requirements today. If Halal practices could be refined in the light of new scientific evidence, then I have no doubt that they would allow carefully prescribed pre-stunning, and place less emphasis on magic spells. Halal practices were introduced for precisely the same reasons we want humane slaughter today, and dogmatically holding to the letter of scripture, while denying improvements in the light of new knowledge, which support its spirit and clear purpose, can be neither just nor holy.
According to the BBC, 90% of UK Halal meat is from animals which have been pre-stunned, so they conform to legal requirements. There is no legal prohibition on magic spells, since we all know they do nothing so cannot possibly do us harm. Therefore, I would be perfectly content to buy and eat Halal meat from animals treated according to secular law, including careful pre-stunning, with or without the magic spells and added Halal requirements, and whether labelled as such or not.
The final issue troubles me as a secular Humanist: compare two circumstances.
1) The legal, ritual slaughter of animals by a devoutly religious person, who believes he is being watched over by an invisible master who requires the animal to be treated with respect.
2) The slaughter by the hand of the kind of person I can imagine applying for and doing the job of slaughterman in a secular abattoir, without independent oversight.
In the light of this comparison, and knowledge of the requirements for Halal slaughter and secular slaughter, I do have a hard time condemning Halal practice.
This is an emotive subject, but I do have one request. Before condemning my heresy, please do read up on the details and argue from a position of knowledge of the subject. Then please feel free to weigh in.

Saturday 3 May 2014

Billysugger Simples: How to measure temperature with a Thermistor

Introduction

Often we have a requirement to measure the temperature of the board, the environment or some process.  Here’s a quick and easy guide to simple temperature measurement using a simple, cheap thermistor.

There are numerous silicon devices on the market which seem to simplify temperature measurement, but it’s difficult to beat a good quality NTC thermistor.  I’ve used them to measure the temperature of things as diverse as engine manifolds to LEDs, and in medical applications have measured patient internal temperatures to accuracies far better than 0.1°C.

Selecting the Thermistor

There are two types of thermistor, defined by whether their resistance increases or decreases as temperature rises.  Temperature is best measured using NTC (negative temperature coefficient) thermistors, whose resistance decreases as temperature rises.

There are two parameters of importance in defining the characteristic: A reference resistance and the Beta value.  The reference resistance is usually specified as the resistance at a temperature of 25°C.  The most common types have a 10k resistance at 25°C.  The Beta value specifies how the resistance varies as temperature deviates from the reference temperature.  The most common types have values in the region of 4000 and have units of Kelvin.

For this example, we will use a Vishay NTCLE100E3103JB0, (Farnell/Newark part 1187031, Digikey part BC2301-ND).  This is a cheap and simple leaded part with a 2.54mm (0.1”) lead spacing, has a 10k resistance at 25°C and a Beta value B=3977K.



There are many, many types of NTC thermistor, some with different case styles including surface mount parts, different reference resistances for nominal temperature ranges other than room temperature, and different tolerances for accuracy.  This one is good for general purpose air temperature measurement.

The Measurement Circuit

The thermistor is connected to the ADC 0V and in series with a reference resistor, forming a potential divider from the ADC reference.  A filter capacitor across the thermistor will reduce any thermal noise, or other pickup.



Now, we can easily calculate the ADC value at 25°C.  And we’ll see that as the temperature increases, the thermistor resistance decreases and the voltage measured at the ADC falls.

Calculating Temperature

We could approximate the thermistor response as a linear function, but beyond a very small range around 25°C, the errors would quickly become unacceptable.  A better approximation is made by using the Beta-curve function:

R = exp[(Beta/Tk) + LN(A)]

Where Tk is the thermistor temperature in Kelvin, not degrees centigrade, and LN(A) is a constant value for the thermistor. (Kelvin is an absolute temperature scale, where Tk = Tc + 273.15).

Solving the above equation for temperature gives

Tk = Beta/(LN(R)-LN(A))

Or

Tc = Beta/(LN(R)-LN(A)) – 273.15

Where

LN(A) = LN(R25)-(Beta/298.15)

But now we need to know the thermistor resistance R.  The ADC value depends of the resistance R as follows:

ADC = ADC_TOP * R / (R + Rref)

Where ADC_TOP is the highest value given by the ADC, (e.g. 4095 for a 12-bit ADC), and Rref is the reference resistor value.

Solving for R gives

R = Rref * ADC / ((ADC_ TOP * Kadc) – ADC)

Implementing in C-code

The following is representative of code which calculates temperature measured using the above method.  The detailed code will need to be adapted depending on your processor, your board and your thermistor.
// Include math library for calculations
#include <math.h> 

// Define ADC parameters
#define ADC_TOP 1023 

// Define thermistor parameters
#define R_NTC 10000
#define BETA 3977
#define LNA (-4.12858298874828)

// Define Reference Resistor
#define R_REF 15000 

float read_temperature(void)
{
  float x = 0; 

  // Calculate thermistor resistance from ADC
  x = (R_REF * adc[0]) / (ADC_TOP – adc[0]; 

  // Calculate Kelvin temperature from resistance
  x = BETA / (log(x) - LNA); 

  // Convert temperature to Celsius
  x = x – 273.15; 

  // Return result
  return(x);
}
 And if you want to play around with different thermistor parameters, I’ve prepared an Excel file with all the calculations included.