Pi On The Wall – wall mounted home server – Part 3: Reducing Power Consumption

If you missed Part 1 and Part 2, it’s probably best you at least read Part 1 to understand the scope of the project. Part 2 discusses how the hardware is modified to fit into a restrictive enclosure, measuring only 10mm deep.

PiOnTheWallFrom the start, I wanted to stretch the boundaries of the Pi On The Wall, and therefore, Raspberry Pi power consumption. It seemed like a rather fun exercise. This post describes what I did in reducing power consumption fairly drastically, given what can be done in this limited power space.

For those who want a jist of what follows: <tldr> I reduced power requirements of the Raspberry Pi with PiTFT and WiFi drastically. Had to plan for high inrush currents in the designs. Choose switching regulators wisely given voltage and load characteristics. Efficiency varies drastically! Espressos are expensive! </tldr>

Power outline – the situation as stands.

The major consumers of power are as follows

Pi model A: 300mA (source: RPi Wiki )

PiTFT: 100mA (source: Adafruit website )

Edimax Wifi dongle: unknown for sure. This uses the Realtek RTL8188CUS chipset. The only datasheet I could find for it was from a third party which suggested maximum 600mA at 3.3v. It did not provide minimum and typical current ratings, sadly. That’s nearly 400mA at 5v – Whoa.

So we are looking at around 400mA + wifi. Looking around, it seemed to be the WifF would cost about 100mA in active use, not the 400mA from the datasheet, so we’re looking at 700mA for the whole unit.

Since we are space constrained, the power supply situation is a sticky problem for me. The more power required, the more heat given off by the supply, so I want consumption to be low, and efficiency high. My original hope was that I could use the power supply provided with the thermostat casing, as it outputs 5v. Sadly, after testing it with an adjustable current load, it became clear the supply would not be suitable. At just below 200mA draw, the supply would give up, sending the voltage down to millivolts. In fact, even with 150mA, the voltage dropped by 600mV, so using it for the Pi isn’t very feasible.

From looking at various threads about power consumption online, I came to the figure of having this run at 250mA. I’d like this number at idle with the PiTFT backlight on, but peak will probably be higher. Nothing very scientific in how I came up with that number –it’s just a rough guess of what seemed reasonable to achieve.

Lowering Power

The first thing that jumps out at you when researching Raspberry Pi power consumption is the 3v3 linear voltage regulator, marked RG2. That component takes the 5v power input and outputs a stable 3v3 rail which powers most of the devices on the board.

rg2Linear regulators are inefficient, and the power difference between the input and output is dissipated as heat. As I stated earlier, heat is something I want to stay clear from, and when it’s generated by an inefficient component that is not acceptable. We will change this component, swapping in a more efficient, switching regulator. However, we need to be very careful about which switching regulator we choose – efficiency at the given input, output and load of the various switching chips can vary drastically, sometimes falling below that of a linear regulator! Do not use those LM2596/LM2598 devices you see everywhere, efficiency at the characteristics we use is a poor 77%.

lm2598_effI decided, in the first instance, to use an MP2307 based DC-DC unit. They can be had very cheaply at retailers like banggood.com, and as you can see by the datasheet, efficiency is very good at the values we require (over 90%). That cheap unit has L at 10uH, too!

mp2307_effOne thing to note about these cheap DC-DC converters is that they usually have a wide variable output range, and a terrible single turn pot as the adjustment pin. I spent at least 15 minutes attempting to get as close to 3.3v as possible. In the end, I settled for 3.34v. It would have been quicker soldering a 10-turn pot on here, but sadly I’m too constrained for space to have this luxury.

We will detach the stock 3v3 regulator from the circuit, and power the Pi using the GPIO 5v and 3v3 pins. Note: these pins bypass any protection circuitry on your Raspberry Pi. You’ve been warned!

Software Tips

We can also do some tuning in software. The tvservice, which operates the HDMI out of the raspberry pi, consumes power. Switching this off is simple, and can be done on startup.

Many people on the Raspberry Pi forums have indicated that underclocking the Broadcom SoC achieves nothing in terms of power saving. Despite this, as I’m going for a low-temperature solution, I’m still going to enable the OnDemand cpufreq governor, and set it to operate between 300-500MHz rather than flat out 700MHz. This basically makes the CPU clock down when idle, and ramp back up when under load. It’s a fairly common feature these days, and I must admit was surprised I had to enable it! Instructions for doing this can be found here and here. I installed cpufrequtils with apt-get and used that.

The GPU should handle itself and when idle (which, should be pretty much all the time) be very low power.

The measuring setup

To measure the power consumption, I’m going to measure voltage and current on the 5v line which powers the Pi and also any replacement switching regulators we connect.

Something which may catch folk out here is that first instincts may make you put your multimeter reading current onto the mA range. This has a large effect on the voltage into the Pi, due to Burden Voltage. Dave Jones of EEVblog has a good video on this, as well as Martin Lorton. All of my meters are budget ones (Vichy VC99) and the burden voltage of the mA range meant the Pi would not even boot. On the Amps range it booted fine, with a much smaller Burden Voltage, but still enough resolution to see a reasonable figure. A good compromise for this is to find a decent 0.1 Ohm precision resistor, which can be had fairly cheaply – then you simply measure the voltage across this resistor and read it off the meter like 20.5mV == 205mA. I like this method as it also shows you instantly the burden voltage in your circuit and you can adjust to reverse any ill effects of it. I just live with it in these tests as it is small enough not to cause issue. I confirmed my results using this method as well as simply using the multimeter current measurement.

The setup looks like the following diagram.current_measurement_setup

Power Measurements

The measurements I found were an average over a few test runs. The current measurement was taken using my Vichy VC99 meter that should be accurate enough, but I’ve not used precision measurement techniques or equipment so the figures should really be taken as a decent ballpark figure. Multimeter set to its maximum mode – so it captures and always displays the maximum reading it had during the test run. We need to know the maximum, because the Pi is very fragile with sudden voltage drops and it will fail to boot if the power it demands is unavailable. Current readings are always taken from the main 5v line into everything unless specified otherwise. The main source of the 5v rail to remain close to the final setup is an HTC TCB250 5V 1A charger.

