Saturday, 21 September 2013

How to get a seat on an overcrowded train using real time sensing?

Kings Cross London Railway Station 2012

I wondered if there was a smartphone app to indicate if the train I am about to get on to London from Cambridge  has a seat or not. I do not know if even our rail network at Cambridge train station counts the number of people who get on each train.  Booking of seats is very unreliable as customers ignore the booked seats.  There will be no solution to train overcrowding in UK in the near future so perhaps a phone App to help?

 I used Google search and typed in train overcrowded accelerometer. I used the search term accelerometer as this can detect if person sitting, walking, etc.  Nothing relevant appeared. There may well be an obscure academic article on the subject, but is did not appear,  but I really want an App to use  or design now. It is really uncomfortable standing for a hour on the train. I used to commute to London in 2012, but severe backpain caused by standing (no seat on train)  and not walking, and other issues forced me to stop.  You won't get many people offering you seats on this London train, even a young man with crutches was forced to stand, nobody gave him a seat. We can sit on the floor but it is very dirty.  We paid (2012) £36 + London underground + £8 parking + travel + coffee to station for a daily Cambridge to London commute, with no guarantee of a seat.

Here is a theoretical  possible method of calculating if people are sitting or standing using motion sensors built into phones. Android has been successful in aggregating or crowdsourcing  GPS location signals from thousands of anonymous smartphones in vehicles to determine real time  traffic jams and can then update Google Maps with traffic data. In Jan 2013 there were 36 Million Smartphones in the UK.




There is an App re train overcrowding but it is not automatic and relies on users typing in data on overcrowding.  There is yet another another App but it is based on train length and historic data, not real time overcrowding, what percentage of  people standing or sitting?   Google will also know where crowds are congregating re their Andriod GPS data. If we use sensors such as accelerometers and temperature sensors perhaps a better guide to train seats available can be provided?

 I thought it might be useful to aggregate peoples' physical movements on a train to determine if seated or standing and so give an indicate of chance of a seat. The GPS location is known, the train time is known and people could share their data via an App or even the background data that Google always collect, see below:



 The method of determining the physical activity of people  has been well proven using accelerometers and many sports/life logging applications using sensing.  I did some initial research in 2000 for Microsoft on this and more of my research on human motion sensing is here. The activity of sitting or standing can be determined by changes in acceleration as in graph below.  People will be holding their phone some of the time, so a need to filter out the relevant sensor signals to determine if seated or standing.


Microsoft  2001 SmartMoveX sensor on the body



Android app with x,y,z, accelerometer data. the blue trace at zero shows sitting down, green at zero shows standing 

The latest MEMs accelerometers have progressed a lot in the last few years. They have a 3 axis output, up from 10 bits to 16 bits output, 1.8V interface. They can have a built in state machine that is programmable to compute actions to detect  free fall, wake up, pulse counters, step recognition, click, double click, shake double shake,face up/face down, turn/ double turn.(data from ST Microelectronics) These all used to be needed to be programmed into the main computer for the phone.  Here is an example LIS3DSH  from ST.


Image from ST Microelectronics 3 x 3 1mm package


The iNEMO-A device from ST combines an ARM microcontroller and 3 channel accelerometer into a 3 x 3 x 1  mm package. There are now devices that combine accelerometers, gyros and magnetic sensors on one board. 
Here is the accelerometer used in the new Apple 5S from Bosch.

If the customer was standing at the train station and message as below received, would we find this useful?
Below are  text message and  Twitter simulations.




My 360 degrees panorama of Kings Cross Station. shows the customers waiting at the departures gate waiting to see the arrival of the Cambridge train. (Spot the headless passenger!)  Everyone then gallops  to the platform so they can get a seat on the Cambridge train!






This Kings Cross Departures Board is missing essential information, such as the current time (!) and is there seating?
I will be interested in your comments or even if there is an app that can help. If enough people interest I will find a team to write the software.


(c) Lyndsay Williams 2013
email: sensecam@gmail.com

Saturday, 7 September 2013

Saving energy, new fridge design based on a freshness sensor


Sometimes the best inventions come when we forced to a deadline or threat. A Microsoft manager used to say to me, if a "gun was placed to my head", how would I solve the problem, (in one hour). This worked very well in focusing the mind when I worked there.
 Moving on to 2013, I was approached last week with a 2 day deadline  on grant application (£50k) for "Green" issues, reducing carbon footprints,  and saving power in the home, a perennial problem with many people seeking solutions. Could I design something?  There are numerous government grant offers for solving these problems. The incentive is getting a grant to design some useful technology for society, getting it manufactured  and get paid for delivering a  result, e.g. a working prototype.

I have some research experience in smell research as here.
I am also fascinated by the sense of smell of our cats and dogs.
So this blog is an excuse for a picture of my cat Dot's nose after her mouth surgery in Feb 2013. More here about the cat's Jacobson's organ.

