Sit.Up

Intro

Sitting for long periods has become more common in today’s jobs causing serious health issues. Unfortunately the plethora of activity trackers fail to address the issue: being rather active while sitting does not provide a good picture of the amount of time spent sitting.

Sit.Up is a simple device that alerts the user if sitting for too long and tracks the sitting time. It comes in two flavours: a device for the chair which works with any user and a device for the user which works with any chair. Currently I am doing some experiments to see which one is more feasible.

This project is an entry for the Hack a day prize 2015 and is a work in progress. Stand by for updates and drop by to give a Skull for appreciation.

14.06.2015 Wifi Enabled Data logging and display chair

After the first successful tests using capacitive sensors I implemented the thing in the chair. Here are the modules as size comparison. The new module can sit on top of 2 AA batteries and will not require more than 2 wires leaving from it.

DSC_4728

 

Due to the nature of the capacitive sensor, having an ISP/serial cable connected to the PC influences the measurement. In order to develop the software I connected an LCD and in the end I thought it should stay on the chair for a while.

There are 2 electrodes made of aluminium tape: the one towards the back is the ground and the one towards the front is the sense. The capacitance is measured between the two and when a person sits, it increases. I could not find any normal sitting position on the chair which does no detect the person. Here is the whole thing assembled.

DSC_4756

 

And of course, some data logging on the LCD:

DSC_4747

11.06.2015 Welcome capacitive

For the last 2 days I have experimented with capacitive sensing. Things are a little bit trickier that with buttons: normally a capacitive sensor drifts, therefore it needs to be constantly adjusted. For a button it is not an issue, as you expect it to be not pressed most of the time. So, you just compare the current readout with some average over the past and you are done. For the Sit.Up sensor it needs to be able to detect a “button press” for longer periods of time, so the button methods don’t work. I believe I solved this problem differently, but more on that later.

The new sensor can be a lot smaller than before, this new board sits on top of 2 AA batteries, and will be hidden under the chair anyway.

DSC_4697

 

DSC_4716

09.06.2015 Optical does not work

Today I was checking the proximity sensors based on optical reflection, specially the VCNL4020 which can do 20cm and which I have in my parts box. Or the SI1146. It turns out that even though these would allow for a smaller sensor, they have more limited range than the ultrasonic distance sensor. Then, it hit me: capacitive! A simple wire placed under the chair can measure capacitance which should change depending on whether somebody is sitting or not.

Note: i am not looking at making a chair with built in sensor, rather a sensor as a simple to use add-on.

03.06.2015 New ultrasonic sensor and some data

It’s becoming obvious that ultrasonic sensors are not the best way to tell if somebody is using a chair. I have failed to make another one work with a different model of a chair, which means they will not work everywhere. Apart from that, they are very bulky, coupled with 3AA(A) batteries will have to create a reasonably large sensor. Time to think of alternatives.

I have just received the new US-100 ultrasonic sensors from ebay. As they operate from 3V, a 3.3V supply can be common to the microcontroller and WiFi. Current consumption is also lower, I am measuring 1.8mA vs 7.5mA with the older sensor, 4 times less, this should improve overall power consumption.

DSC_3999I have set up an emoncms panel to watch over the data. Unfortunately it takes a precise level of zoom for the first graph to look this great: the visualizer decimates the data and then interpolates the remaining points linearly, which usually causes it to draw diagonal lines between some sitting and non sitting event. However, here is a section that looks great:

emoncms_data_2On Saturday, 30th may I left something on the chair by accident, which caused it to record a lot more hours. Human and non human distinction would be great for new types of sensors.

25.05.2015 First experiments with chair version

The chair version will work with any user and should be as low cost as possible so that it will be installed on a high scale on any possible chair. Alternatively, if the chairs are dedicated per person they may provide insight on time spend on each chair, like at work, at home or in the car.

I started doing some experiments with an ultrasonic distance sensor. As it turns out, it is not the ideal thing to use: this particular version requires 5V and quie a lot of power, but it will do for the time being, as proof of concept.

The circuit is build around an XMEGA32E5 one some header board, with an attached ESP8266 and your tipical HC-SR04 ultrasonic ranging module, nothing special. It is not optimised for power consumption in any way so it will burn a charge of batteries in 3-4 days. For now, it simply uploads the data to emoncms on my website, similar to Led logger V3.

DSC_3969

 

DSC_3972

As it turns out, putting the sensor on the top of the chair is not a good idea: some fabrics seem to be pretty bad at reflecting ultrasounds and crouching does not detect the person.

DSC_3979

Next up, i mount this sensor between the seat and back of the chair. It is a delicate position, as a bit higher or lower will cause the sensor to pick up the cushions as obstacles. However this seems to work a lot better, usable with all the types of pants that i have. (well a long wool sweater will still break the thing).

DSC_3983 DSC_3993

Conclusion on ultrasonic: might work, delicate to place, large. The high voltage and high power consumption may be managed to get decent battery life.

Next up:

Trying an optical sensor.

Ser SHOW