The test is as follows: The PiOnTheWall is booted to X, PiTFT backlight on, USB wifi enabled and configured to connect to an access point 7 meters away and through several walls.

setup_stock_376Test 1: Stock setup

The Pi booted and successfully completed the test with a maximum reading of 376mA.

This seemed promising already. It’s far lower than expected considering I was expecting 200mA alone for the WiFi and PiTFT.

Test 2: TV service off

The Pi booted and successfully completed the test with a maximum reading of 356mA.

That was a decent saving for doing pretty much nothing. All you need to do is add ‘/opt/vc/bin/tvservice –off’ to your init. This figure seems consistent with that observed by Dave Akerman.

Test 3: Replace 3v3 regulator with an MP2307 switching unit.

I simply desoldered the two bottom legs of the regulator off the board, keeping the tab on. This is in case I ever need it again, so it’s an easy change to revert.

The Pi booted and successfully completed the test with a maximum reading of 325mA.

This is disappointing, however, not unexpected. The biggest power draws, the WiFi and PiTFT take up 200mA alone, leaving just 156mA for the Pi (from test 2). If we assume the efficiency of the linear regulator is 70%, the maximum we could really get down to is in the 110mA area. But the MP2307 unit itself isn’t 100% efficient either, so if we consider it to be around 90% efficient (which is conservative, but still a great figure) we get a theoretical 121mA, which is very close when the 200mA is added back on to our 325mA figure.

Test 4: Power the whole setup – Pi, PiTFT, Wifi from a single 3v3 source, tying the 5v rail to 3v3.

This is supposedly doable – I’d read about it in the forums, and also via Dave Akermans blog mentioned above. If we look at the Schematic, we can see the +5v rail goes into the 3v3 regulator, which then becomes the main power rail, but +5v also goes to some pins on the Broadcom SoC, and the USB Power. The WiFi chipset datasheet indicated it ran from 3v3, however, I don’t know how that is delivered, so whether the USB +V pin being 3v3 would translate to an operating chipset is unknown. The Pins on the Broadcom SoC where 5v is present seems to mostly be sense pins for battery powered devices, and so hoped these were not actually used correctly, and that any significant voltage on them such as 3v3 would allow for boot.

pischematic_battery5vNote that for these tests, the mA current readings are on the 5v input before any 3v3 converters.

The first attempt at the test was conclusive.

The Pi failed to boot fully.

The initial linux boot sequence looked promising at 3v3. The backlight of the PiTFT module was, of course, less bright – but still very useable even under my bright bench light. After several attempts at booting the culprit was clear – the WiFi stick initialization. As soon as the WiFi was initialized and it’s activity light came on, the PiTFT screen failed and went white. The Pi Itself continued to boot as I was able to SSH in after a short delay, so the WiFi worked, it’s simply something else was happening.

Inrush Current

When this happened, my first instinct was Inrush Current causing issues. Inrush current is the high draw which occurs when something first switches on, caps charging, etc. It’s well known that the Raspberry Pi does not cope well with this, and there are many mods that exist to make the Pi cope well with hot-plugging of USB devices. There is an article here which discusses inrush current and controlling motors, and indicated further filter capacitors on the input power would solve this issue. Remembering from Part 2, we removed the 220uF input capacitor, so there is certainly a lack of capacitance on the power inputs. In line with the article I link to, I fitted a 0.1uF ceramic, and some 1000uF Electrolytic capacitors I found in my junk bin to the power input. After I did this, it booted to X.

junkcapsThe Pi booted and successfully completed the test with a maximum reading of 254mA.

This seemed a huge jump, then I realized why: the LED backlight of the PiTFT. They were rated at 80mA, but on measuring them individually at 3.3v they were drawing only 22mA @ 3.3v! The brightness drop isn’t really a problem for me, so this is a welcome decrease in consumption. I’m not an expert at this, so it’s probably going to have a damaging effect on the LEDs life, but I’ll take that risk.

A problem remained, however – the PiOnTheWall was unstable. When I opened the web browser and pointed it to BBC news the PiTFT died like before. Damn. Additionally, there was a considerable flickering of the backlight of the screen. I initially thought it was synced to the activity light of the WiFi, but it wasn’t. Then I thought about it being activity on the SD card. I discovered this document on SD card stability which suggested a 22uF tantalum capacitor between pins 3 and 4 of the SD card. The Pi schematic didn’t show capacitance of this level in the SD card interface, so I added it. Thankfully I had a single 22uF tant left, albeit a slightly larger voltage one than I wanted. It still fits in the assembly, so soldered it direct to the SD card socket.

sd_tantBut sadly, the flickering remained!

Then I remembered there was a regulator on the PiTFT itself, as it was powered from the 5v GPIO. The TFT panel requires 3v3. I looked up the datasheet for the regulator and saw it would output around 2.8v for 3.3v in. This is actually still within the minimum spec of the raw TFT panel used in the PiTFT, but to make sure, I removed the regulator and bypassed the in/out pads on the board. The flicker remained. Ugh.

pitft_reg(Top tip: Keep the off cuts of through hole components for making jumpers like above!)

At this point I ordered some high quality ESR caps to use, but it still didn’t stop the backlight flicker. The quality caps did however make the device stable – I was able to load BBC news in the browser on the device fine. The backlight flicker pretty much ruled this solution out though.

Test 5: Power Pi & PiTFT from 3v3, Wifi from 5v

The Pi booted successfully and completed the test with a maximum reading of 269mA.newcapsThe flickering with this setup was drastically reduced – barely noticeable. The amount of capacitance on the input power could be reduced and it was still stable, loading web page in the browser well – the PiTFT screen remained on and active throughout. I think we have a winner!

