Ready made jumper wires are popular for making prototypes and even using them permanently in projects. For me, these are some of the things that come from the various far away eBay sellers(or similar stores), as they are very cheap. The same cheap wires can be bought for more money from various local shops, who are reselling them.
However, recently I have bought a set from one of the big component suppliers, because I needed them in a day, not a month. This, of course, came with the penalty of paying about 4 times more for a set.
The difference in feel is huge: the expensive ones are much thinner and more flexible and seem to lack any bad plastic smells. Next, I measured the electrical resistance including the contact with a pin header, and the picture says it all. On the left, the cheap version is around 0.53Ω, while the good one is 0.09Ω, more than 5 times better. Or, to put it from my experience: I expected about 0.1Ω, which makes the cheap ones 5 times worse.
This means you should pay attention whenever powering anything that draws a little more current. Using 2 of the bad wires for a power supply get you over 1Ω or resistance. I have experienced this with various modules, like motor controls or even radios such as the ESP8266 or the NRF24L01 with PA: drawing some 300mA causes about 0.3V drop on the power supply.
But it is not the absolute drop in the power supply that causes problems, it is the internal reset circuit that can cause a reset whenever the power supply suddenly drops by that much. This is why adding a large electrolytic capacitor near the device solves the problem.
What should you do? Depends on the application. The cheap ones are definitely adequate for most things and the price is better. However, the expensive wires will give you a lot less headaches.
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 attaches to the chair and alerts the user by vibration if sitting for too long while also tracking the sitting time. It aims to be easy to install and forget on any chair and work with any person. On top of that, it is very low cost and has months to years of battery life. With an optional WiFi connection, the data can be uploaded and you can track your sitting times.
Let’s have a look at why sitting is bad for you, could not explain it better myself:
Version 2 of the project brings in new hardware and software features. Sitting is tracked, the data is uploaded and logged and the user is alerted of the prolonged sitting, while the web interface shows daily sitting time and real-time status.
I have greatly improved the self calibration of the device and currently testing the long term capabilities compared to previous operating time of a few days. By fixing some firmware issues, I have extended the battery life to more than 1 year with typical usage. The device has a dedicated box and PCB making it look more of a product than a prototype and minor details like multiple LEDs offer a better user experience. Still, there are minor software tweaks to fix and the project would greatly benefit from a new user interface, as I am planning to move from the open energy monitor to a dedicated platform.
Under each chair there is a small module that monitors the status with the help of a capacitive sensor. When you sit down, a timer is started, counting how long you have been on the chair. After a while, a discreet vibration alerts you of the time spent on the chair as an invitation to take a short walk.
Ignore it for too long and the notifications get more insistent and even public, with the help of a buzzer. After all, not letting your chair buzz would be a public sign of trying to stay healthy.
The sensor connects to the internet and sends data to the server by using the local WiFi. The web interface allows the user to configure the alert times and track sitting. The web page contains instant status of the chair as well as statistics of the amount of daily sitting times.
Hardware revision 2 is now complete, this includes a dedicated PCB for the circuit and a dedicated 3D printed box. I have made the new box black to merge better with office chairs, even though the box is not visible under the chair. Check you the newer V2, assembled
Make sure to check out how simple it is to install the device, once it has been assembled:
and of course, a short testing. I had to alter the timings and disable the power saving to make the device more presentable.
13.09.2015 – New PCBs
The new Sit.Up! PCBs are here, a dedicated one just for this project. I added 3 LEDs, a footprint for the buzzer, transistor driver for strong vibration and a few other tweaks. Check it out:
06.09.2015 – 3D printed box with logo
I thought the project needs a custom box, nothing special. Since my 3D printer cannot print more than one colour, I had 2 alternatives to colour the embossed text on the box: markers and pause printing and swap filament. The double filament method makes it only possible to print the logo in a single colour, while colouring allows for multiple.
Here are the two box lids, side by side which one do you like better?
For the first option, I started with a white print, some markers and a bit of colouring, something i haven’t done in a while.
29.08.2015 – An Xmega mistake
Because of so many available pins and a higher current requirement of 80mA, I have connected the vibrator motor to 3 pins in parallel of the Xmega microcontroller. This is a good practice and saves adding an extra external switch, like a transistor in these cases. However, once I swapped the fresh alkaline batteries for some not so fresh rechargables, the vibrator was barely felt. Checking the datasheet shows that the Xmega pins are less capable than the old MEGAs, where my mind went for when I was considering that 3 pins are sufficient. So, time for the first design change: add transistor to switch off/on the vibrator. A NMOS is better than a NPN, since it includes a diode to protect against back EMF and does not need a base resistor, saving 2 components extra.
10.08.2015 Wrapping things up
With the original capacitive sensor proven to be the best option, it was time to wrap up the project and build the final prototype device and code.
Software wise, a lot of features had to be added, most importantly the ability to alert the user when sitting for too long. The device alerts by vibration every 15 minutes, but once an hour has passed, it becomes more annoying. A web interface is in the works which allow configuration of parameters. Other updated include better calibration, low power modes, vibrator patterns, LED blinks, buzzer sounds, LCD disable and a lot of clean-up.
Hardware wise, the module lost it’s LCD for debugging purposes and gained a vibrator motor, to discretely alert the user if sitting too much. Along with the batteries attached under the PCB, the whole thing is a lot more compact, practically invisible when mounted under a chair. The device is build around a general purpose board I have designed for the microcontroller, the complete schematic is available in the project documentation on GitHub.
Current measurement shows up at around 25μA while sleeping, mostly eaten by the EPS8266 module, the micro itself needs only 0.2μA. Make sure to cut the trace of the red power LED on the module, otherwise it will waste most of the power. In active measurement the current drawn is 4mA, going for an average of about 100μA, should provide 2 years of stand by time. Of course, frequent sitting for long times drains the battery because of the vibrator motor and WiFi. Nevertheless, with typical usage I expect about 6 months from a pair of AAs.
Schematics for the device are simple, with plenty of pins to spare on the micro, there are no major issues. The buzzer and LED get a pin each, while the vibrator gets 3, to increase the current capability an elude a transistor. Optionally, there is an ESP8266 for data uploading and logging. The capacitive sensor itself only requires to connections to the outside: GND and Touch, no other components.
The device, now installed looks much cleaner than before
Looking at some data from June, I can say I probably spent too many hours on my home chair, even after a day of office work
12.07.2015 E-filed sensor
As my initial capacitive sensor using aluminium tape as electrodes proved successful, I looked into shrinking the size. Compared to measuring the capacitance, another method of detecting a conductive object like the human body around a sensor is by using the electric field method: 2 electrodes form a transmitter and receiver. When a conductive body comes between them, the amount of signal received changes. I have attempted to use a 75x100mm double sided PCB for this method, at first. In open air the detection distance can be even 20cm, but things change once this plate is placed under a chair: the sensor is very directional and there are ways to sit on the chair without being detected. Swapping the PCB for the original aluminium tape electrodes works better, but there is no point of implementing this method, as it requires extra parts. The system in this case consists of the microcontroller outputting a 1MHz signal on a pin serving connected to the transmitter electrode while the other electrode, the receiver, gets read out by the microcontroller’s ADC after passing through a simple detector.
10.07.2015 – Dedicated proximity sensor – A failure!
I have done some brief experimenting with dedicated proximity sensors, specially the MTCH101: better sensitivity, but comes with 2 nice “features”. First, it is designed for momentarily proximity, so after a while it will compensate the person and think there is actually nothing there. Second, it seems to get stuck in “detected” mode quite often, even the datasheet mentions a “Stuck Release Mechanism” as a feature! So, no good.
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.
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.
And of course, some data logging on the LCD:
11.06.2015 Welcome capacitive
For the last 2 days I have experimented with capacitive sensing using the method described in Atmel’s Qtouch ADC guide: charge division between external capacitor and internal sample and hold. 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.
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.
I 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:
On 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.
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.
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).
Conclusion on ultrasonic: might work, delicate to place, large. The high voltage and high power consumption may be managed to get decent battery life.
While working on the capacitive sensor for the Sit.Up project I stumbled about a common problem: connecting an oscilloscope or the Analog Discovery to the capacitance measuring pin disturbs the whole measurement. This happens because the load presented by the Analog Discovery or your typical oscilloscope: about 1MOhm || 24pF. Most importantly, the 1MΩ was discharging the sense capacitor. To make it work, I needed something with much smaller capacitance and much much larger resistance.
The solution is rather simple: build a simple active probe. Since I was not interested in going beyond +/-5V signals, a simple CMOS rail to rail opamp was sufficient. My parts collection complied and provided the MCP6H92 which has a much better input configuration 10TOhm || 6pF, not perfect, but a great improvement.