Have you ever needed to look at what is going on on a serial port and not have a PC/smartphone around because the location was a bit inaccessible? I did not need this until now, but now I do, so I was looking for a solution. After building this, I think that it would be a good addition to the modified programmer.

This is a quick and dirty solution, i scavenged of the build of the ESP8266 test rig which uses the XMEGA header board. It’s using a IL9341 driven 2.2″ 320×240 LCD connected over SPI on PORTC (see code for exact details). I used a rather small font(10×16) to be able to show a reasonable amount of text, 20 lines and 24 characters per line. The LCD is used in portrait mode, since it only supports hardware driven scroll on the vertical and I did not want to spend time with more complicated code to copy memory.  Even the hardware scrolling functions were missing from the ASF driver implementation for Xmega. Without hardware scroll feature, there would be a lot of time wasted moving data around the memory, and getting a reasonably fast response would require a lot of SW optimization.

Two hardware UARTs are used to monitor a bidirectional serial port communication between 2 devices, the one on PORTC and the one on PORTE. This allows the micro to know from where to where the data is going and display both in different colors, white or green, color matched to the input wires.

Since it needs to be portable, it is powered by 3xAA batteries. Current consumption is under 50mA, so that should be over 50 hours of operation. Additionally the micro supply is brought out, so it can be powered by the external circuit or provide power to it.

Here are a few pictures of the build and a video of booting up a router:

 

DSC_3939

DSC_3940

DSC_3957

 

Quiet 3D printer

Intro

I have recently purchased a 3D printer, mostly because  I was interested in learning about 3D printing, and of course, because I wanted one. Between buying a ready to print one and sourcing all parts individually, I went for a complete kit. I though getting a kit that needs assembly would allow me to learn more about it and I would enjoy assembling it. So, I went for a prusa i3 steel, because i wanted something capable of both ABS and PLA from the start and should have reasonable endurance.

The Noizzzz

Clearly, the thing is noisy, without any tuning it was constantly over 70dB, peaking at 75dB for some motions. Since I keep it next to my computer desk where I spent most of the time, I am troubled by it. So i made some changes to try and reduce the audible noise. For noise measurements I have used my smartphone with Audio Tool app and an IMM-6 calibrated microphone placed about 1m from the printer.

1. Support. Place the printer on something as rigid and heavy as possible. I found that tables are not that great, but a drawer set works better.

2. Decouple from the support, in order to minimize vibration transmission. Apart from a layer of foam, I used 4 furniture support feet placed under the Y carriage, which means that now the 3d printer touches the ground in less and smaller points than before. This helped a lot.

DSC_3769

3. Play with printing speed. As a mechanical system, the whole printer is prone to have certain resonant frequencies and it turned out that the default 50mm/s speed was the loudest possible.

Speed 1

4. Change the motor drivers. The biggest change I have managed to make in terms of noise was to swap the original A4988 X and Y drivers with DRV8825. While these produce a high pitch wine, the mechanical noise is strongly reduced, i managed to get about 8-10dB.

DSC_3923

5. Fix the power supply fan. The most annoying thing about it is that it cycles ON/OFF, not continuously variable according to the temperature. Of course  this is acceptable for an industrial power supply, but not for home use. I could have replaced the control with a variable speed one, but there is not much to gain here either: the fan is small and placed in a closed space. The solution i settled for was to replace it with a 9cm fan, the largest I found in my parts collection. After cutting out the previous guard, I mounted the fan as far away from the case as my screws allowed and sealed the area around with duck tape. This is to allow the air to flow easier and keep the fan blades away from the big aluminum plate which would cause noise. Of course, no fan is complete without a red guard on top, with a bit of scaling. I left the original control in place, but I added a 50 ohm resistor as well, to keep the fan turning at lower speed. My goal is for the original thermostat that puts the fan at full power to never trigger. Some tests have shown that this performs as desired, even the outside of the power supply stays cooler then before. This is clearly beneficial and should increase the life span of what is not such a great quality power supply. Check below for the build pictures below.

What is inside the typical not so high quality, 360W, 12V LED power supply:

DSC_3901

For thermal regulation, the power supply uses a simple mechanical thermostat placed inside the filter inductor, which switches the fan on at 45°C and switches it off at 33°C. Since the printer does not draw much power, the fan cycles ON and OFF, which is not that great for all the components, since they keep cycling between the 2 temperatures.

DSC_3906

I have removed the original fan and cu the grill to improve airflow as much as possible. The fan is placed at about 1cm further away from the case to reduce noise.

DSC_3910

 

DSC_3912

Tape is used to seal the gap

DSC_3915

I connected an extra wire to the positive supply of the fan to be brought outside in order to add a resistor to keep the fan at idle speed.

DSC_3914

Ending with some experiments for idle speed

DSC_3920

Of course, no fan installation is complete without a red grill

DSC_3921

Note: The E3D fan is small and it’s quite noisy, if the printer does not print. Otherwise there is no difference in noise with or without it, so there is no need to replace this one with something larger.