caps_3v3The final input schematic contains several capacitors and they are rated for 6v. Interestingly I don’t need any on the 5v line that the WiFi is connected to, but this may change with other 5v power sources. I always needed to keep the 5v line, as my motion sensor runs off a very odd 4v4 – I couldn’t easily find any 3v3 PIR units that are small enough for my enclosure. Note, that the additional capacitors will fit in the enclosure fine, in the existing area where the old useless power supply was along with AC-DC converter.

Conclusions

I hit my power target. I’d expected around 250mA typical, in reality, I’m getting lower than that. I get around 270 peak, but during normal use, with the backlight on, and downloading a file over the WiFi it draws around 220mA. Idle, with the backlight off, with WiFi connected (but no traffic) we are at 140mA.

I don’t expect this device to be doing much; but when it is the backlight will no doubt be off. The backlight is controlled by a small motion sensor which automatically turns it off with no motion. With the WiFi active, it consumes around 200mA at 5v. A single watt of power, at a reasonable load. In fact, throughout these tests, the HTC adaptor was really only providing around 4.8V, so it’s even less than this!

Okay, when looking at the numbers this saving may seem a bit silly given the effort that went in to achieve it. But I’m confident this will achieve a cooler overall setup in terms of temperature and efficiency. As it’s inset into the wall, I don’t want a ‘phone charger’ type setup getting warm. I intend to power this device with a mains AC to 5V converter, and then a 5v to 3v3 switching DC-DC converter. As I said earlier, there are a variety of DC-DC converters for this purpose, and I ordered a variety in with different efficiencies to test. I may write another post looking at the efficiency of these units as they really do vary! For now I just used the MP2307 as it was easiest to procure and its datasheet suggested >90% efficiency.

To finish off, lets calculate how much it will cost to power this at a generous typical of 0.8W. If I assume a mains to DC voltage efficiency of 65% (i.e, the mains adapter used to produce the 5V and 3v3, which nobody ever takes into consideration in figures), we’re around 1.23W. For a year, that’s 1.23 * 24 * 365 = 10.78KWh.

Given 2013’s average KWh unit of electricity cost in the UK of 13.52p, it will cost £1.46 to power the Pi On The Wall. For a whole year. Around $2.45 USD.

tldr_costThanks for reading, I hope it was interesting. As always, you can reach me on twitter @domipheus and the flickr album is full (230+ high res images) of build progress shots. If you liked the article, please consider sharing it on social media of your choice!

To be continued… Part 4 will be putting it all together, temperature, and preparing the case! A teaser of what’s to come is below

- Espresso Image courtesy of Suat Eman / FreeDigitalPhotos.net -

Pi On The Wall – wall mounted home server – Part 2: Diet Pi

This is Part 2 of a series of blogs regarding the development of a wall-mounted server based on the Raspberry Pi, featuring WiFi and a colour touchscreen. Part 1 can be found here.

case_dims

The enclosure I’m using, a re-purposed room thermostat casing, places some very tight constraints on the dimensions of the Raspberry Pi and PiTFT board.The plastic used in the case is quite sturdy, and is at least 2mm in thickness. Therefore the real inner depth of the case is about 12mm. As for the width of the Pi, we need to shave at least 4mm from the side. The Pi itself is 86mm wide, same with the PiTFT board, so we will need to find a way of making it closer to 82mm.
pitftThe board interconnect that comes with the PiTFT is a tall terminal connector. It is immediately ruled out for use, as it increases the depth of the assembly to well over an inch. Without using that, and bending the pins to grip the I/O on the PiTFT, the depth from SD card housing to top of the TFT is just over 20mm. Still far too much.
pi_identThe main space-wasters on the Pi are easy to identify. The composite out, audio out, USB, HDMI, and the camera and display interfaces all can be removed. The tallest of these, the Composite out, measures over 11mm alone. The only one we need to use is USB, and we can add terminals to enable an off-board connector for that. All the others need to go.

pi_componentsThe composite, audio and USB jacks were relatively easy to remove. Solder sucker & solder wick with some wiggling did the trick. The HDMI socket was another matter entirely. There were some components near the socket I didn’t want to destroy, and one of the soldered through-hole supports wouldn’t budge. Butchery was resorted to, using cutters to chip away at the metal surround and later the plastic. The connector itself is surface mount, and came off fairly easily after that. Once destroyed, the through hole-support gave in and came out with more wiggling. I apologise to all who were involved in designing the Pi for the following image.
pi_nohdmiSome PCB pads came off at the HDMI socket, but I was not concerned, as this was destructive change anyway. The camera and display interface connectors I simply cut away with pliers, again, a few pads came off.
powerschematicC6 is the large silver capacitor near the micro usb socket. This is the last item in the way on the top of the board, and as you can see from the Raspberry Pi schematic, is just a smoothing capactor for the power. It can be safely removed and if needed, put off-board in seperate power circuitry. I’ve identified D17, a protection diode on the opposite side of the PCB, as we will come back to this later. The board ends up incredibly bare and on the top side it’s only a few millimeters tall.
pi_bareAfter this I put a 90 degree set of terminal pins in the USB location so we can put the socket off-board. If we knew everything was going to work at this point the easiest thing to do would be to solder the PiTFT board directly to the GPIO pins of the PI. However, I wanted to remove the Pi from the TFT board to adjust things in future, so had to come up with a solution without using standard terminal connectors, which are too tall. I decided to try taking a DIP socket and using that, as they are only 3mm tall. The first two pins are not required, so sawing a 24-pin socket in half, inverting it for a flush fit and filing down worked exceptionally well.

interconnect_bodgeWith this the board is just over 14mm from top of the touchscreen to the bottom of the SD card holder.

interconnect_heightThe next thing I attempted was to cut around 5mm from the Pi and PiTFT PCBs closest to where the USB port used to be. Around there, especially on the model A, it’s sparce.

Boardlayout_cutraspberry_pi_pitftdiagramThe PiTFT is round the opposite way as the Pi, as you can see, it’s simply the adafruit logo mask and there are no important traces to avoid. I just dived right in, marked a line with a stanley knife and got out the hacksaw. After some effort and sanding with a rotary tool it came out pretty well.