Click to enlarge


One idea of  interest is saving power in the home, with appliances that are switched on for 24 hours per day, e.g. our fridge. The fridge design needs a rethink to save power. Why do we have a fridge? It is not just for cold beer and chilled wine !
We need our fridge to preserve fresh food food, stop bacteria growing, and to stop food poisoning. We are advised to set our fridge to 4 Centigrade (40 Fahrenheit)  for these reasons. However this low temperature can kill  the taste of, for example fruit,  a top chef told me not to store tomatoes in a fridge, so I have not for many years. We can test for food passed it's best buy date by smelling it.(Don't trust me on this). What if you are a vegetarian, you may not have animal produce, do you need a setting of 4C ?   So we could design a fridge with a gas sensor to detect freshness,  rather than temperature sensing and maybe fridge temperature a bit higher and so save electricity? The modern  gas sensors can detect gas  to 1 Part Per Million (ppm) the start of  decaying food by measuring the ammonia, hydrogen sulphide, methane etc of food that is starting to putrefy. Enjoy this Wikipedia article on decaying food. There are new optical gas sensors but also the low cost traditional gas sensors.
The sensing of imminent decay can be used to control the temperature. A microcontroller can measure the gas level and provide an audio link or control to an external mains controller for the fridge.
The food obviously needs to be unwrapped for the gas sensor to work, but this is fine as sometimes the forgotten piece of unwrapped food in the back of the fridge is the culprit.
Some people do not have a sense of smell and this sense also fails as people get older.
Re the power saving, if we can keep our fridge at 12C (perfect temperature for some white wines?) and our vegetable retains some flavour, this all contributes to saving power in our fridges.

My warm salad, smoked salmon, olives, and tomatoes 


The engineering design with a microcontroller should be routine, gas sensor samples every hour or so so an AA battery should  last a year. We can add temperature measurement. We can measure how full the fridge is by an ultrasonic echo sounder, (full fridge, but not overloaded is more economical). An audio alarm for when the fridge door has been open too long for viewing?  I feel the call of programming an Arduino again...

And yes, radio signals (to the mains controller if needed) do work transmitted into and out of a fridge, I tested it on my mobile phone.

This may be more of a research project, a possible grant application, but feedback and shows stoppers welcome. If a 20% reduction in power consumption on the fridge can be achieved that is a start.

Useful to know,  preferred storage temperatures:

Champagne temperature 10-15C

Chicken 4C more here

Tomatoes 13C

Eggs varies from 4C ?

Wine storage


Lyndsay Williams sensecam@gmail.com




Monday, 2 September 2013

A short history of lifelogging devices

Arduino datalogger 2012


Lifeloggers, people who wear computers in order to capture their entire lives, including physical movements  are not new. My first introduction to lifelogging was  around 1976 when St Mary's Hospital, Manchester  approached me re a design for a device to record the activities of  hyperactive children.  The device would attach to the leg and measure and count the activities of the children. I discussed the use of mercury switches and TTL counters, as there were no low cost microcontrollers or small accelerometers. I was fascinating by this, and was spending a lot of time designing dataloggers, particularly for digital audio.

Here is an example of a similar  lifelogger using a mercury switch and TTL logic to count from this 1978 patent.
The band wrapped around the leg of the child.


Click to Enlarge

1980, I worked at British Aerospace on noise reduction systems for The Queen's Flight.
Here is an example of the accelerometer used to measure vibration of the out of balance propeller, the size of a tin of food.



Moving forward to 1998, I  joined Microsoft Research, Cambridge.  They were interested  technology for a sensing pen I had designed, SmartQuill, but the patent was later bought by Apple for the iPhone.  This was a lifelogging pen, that would record all your written words, and has sensors built in like a camera, tilt sensors to orientate the display and detect the person's physical activity using accelerometers, eyeball tracking,  heat and touch sensors.

SmartQuill handheld computer 1997 - click to enlarge 

In 2000, I designed SmartMoveX. This was a lifelogging device I wore for 23 hours/day (leather is comfortable)  for  months to detect and log body movement using an accelerometer, Galvanic Skin Response, light  and heart rate. I used it while working, sleeping and cycling. It would send me alerts if it detected inactivity and laziness  for more than 30 mins. It was a good way to reduce a person's weight but the novelty of wearing the device wore of after about a year. The device really needed to be smaller.   There is more data  in the PowerPoint  link including some metrics.   You  can buy devices with similar functionality now from Nike etc. 
 SmartMoveX 2000