pi_cutThe PCBs now fit well into the case in terms of width and length, but depth is still a problem. We need to hit 12mm at minimum. The only thing to now do is relocate the SD card socket from the bottom of the board to the space on top where the Display Interface used to be, on top of the logo to the left of the SoC.

pi_sd_depth_ Desoldering the SD card holder was a bit more nasty than I’d imagined. I only have an iron, solder sucker and some wick. Ideally I’d have the correct tools, but for this I resorted to the ‘pull enamelled wire through the joint as it is molten’ trick, which worked in this case. If you use this method watch out as the pins themselves can come out from the plastic housing very easily.

wire_sm_desolderAfter it was removed, I used 0.2mm enamelled copper wire soldered to the existing pads, through the hole in the board to the front side and soldered direct to the holder. It wasn’t very well done, I tried to keep the lengths of wire of a similar length but it shouldn’t matter too much. The main thing is making sure you have a good clean solder joint and you remove the enamel at the right places. Scraping with side cutters and tinning with too much solder (so much that you waste some) usually does the trick.

pi_sdAn interesting thing to note is that the card detect and write protect switches do not seem to have an effect at runtime. The schematic shows the write protect pins are unconnected, so that’s expected. The card detect pins are connected to the SoC. My plan was just to short the pads on the underside to save soldering 2 wires that don’t really matter. There are two very small SMD components where the SD card holder now sits (C1 & C5), I made tiny holes in the underside plastic of the holder so it can be mounted flush on the PCB without those components being damaged.

Additionally, I removed D17. This protection diode will be mounted off-board when the power system is looked at along with (potentially) C6 that we removed earlier. Note D17 and C6 technically are not needed to run the board, they are for protection, so I can still test via the microUSB socket as in the picture below.

slim_piAt the moment i’m measuring just over 10mm to the end of the terminal pins on the underside of the RPi board. Of course there are some surface mount components also on the back, but they don’t change depth much. The D17 diode was the biggest one, and we moved it off-board. I’m going to grind the back of the GPIO pins off a bit just to save some more space, but I think there is no need to go further than 10mm. There is still space between the Pi and PiTFT boards for the USB terminal connector to carry a socket off-board, and also something I’m looking at is heat dissipation from the SoC and whether I need to increase the surface area for some better passive cooling.

The final dimensions of the unit assembled is 80mm x 56mm x 10.5mm.

As for the Pi On The Wall project, the next steps are to sort the casing out with the tactile switches matching the switches on the PiTFT, and also affixing the USB socket in the case so a mini USB WiFi stick is flush with the exterior. After that, I’ll be running some power consumption tests and heat dissipation tests. I want this to be extremely low power, and will experiment with replacing the regulators, turning off services, possibly even running the whole board off 3.3v instead of 5v, which is said to be possible.

If you have got to this point in the post, I hope you found it interesting. If you have any questions, please either comment here or message me directly on twitter @domipheus.

Update: Thanks for all the feedback! Here is a taste of things to come in the case fitting:

pi_casefitpitweet(used a hub in the usb socket to type for this shot, obviously the idea is once done I’ll make some specialized frontend so that’s not needed, and all config done over ssh)

All pictures of the build and more can be seen here on Flickr.

Pi On The Wall – wall mounted home server – Part 1: Introduction

I’ve been working away at an idea I had that seemed too good to sit on, so jumped at it. It’s easier to explain the purpose in an image:

PiOnTheWall I’ve been meaning to set up my Raspberry Pi to monitor the Heatmiser WiFi thermostat I use, as well as being a small home server. I have a standard wall mount plate free in the hall of our house, the sort of thing the above would mount into and be wired direct to mains for 24/7 operation. I thought it would be cool to take a cheap thermostat, gut it, and replace it’s internals with Pi goodness – throwing in a colour touchscreen for good measure.

The Pi On The Wall was born.

41zJZupMBKLI discovered a cheap thermostat on Amazon which had mains power to 5v built in. The power unit may need to be replaced which is something I’ll write about later, but as you can see there is not much space in here for a Raspberry Pi and associated TFT screen, WiFi stick, SD card, etc.

thecasecase_dims There will be quite a bit of customization going on. The Pi board itself doesnt fit in here for length, let alone it plus the standard PiTFT mount for depth.

erm_deepThat’s not going to look good on the wall.

I’m quite progressed with this project as I type this, and will post a few updates shortly. Spoilers: In total, the current depth of the Pi + TFT is currently 14mm. This is after some serious hacking at the board itself. It’s not pretty, but it’s working. There are some fun hacks in here to share!

 [Part 2 can be found here - showing how the Pi + TFT slims down to only 10mm!]

To be continued… if you are too impatient for the next part, i’ll be updating the following flickr album with various shots, and posting on my @domipheus twitter.

Cheap 1.8″ SPI 128×160 TFT Module – Arduino wiring!

Still working on my bench power supply, and wanted to move from my 16×2 retro LCD to something a bit more funky, and found these which use the Samsung S6D02A1 chip.

1.8 Inch Serial SPI TFT LCD Display Module With Power IC SD Socket

At the time of writing, you can get these from a UK warehouse for £3.30 shipped for a single unit. That’s awesome. However, the comments were quite bad and many people had issues with them – no matter how it was wired an Arduino wouldn’t drive it.

After lots of trial and error and searching all over, I discovered the secret hack: put 1K resistors between all I/O pins, and Vcc is +5v. Basically, I/O is 3.3v – the SD card on the back has resistors by the looks of it, but not the TFT. It’s cheap.

1_8_TFTAfter that, it’s working very well with an arduino nano using the library from ‘zigwart’ which is available on github. A prerequisite of this library is having the Adafruit GFX library installed.

An example clock and a test demo is included. For just over £3 I’m very happy, and it will nicely fit within my bench power supply design.

tft_close

Project BoilerLog: SD Datalogger with RTC

I needed to monitor my boilers activity as I thought something may not be quite right about its activity – gas usage is fairly high and our thermostat is fairly low – only 18 degrees C.

Our thermostat is programmed to become active twice a day, in the morning, and then in the late afternoon to evening. During this time the thermostat switches a wire to live (230v) to signal heat requested to the boiler, which is an older and not very efficient model.

I decided to build a quick and dirty datalogger based on an Arduino Nano and an SD card interface. There are various examples on the official Arduino portal about creating an SD card datalogger in this configuration. I realised however for my data to mean anything I’d need to have reliable timekeeping, which means I need to integrate a Real Time Clock (RTC) into the design.

schematic

I bought an SD card interface off ebay for £2 shipped which operates over SPI. I also bought an RTC for £4 shipped. It uses the popular DS1307 chip and is marketed as “Tiny RTC”. It operates over I2C and has a rechargable LIR2032 battery with charge circuit. There have been issues with this board, mainly due to people fitting the board with CR2032 batteries which is not a good thing to do. Ensure you use a LIR2032!

Using already existing SD and RTC libraries, the code was easy to get running quickly. I simply analogRead 4 inputs and log the raw values. An interesting point is that, every second, I open a file on the SD card, append to it, and close it. This is not efficient and probably not good for the SD card either, but for me I wanted to be able to power off and grab the data off the SD card quickly and reliably so opening/closing and not buffering is the best bet in my view. My schematics and firmware are available on github.

As for sensors, I had 3 10K thermistors and a 10K LDR. The LDR is placed over the burner on LED of the boiler, one thermistor for ambient, and the other two reading the flow and return pipes to the radiators via some good quality thermal paste for heat conductivity.

Assembled device made up of RTC, Arduino, SD Card interface and sensor interface.The device fully assembled with help of a small breadboard for the Arduino. Power is via the USB cable, which is connected to a high-quality USB power adapter.

The little board to the far right is simply a sensor breakout board with 4 10K resistors and +5V, GND, sense and then the sensor connectors. 3 of the sensor connectors are disconnected in the image. The sense values of the thermistors were quite disappointing resolution wise when I reviewed the logs, but they did the job.

The datalogger ran for several days unattended and I was happy to find a log file for each day saved to the SD card for me to analyze. I created a small c# application that gave me instant stats on the days boiler running, and also output a smaller selection of datapoints as to plot an easy to view chart of activity.

An average day resulted in the following:

dataAnd the output from my small c# program:

Burn: 06:41:38->07:28:41, Duration: 00:47:03
Burn: 07:32:54->07:38:52, Duration: 00:05:58
Burn: 07:43:15->07:48:27, Duration: 00:05:12
Burn: 07:52:47->07:57:23, Duration: 00:04:36
Burn: 08:01:27->08:05:17, Duration: 00:03:50
Burn: 08:09:15->08:12:31, Duration: 00:03:16
Burn: 08:16:03->08:18:57, Duration: 00:02:54
Burn: 08:22:30->08:25:15, Duration: 00:02:45
Burn: 08:28:53->08:31:31, Duration: 00:02:38
Burn: 08:35:11->08:37:43, Duration: 00:02:32
Burn: 08:41:23->08:43:52, Duration: 00:02:29
Burn: 15:31:23->15:53:45, Duration: 00:22:22
Burn: 15:58:05->16:03:44, Duration: 00:05:39
Burn: 16:08:15->16:13:22, Duration: 00:05:07
Burn: 16:17:55->16:22:32, Duration: 00:04:37
Burn: 16:27:01->16:31:23, Duration: 00:04:22
Burn: 16:35:41->16:39:25, Duration: 00:03:44
Burn: 16:43:34->16:46:46, Duration: 00:03:12
Burn: 16:50:51->16:53:47, Duration: 00:02:56
Burn: 18:11:29->18:15:25, Duration: 00:03:56
Burn: 18:20:41->18:22:55, Duration: 00:02:14
Burn: 18:31:10->18:33:12, Duration: 00:02:02
Burn: 18:48:38->18:50:36, Duration: 00:01:58
Burn: 19:51:10->20:09:02, Duration: 00:17:52
Burn: 20:13:25->20:18:05, Duration: 00:04:40
Burn: 20:22:37->20:23:30, Duration: 00:00:53
Time boiler burning: 02:48:47
Num of boiler fireups:26
Shortest time on: 00:00:53 at 20:22:37

So instantly I see a problem, which is oscillation of the boiler firing up for a short period and then turning off, only to turn on a short time later. It turns out our ‘fancy’ hall thermostat, despite looking the business is fairly poor in terms of features. It’s switching differential is so small it’s acting like it simply adheres to the following:

if TEMP > SET_TEMP then boiler_off() else boiler_on()

There does seem to be around 0.5C of differential but it’s not enough. If I could adjust this on the thermostat it would make things much better.

So I’m looking at a new thermostat and think Ive got a winner for that, which I may post up about next month.

While I was at it, I wanted to test the idea that keeping your boiler switched on 24/7 actually is more economic. So I tried it. This is on a day fairly similar in terms of outside temperature as the last graph.

boiler data for 24/7 runThe output from the analyzer:

Burn: 01:56:53->02:15:20, Duration: 00:18:27
Burn: 02:19:44->02:20:57, Duration: 00:01:13
Burn: 04:28:06->04:46:18, Duration: 00:18:12
Burn: 06:41:03->07:19:44, Duration: 00:38:41
Burn: 09:20:03->09:38:32, Duration: 00:18:29
Burn: 12:19:15->12:39:08, Duration: 00:19:53
Burn: 14:32:28->14:50:43, Duration: 00:18:15
Burn: 16:28:57->16:48:10, Duration: 00:19:13
Burn: 16:52:34->16:55:47, Duration: 00:03:13
Burn: 18:10:55->18:14:17, Duration: 00:03:22
Burn: 18:23:24->18:25:27, Duration: 00:02:03
Burn: 18:28:16->18:46:09, Duration: 00:17:53
Burn: 18:50:26->18:55:25, Duration: 00:04:59
Burn: 18:59:56->19:04:08, Duration: 00:04:12
Burn: 21:58:52->22:18:50, Duration: 00:19:58
Burn: 22:23:19->22:23:26, Duration: 00:00:07
Time boiler burning: 03:28:10
Num of boiler fireups:16