Time to add a camera

 At about 2000 I  had an inquiry from a friend who was a dentist and wanted a time and motion study recording but also including images of the performance of the surgeon re time sitting down and  standing up and minutes spent on surgery.  I also wanted to help a friend who was always losing his keys. I  needed to design a lifelogging device with a camera  that would photograph every room as he walked through the door frame and so capture a sequence of rooms that had been walked through and so trigger his memory.  I had also lost my memory for many months, when I was at school,  due to a road traffic accident so knew the frustrations of have no recollection of the last few months of my life. (Memory was so bad I could not remembered if I had attended a Rick Wakeman music concert, that had occurred a month before my accident,  normally a concert is etched in the memory) I also wanted a device that could predict what events in people's life would trigger illness like migraines. The SenseCam was like a black box data recorder for the human body, recording motion, temperature, location, images. Heart rate was done externally.

The first sensing camera  I built  was based on a digital Kodak DC20   camera with only approx 16 frames of storage in 1Mbye of memory.

 Kodak DC20 camera 

 I dismantled the DC20 camera and checked  the electronic  shutter circuit. I designed a circuit based on a PIC 8 bit  microcontroller to control  the shutter using a MOSFET transistor  on based on motion  interrupts from an Analog Devices accelerometer. Triggering images using sensing enables much more useful  interesting images than timelapse which can miss 99% of events. Sensing also allowed the use of limited RAM  memory to take more pictures.  I connected it to my bike basket  and got some fairly unexpected pictures in Cambridge, cars pulling up in front of me and startled babies on pushchairs as mothers pushed them into the road in front of me! The images were only captured with a narrow  degree of view, so a lot of pictures of sky or the road. I put the research on hold as no suitable lens.
An early sensecam, no wide angle lens or PIR


 For the Sensecam I  decided I needed a fish eye lens to increase the field of view. After a lot of experimenting with door peep holes lens and similar I eventually sourced a reasonable wide angle lens (130 degrees)  similar to this. A very wide angle lens also has the advantage of a depth of field from around 6 inches to infinity so no focusing needed.


 wide angle lens 130 degrees

 I dismantled the camera, removed the original lens and replaced it. I removed the infra red filter and so could capture IR that the eye could not see. See below for image of King's College, Cambridge  showing the chlorophyll of the green grass but as white. Here is the video.



  By 2004 the rather neat Philips wearable camera was on the market so I used this for tests.
Later Sensecams were based on the camera module from inside this Philips Key wearable camera


I also decided that capturing pictures could be triggered by other life events, e.g. a person moves in front of the lens, so I used a 10mm diameter passive infra red detector to detect the heat from a person.  A Red Green Blue light sensor was also used to trigger images based on light changes, e.g. walking through a door frame. I tried a temperature sensor but after around 20 mins this was warmed up by the body and showed the user's temperature. I did not want to capture audio as an invasion of privacy, hard to compress the listening experience,  and there were also third part devices that did record sound.
I recorded GPS using an external unit as these were  low cost and the data could be synced via a time stamp. I also knew there would be problems in battery life,  getting a very small GPS antenna in the same case as a camera and power supply without electrical interference. There were other problems to be overcome, e.g. the camera module took 150mA to capture a picture which curiously  is  curiously just as high as the current Omnivision camera modules. An 1.5V AA battery with voltage converter allowed 5 hours of battery life.

There are cameras today, e.g. Autographer, (uses the above SenseCam patented Microsoft technology) and Memoto, due to ship soon.

It is possible to build you own lifelogging camera, an Arduino can be used as a controller, with sensor triggers,  and used to control shutter of any camera.  However there are a few small cameras on eBay that are wearable and can be used.


In 2007 I designed and built a life logging lightbulb,  SenseBulb, that tracked the heat from a person and inferred  their activities from heat movements.


Later Sensecams

I have designed more advanced Sensecam's that use heat sensors to detect the heat a few feet in front of the camera , and this can detect the heat from hands moving in front of the camera, people, food, and so trigger an image. I also use infra red system to capture what the eye cannot see. The device is clipped onto the chest like a nurse's watch and can also capture respiration, (GSR) and heartrate.

Audio recording
 There is also a  version that records audio but compresses a day's audio into approximately 5 minutes, so just an impression or montage with no invasion of privacy. It will replay doors closing and opening, trains,cars,  laughter, birds, cocktail conversation etc and so an audio summary of the day. These can be played in synchronisation with the video or as a stand alone impression of the day.
I am testing this at present, Sept,  but some work needed on the speech  algorithms.

Below is an example of a BBC radio play which I am processing today with Audacity to compress and remove the dull parts. (The Archers Sept 2013).


click to enlarge


I am also (2013) working on Sentinel, a  device to predict or avoid early death caused by illness or accident. The user does not even need to have it close to them to capture measurements.  Details under NDA.


Sensecam is a registered Trade Mark owned by Lyndsay Williams.

Lyndsay Williams, sensecam@gmail.com