I think it’s quite clear cut that for my boiler it is not more economic, the boiler running for an additional 40 minutes during the whole day. Interesting though there are much less oscillation events, and therefore less boiler fireups.

Hope this post is of use to someone. The full schematic and firmware for the datalogger is available over at github. Let me know if you use any of it!

Update: Something is going funky between 10 and 11am each day, which you can see on the graphs as a spike in flow temp and a drastic drop in return. I don’t have a clue what it is. The boiler isn’t on, could be something to do with my unvented hot water cylinder.

Electronics

Before I wrote my first program, I built pysical things. Lego helecopters with improvised rotors driven by the motor of a broken RC car and a 9v battery. I collected circuit boards, opened anything I could (with no concern for my own safety) and ‘repaired’ things that had obvious  issues with it, like dodgy contacts/wiring/soldering. I think I was about 9 or 10 years old at this point. I also had various electronics kits, the ones that had little spring contacts for wiring things up, and came with big thick 200-page manuals full of schematics.

Then we got a computer at home, and it all, kinda, stopped.

I’ve always wanted to get back into electronics. I know and remember the ‘trivial basics’ but never got into it seriously, computers and software took my attention away.

But, then I found Dave Jones and the EEVblog, and it’s all come back to me. I’m building an electronics lab at home, and already have my first project in progress: a bench power supply, which i’m told is one of several ‘musts’ for building when starting your own lab – which is good!

I’ll be posting updates on the lab and also the power supply as the come!

A change

So…  all previous posts have really been about me making some games in my spare time. There have been no real updates in a very long time, and thats because basically: the game failed massively.

I’d have hoped there would be enough sales to pay for the web hosting for leaderboards, replays, and the SSL certificate. Over a year I couldn’t even pay for the SSL certificate! So yeah, it really didn’t work. So instead, i’m simply going to use this to post things that interest me, current projects, etc. It’s quite a change, as I’m not going to start with software, which is what I’ve been doing for a very long time.

Also, I’m not paying much attention to the quality of posts, more making sure the content is interesting. Hopefully, that is.

Gears of Glory: Apex Ace – Singleplayer Game Modes

There has been much discussion over the past view days about the game modes planned for Gears of Glory: Apex Ace, especially given the ‘never seen before‘ time-shifted multiplayer of a racing game featured during this weeks Apple iPhone 5 keynote.

I’m not going to go into detail of what I think about the feature, or what past games had interactive ghosts/replays and how the affected gameplay. This post is about what Gears of Glory: Apex Ace offers.

The open beta releasing super-soon comes with several race modes:

Season Tier time-trial
In this mode, players race all of the season circuits. As they race, setting best laps and finding better lines to rise in the leaderboards, opponents appear alongside the players own best lap replay.

This is the first part of the Dynamic Opponent System at work – the opponent you face is usually the person directly above you in the leaderboards. As you progress, new opponents appear – and this happens on the fly.

So regardless of where you are, the singleplayer element revolves around racing other player laps, which have been raced at any time, and means you are always competing.

Player Race
This mode is very simple – when you view the Season Tier leaderboards, you can browse the ranking, and race any lap on the boards. Any. If your friend is above you in the standings and you just can’t find the time to beat them via the season time-trial, race directly against them and check out where they find time on the lap. If your friend is below you, view his lap and offer advice of where he can improve.

Player Challenge
This mode is very difficult, and successful players receive many trophies (the XP/score unit in the game). It is exactly as the Player race, apart from the fact the replay you are racing against is not a ghost but an interactive, collidable, entity.

To beat their lap, you need to find and maintain space to overtake. You can jostle, however, the game does not let you influence the lap time of the other player. If you try to ram, or jostle to an unacceptable level, you will crash and be left with a bad lap. Because of the trophy reward associated with this, only players around or above your current ranking can be raced. You cannot play the system by challenging the player last on the boards.

The three modes above is what’s shipping in the open beta. The next game mode is something I am quite excited about, and extends the dynamic opponents system.

Championship mode
In this mode, it is set out similar to racing games players already understand – circuits raced in a calendar style, progressing to different classes of car and larger, more challenging circuits. However, Gears of Glory: Apex Ace does not have different classes of car – only different classes of racers.

As you race, your position in the rankings is again measured. A grid of opponents is created, dynamically, from other players on the leaderboards around your position. Depending on the difficulty you play at, these players may be far ahead of you in the standings, or directly around you. You race a series of laps, but not in a time trial fashion – this is your standard, lap-bound, first to the finish race. You must maintain competitive, consistent lap times to progress. As you progress, the field around you changes to reflect your standings, making you compete against a different class of racer.

There is no AI at all in this mode. There is no AI in the game at all. If you see another racecar in Gears of Glory: Apex Ace, it is another player. That player does not need to be online for you to race their laps. Their best laps are all stored and retrieved from the OnlineServices.

I’ll keep everyone up to date on the progress for this mode, I obviously think it’s great ;)

Now, I need help from you. If you can find another racer that has a feature similar to this championship mode description, please tell me, I want to know! I’ve not seen any, but there are so many games out there.

So there we have it. The race modes of Gears of Glory: Apex Ace. If you have any questions, feel free to comment, either here or on facebook. You can contact me directly instead if you’d like, at @domipheus.

Gears of Glory: Apex Ace Pricing

It’s time to discuss pricing for Gears of Glory: Apex Ace.

Originally, I wanted to price the game around the cost of an espresso; about £1.50. The game is small, but there is a certain replayability aspect if you enjoy racing, so I think £1.50 is perfectly reasonable, albeit cheap for a PC release.

I’ve had to increase this to £2.40, for various reasons.

Reason 1) VAT. Before I state the following, please remember I Am Not An Accountant.

UPDATE

Well, I did say I was not an accountant. The next point on VAT is completely false. For digital goods, you only need to register + charge VAT in your own state if you go above the national threshold, which I don’t think I’ll be doing. So, VAT is now no longer an issue. I’ll post a new update in time! – Colin

Domipheus Labs is based in the UK. I am not registered in the UK for VAT. I do not expect income from games/services Domipheus Labs provide to go above the VAT registration threshold, so technically I do not need to charge VAT in sales to the UK – currently 20%. However, the EU Vat rules for digital goods are complicated. Basically, VAT is charged at the customer rate rather than the supplier rate. This means I would need to have in place the ability to charge and send VAT to the EU depending on location of the person buying the game. This is just far too much work for a 1-man band, so I am using a payment processor that handles this for me. But this then means I need to charge UK VAT, as it’s the payment processor who is actually selling the product, not me. Technically I can sell minus VAT only to UK buyers, via something like PayPal. I may do this in the future, but for now, it’s just too much work. I want the price quoted to be the price customers pay, so the VAT is absorbed into the higher sale price.

Reason 2) There are no good micro-transaction payment portals.

By good, I mean will handle everything I need – the above collecting of VAT for the EU, notifying my servers of a sale for licence key allocation, and, most importantly, doing this at a reasonably percentage cost of the transaction total. As it turns out, £1.50 is most definitely micro-micro transaction level – and there is just nothing good out there that will charge anything less than a third for the service.

The above two issues are expensive. Not expensive in terms of monetary value, it’s less than a pound we are talking, but as a percentage of our ‘micro transaction’ payment it’s massive. The payment processor I am using is FastSpring, and this cost will be around 50p per transaction. Now, FastSprings service has been amazing, so for 50p, to me, it seems worth it from my end. But it’s still more than I had envisaged. That brings the cost up somewhat, and then we have 20% VAT on top, bringing it much closer to the £2.40 mark.

If you think I am somehow greedy in this, consider that from that £2.40, after various taxes, monetary transfer fees and other things, I’ll be getting less than 50p per sale. From that, I need to pay expenses, rent the servers, and pay for bandwidth. When I say I’m not doing this to make a heap of money, well, this confirms it.

What I’m doing to offset the fees, for buyers.

I am a massive fan of the ’4 pack’ buys you get from Steam, etc. I have teamed up with friends and bought for example Left 4 Dead and distributed the keys. I have decided to make pricing tiers available for Gears of Glory: Apex Ace, but I’ve been more lenient, and extended it to a volume licencing model.

Quantity: 1, each licence costs

  • USD 3.50
  • EUR 3.05
  • GBP 2.40

Quantity: 2+ , each licence costs

  • USD 3.20
  • EUR 2.85
  • GBP 2.10

Quantity: 4+ , each licence costs

  • USD 2.85
  • EUR 2.45
  • GBP 1.80

This represents a 25% saving on buying 4 or more keys at the same time, instead of four single ones. But, even buying only two will entitle you to over 10% of a discount. I am still looking over the figures, and may be able to increase the saving even more, so will update if this is the case.

Now, this doesn’t solve my VAT problem, which is why the price is still a bit higher than I wanted, but it certainly offsets the payment processor fees, and I hope it will make people buy keys in groups, or maybe even gift a second key to a friend.

I hope this explains some things.

Lastly, you will be able to purchase keys very soon – and the Single Player beta, with 24 circuits, leaderboards and achievements, is being released mid-September!

The beta will initially roll out ‘Direct from the Developer’, and be available on game distribution platforms like IndieCity and Desura in due course.

A demo is also being made available, which allows 1 day access to the first two tiers of circuits.

It’s certainly been difficult trying to sort these matters out, but hopefully the volume discounts will entice gifting of Gears of Glory: Apex Ace to more friends – that’s the idea, anyway.

Cheers,

Colin / @Domipheus

 

Lessons from exhibiting at an Indie Festival

I recently had Gears of Glory: Apex Ace playable on the floor of the Dare Indie Fest, which is the UKs largest indie games showcase. It was a great experience for me as the developer, both personally and from a development of the game standpoint. I made mistakes, but also did many things right, and it didn’t cost me an arm and a leg.

Right – Lighting Considerations
This is something many on the day did not prepare for. I have a poster and a large game logo board I wanted on the back ‘poster panel’ (viewable from the pics), but wanted to make sure visitors to the booth could actually see and read it, from a fair distance. I knew the event had run several times before, and last year in the same venue, so looked for photographs from the event to judge how lighting is handled. Just as well I did, as they used a lighting rig with various moving coloured lights, which when in the direction of your booth is fine, but otherwise, quite dim and nightclub worthy. Therefore I made sure to take additional lighting so brighten up key areas.

Right – Control instructions available outside of the game.
Even though I was demoing a racer, which used the standard left thumbstick and trigger buttons, visitors still kept asking as they got the controller passed to them to play. I had a queue forming, and being able to pass the controls around in a showcard form helped immensely with player throughput, especially during busy periods.

Right – Trailer / Playthrough video.
I had the game trailer on a loop in two screens either end of the booth, this was great, but late on I decided to record a play-through of the level on show – and this proved very useful. Players asking what is your best score is and then you being able to show you them how it can be played is great, and can show the depth of the gameplay. There was over 5 seconds in lap time between my best lap played at the show and the best lap of the whole festival – showing how this can be achieved is a real selling point on replayability.

Right – Swag
I designed sticker badges – it’s a time-trial racing game, so it had ‘beat my lap’ on them – and they were hot property. I made sure to give everyone a sticker who played, but also had them just laying around messily on the booth table. There is something about stickers, people love them, and I believe them to be the best return on swag investment for an indie. More on this in the budget section below.

Right – A ‘business/corporate’ oriented display
I’ve had to roll out my own OnlineServices framework for Gears Of Glory: Apex Ace. There was just nothing out there suitable, and I have been asking around other indies seeing if they would be interested in using my framework. I had a small strut card with the features of my service that differentiate it from the others available, at one side of the booth. People visiting the show from a business perspective saw it, and approached me. Don’t think because it is a consumer show that there are not business opportunities to be had!

Right – Treat the event as a playtest.
Watch everyone play as much as you can. Take notes – I had a small notebook and nearly filled it with points/issues. Usually, the points are UI/UX based – and if you are the developer, this is exactly the area of the game that usually escapes you, since you’ve been working on it so long. The feedback from this point is extremely valuable.

Right – Test your audience with price
When people asked me on price, I told people slightly different values. Nothing super different – I have a price range I know I’ll target, but this was to judge peoples reactions – and I got valuable information from it.

Right – Take Everything you can
I mean everything. I filled the largest suitcase I have with ‘stuff’. I calculated the amount of batteries I should need max, and doubled it. I had 3 different types of tape (Masking tape, standard sellotape and duct tape). I had two types of scissors. I had a whole extra pack of blu tack, Velcro sticky fixers, and glue at disposal. I brought extra white and black card too. I ended up covering the second ‘trailer’ laptop with this black card at the last minute and masking taping over the usb ports, so I did use them for things I had not prepared for the days prior.

Wrong – Not enough social media during the event
I should have been live tweeting best scores, pictures, maybe even videos. The event organiser main twitter was retweeting other studios with the hashtag, so I could have got more exposure.

Wrong – Not enough social media advertising at the event.
This one is annoying – Nowhere was the twitter account names, or the facebook page names. I had completely forgot. Many people were asking about how to keep in touch with the game, and to some of them I said twitter, but for everyone that asked me, there could have been another two that would rather have simply followed the account silently – and I lost that interest. ‘Keep up to date with X by following Y and Liking Z’ banners would have been ideal.

Wrong – Trusting my old hardware
This was done on a tight budget, and I used an old Centrino Dell laptop, which is over 8 years old. I had run it for hours in the days leading up to the event and it ran fine, but on the morning of the last day of the event the cooling fan gave up. I ended up running the laptop passive, showing the windows xp screensaver with screenshots, and looping game music. It died trying to play video after about 20 seconds, but coped with screenshots and mp3 playback – even if it did warp the plastic table it was on! The laptop could possibly have played video if I had a few of those USB fans that you can manipulate into positions – so if you have one of those, take it, just in case.

Did Wrong – Make sure you have a control system override
In the main build of the game you can play with a gamepad, but keyboard control still works. For some reason that is unknown to me now, I removed this in the days up to finishing my expo build – and this was a huge mistake. With kids – especially those with wii’s at home – they can get confused with the controls easily, even a simple racer. Being able to control with the keyboard whilst they ‘think’ they play is great for this – because it’s always better than having to take the controller off them to remedy going the wrong way, etc.

Wrong – I did not have a do not touch sign on the old trailer laptop
This was a scary incident. Even though I’d covered the laptop keyboard with card, a child still mistook the trailer playing on it for a free game spot. The kid jumped and reached across the table, pulling the laptop towards them, forcing all cables to detach from the back, and if it were not for the security cable connected to it it would have fallen off the table. Some kids get very excited, so you need to prepare for these things.

Wrong – Play length
If there is a distinct goal to your game (like in Gears of Glory – X number of laps) make sure it doesn’t take longer than 2 minutes to complete. On the first day I had 5 lap demos of a circuit I could do in 40 seconds, but a lap was averaging over a minute to the public at the time – I changed this to 3 laps after the first day, which helped immensely.

Budgets

As I stated earlier, I tried to do this on a budget. There are obvious hotel and travel costs which you just need to find a good deal with, but for kitting out the booth, here is my advice.

Print your own posters
Maybe I was just looking in the wrong place, but I found it quite hard to pay for posters. I had an A2 size logo (more on that later) and an A1 game info poster. Due to the fact I only wanted one of each, the overheads were pretty steep, and would have cost over £30 ($47) to print them onto good glossy paper. Instead, I went to the local pound discount shop and bought photo paper sheets and printed the posters at home. Amazingly, the windows 7 paint program (yes, the OS one) has support for multi-page poster printing, so just make sure the printer dpi is set super high, and the resolution of your source image is good enough. Use a Stanley knife and metal ruler to cut the white margins off. I jigsaw’d it together on the day and nobody cared about it not being 1 sheet of paper. ‘Good enough’ really is correct here. People could see it and read what was on it. Job done. Just make sure your printer ink consumption isn’t stupidly high – because then the line between the two options blur.

Booth Swag
Stickers Stickers Stickers. Seriously. Design a sticker, with a game character, logo or whatever, the website, and a tagline – for Gears of Glory: Apex Ace I had ‘Beat My Lap Time’ on it. Stickers really are the best return on investment swag. I went with Printed.com and got 500 2″ stickers for £20 pre tax/postage, and they have great templates so you don’t mess up by giving them bad art, and also – importantly – the adhesive on the stickers is good, and can be used on clothing etc. Get more than you expect to hand out, as you will want to mail them out to folk too. Ive done it a few times, each time folk have tweeted a pic of the stickers so it’s good marketing too.

Create your own showcards
Where I needed fairly simple conveying of information, for example in the controls or of some business information, I used cheap 600gsm card and just glued a strut onto it. For about £5 I created 8 displays for various things.

Big Logo
I wanted to make the game logo stand out a bit more than having it just on a poster; so I printed it out and then carefully cut around it all, and backed it onto craft foam board. I then used cheap (from the pound shop again!) ultra bright reading lights which could be placed around it to light the sign up. The result of this is that in pretty much all photos from the event (pro and by-chance delegate photos) the game logo is very visible even in the nightclub lighting of the expo hall. About £6 got me something that looked pretty good and set the booth apart.

That’s about it. I’m sure there may be something I’ve missed, but it’s quite a lot of information there already. I hope it’s useful to someone!