Skip navigation

The Cottage


The cottage has been extended at the back to house the electronics and below to hide the mechanism. The front window has a new frame to show off the LED temperature indicator.





The mechanism is a double ended Watt's linkage which gives an approximately linear movement for the figures. This is connected by a sprung stainless steel wire to the micro servo. Diametrically polarised magnets ensure that the characters are always pointing in the right direction.





The electronics combines simple circuits and modules.

System Overview

The power control circuit turns on and off the power to the Servo, RGB Shield and DHT22 sensor. The knock knock sensor is left powered so that it can listen for wake up interrupts. The top panel is simple buttons attached to input pins and fibre optics to extend the Arduino's LEDs to the top of the cottage.






When the board wakes up it checks to see if the sleep counter has reached zero or if knock has been detected and if so It starts up. Otherwise it goes back to sleep for another 4seconds.


In start up it firstly powers on the peripherals and WiFi module. It then sets the LED colour to be that of the last known temperature. Following this it sets the LED to fast flash to indicate it's going to get the weather. It then gets the local temperature and humidity. Once the WiFi module has booted it will request the weather.


On the Linino side the system sends a handshake signal to indicate that it is ready and starts up the Python script to listen to the serial port. The Python script makes an API call to the Yahoo weather service, if that errors or times out it will make a "guess" at the weather based on the local conditions provided by the sensor. The data is parsed and send back to the ATmega as a simple string.


Once the weather has been received the system shuts down the WiFi module. It can then update the position and new LED colour which is then solid and starts a timer for 1 minute. Once that timer has expired it will shut down the peripherals and go back to sleep.



Code examples:


Next: Enchanted Objects Design Challenge - Python Start, Python Stop

The cottage was disassembled so that the base could be painted matt black. This is an old magician's trick to draw the eye away from the base and hidden mechanism underneath.


The top panel electronics were also put together with another bit of stripboard, a couple of buttons and a 3 way connector.

2015-06-21 20.40.45.jpg

This was then glued to the top panel using some blobs of Sugru, of course it's best if you can avoid gluing your electronics into the product as it makes the whole thing harder to service. Given that it's the final week of the project, it's not appropriate to redo the whole of the top panel. Retrospectively it would be better to design some supports and slots into the top panel so that the board could simply be pushed into place.

2015-06-21 21.14.37.jpg

As with pretty much all of the connectors, this one had to be bent at right angles so that there was space for the connector to be fitted. For future projects perhaps some preformed right angle connectors would be a good idea.


The top panel was added to the cottage and the buttons were tested.


The newly printed magnet carriers were fitted, and the magnet holders glued on top ensuring the correct orientation.

MagnetCarriers2 (2).jpgMagnetHolders.jpg

Next: Enchanted Objects Design Challenge - System Overview

Cost Analysis

As well as the components kindly provided by Element14, Atmel and Infineon there were several additional components purchased for this project. These were bought as the project progressed or were already in the spares drawer. Where the original supplier was not known the costs were estimated based on current prices. Where more components were purchased than needed the costs were pro-rated. I've tried to include absolutely everything but it is possible that something was missed.


Parts provided

An attempt was made to use as many of the provided parts as possible. Although these parts did not cost me, they are incorporated into the cost estimates to give a more realistic reflection of the cost of the project. Rather than incorporating the entire cost for the workshop kit the individual parts used were estimated from the Farnell site. The exact switches could not be found so an equivalent was used.

Ardino YunElement14£49.03
Infineon RGB boardElement14£21.04
Arduino ProtoshieldElement14£3.55
IRF520 Power MosFetElement14£0.61
220R resistorElement14£0.01
2* 330K resistorElement14£0.01
2 * 10k resistorElement14£0.01
1n4007 diodeElement14£0.03
2 * Tactile SwitchElement14£0.18


Parts purchased

These were specifically purchased for the project, postage is included in the cost and where multiple items were purchased the cost was pro-rated between the items. For the 3D printed parts the cost was estimated by uploading the items to Shapeways and using their material value to provide an estimate.

Houseuksalesmaster on Ebay£17.38
SD CardWHSmiths£7.00
Mini Servobgood2010 on Ebay£2.19
RGB LEDOomlout£1.50
LM393 ComparatorD&M Components on Ebay£0.50
1M resistorD&M Components on Ebay£0.10
2x 5.1v ZennerD&M Components on Ebay£0.20
Piezo sensorElectronic Bits and Bobs on Ebay£0.40
Stacking headersAdaFruit via CPC£1.59
PaintB&Q tester pot£0.25
Lithium Polymer Battery - 2000mAhCool Components£13.69
Adafruit PowerBoost 500AdaFruit via Cool Components£13.00
Nuts and Threaded RodModel Fixing£4.28
Fibre OpticsFibreopticlightingsolutions on Ebay£0.99
Mechanical componentsWorkshopshed£1.96


Parts that were already available

These were found around in the workshop, either from abandoned projects, multipack purchases or salvaged. The solder was estimated using the method found on

DHT22PENGHUIMEI on Ebay£3.74 (2013 cost)
Stripboard / Tri-pad boardRadioShack£0.50
Stainless steel wireHalfords£0.06
Self-tapping ScrewsUnknown£0.70
Sugru x 2Sugru£2.00
Bondloc Structural AdhesiveMaplin£0.50
Heat Shrink TubingProto-Pic£0.04
Connector housingsProto-Pic£0.32
Connector pinsProto-Pic£1.58



Provided parts: £74.66

Additional Components: £73.65

Things I had: £13.65

Grand total: £161.96


Reducing costs

The Enchanted Cottage is effectively a prototype so there's plenty of decision that were made along the way. This has resulted in additional materials use and less than optimal design. This means that there is plenty of scope for cost savings.


The key tasks to reduce cost are:


  • Reduce component count
  • Replace/Remove expensive components
  • Simplify design


Also many of the components were bought in small batches so buying components in larger batches the costs would be reduced and multiple different postage costs could be eliminated.


Reduce Component Count


The Arduino Yún is a good board but its focus is to be a generic prototyping board rather than an embedded solution. Key examples of this are that the ATMega32U4 microcontroller is capable of running at 3.3v same as the Wifi module but the Arduino team chose to run it at 5v to give it maximum compatibility. This means that the board contains lots of level shifters on the board to interface between the two sides. If a custom board was made then this could run at 3.3v and eliminate these level shifters.


Also having the 3 boards stacked together with separate power board means that headers, connectors, spacers, struts are used for the board. So again merging all of these onto a single board would bring the costs down as many of these could be eliminated.


Expensive Components


The Arduino Yún has already been mentioned, that is one of the highest cost items. A "Dragino HE" WiFi module is approx £15 and the ATMega32U4ATMega32U4 is £2.34 when bought in quantities of 10 or above, a few basic components such as capacitors and a crystal are needed.


The Infineon RGB LED driver board is again and expensive component, it was used for the project as it provided a quick an easy approach to providing the output. However it is really over specified for the job and is being run right on the lowest level of it's capability. The approach here would be to take swap this out with a driver using discrete MOSFets to power each of the channels for the LED such as the INFINEON  BSS131INFINEON  BSS131 as that's quite capable of being driven by the lower 3.3 supply. To standardise the bill of materials these could also be used to control the power to the servo and temperature sensor. Again the same MOSFet could be used to turn on and off the power to the WiFi module


The sign for the back of the cottage was made of plastic and most of it's cost was delivery charges rather than manufacturing costs. If the house was being produced in bulk then this could be swapped out with a sticker rather than a sign which is substantially cheaper.


The house itself is quite a large expense so this could be replaced with a hand made version, the wood could also be bought in larger sheets for greater savings.


The current power design incorporates a boost regulator to generate 5v from the 3.7v battery. This is then reduced back to 3.3v by two different regulators, one on the Infineon board and one on the Yún. By swapping to a 3.3v design this could be simplified to be a single regulator that would provide 3.3v. Assuming further savings in power can be achieved then the battery capacity could be reduced.


The magnets were surplus from a previous project so these could be swapped with cheaper ones for the same results.


In general SMD components are cheaper than through hole components and take up less space on the PCB, so this is an area where plenty of savings could be made.


Simplify design


One of the key improvements of swapping to a single PCB solution would be to remove the need for many connectors and small boards. For example by mounting the LED directly on the board the need for a daughter board, connectors and wires could be eliminated. Similarly by incorporating the power supply parts onto the main PCB further connectors and headers would be removed. The stacking headers needed for the Arduino shield approach would also be eliminated.

As mentioned above one method to reduce costs would be to scratch built the weather house, this would also allow the design to be simplified reducing the wood used and number of components. Rather than having a separate front and back these could be integrated together simplifying the design. Rather than hand cutting the parts these could be laser cut so that there was a single sheet with each of the parts that could be popped out. This would reduce assembly costs. Equally these could be pre-printed as per the original house saving on painting cost and

The 3D printer parts are currently screwed together, if the technique using clips could be made to work, or if these screws were swapped with plastic rivets then the assembly would be simpler and the time taken the make the parts could be easier.

The design incorporates an SDCard to hold some of the code, if the Linino side of the design was optimised then this card could be eliminated and hence component parts and set-up steps for that module would be reduced.

The Knock Knock sensor incorporates a variable resistor to "trim" the level detection. If a series of detectors was checked it might be possible to replace this with a simpler resistor network with a fixed level.


Estimated cost savings


Based on rough estimates and the changes above to the project components it should be possible to bring the cost down to approx £60, a saving of over £100 on the original bill of materials. No attempt has been made to calculate manufacturing costs but the above suggestions should bring those costs down too.


Next: Enchanted Objects Design Challenge - Painting, top panel and new magnet carriers

The Enchanted Cottage build has been a multi faceted project with electronics, micro-controllers, embedded Linux, woodwork, 3D printing and general assembly challenges. To give you a better idea about how I worked on the project I've made a list of all the tools I used.

Tools and equipment

There was a wide variety of tools used for the project. Nothing was bought specifically for the project but a couple of things were made. The Robox 3D printer came in handy as it allowed parts such as the top panel buttons and fibre housing to be made that would otherwise be difficult to make. It also allowed the mechanism to be lightweight.


Hand Tools

Pliers, Wire cutters, Wire Strippers, Screw Drivers (various), Coping Saw + table, retractable knife, steel ruler


Power tools

Robox 3D Printer, Pillar drill, mini drill + cutting disks + mini milling cutter


Electronics / Test Equipment

Multimeter, PC, Laptop, Wifi Router, Tenma Digital Soldering iron, Breadboard from Arduino Workshop kit + wires, LEDs etc.


Home Made Tools

A couple of tools were made during the challenge, the first a saw table to help with sawing cut outs in the plywood and the second a simple servo test rig to try out some of the ideas and to check that the servo had sufficient power.

FretSawTableFretSawTable (2).jpgServoTestJig.jpg


The Arduino was programmed using the standard Arduino IDE but that was upgraded to the latest version at the start of the project. The code was uploaded using the USB cable rather than Wifi.

The Python coding was done using PyCharm, an IDE from the people who make Resharper. This was a great tool for learning as it suggested errors and corrections to the code as well as having the usual intellisense expected from a modern IDE.

To help with the Linux side, WinSCP and Putty were used to copy files and connect to SSH.

The schematics were created using Fritzing and Eagle 7.2 (free edition)

The 3D models were created using OpenSCAD.

Some of the graphics were created using Visio and Paintbrush was used to trim the photos to size.

The video was edited using Microsoft Movie Maker.



The photographs were mostly taken with a HTC smart phone, a couple of early ones were taken with an old Olympus C-170, and the video was taken using a Flip HD mini video camera. Where possible a tripod was used.



There were not any particular high risk activities for this challenge. When using power tools appropriate safety gear such as goggles were used, work was secured in a vice or clamp for cutting/drilling. For soldering a simple heat resistant mat was used to protect the bench from damage. Some adhesives were used so these were done in a well ventilated space and left to set out of reach of the family. There was a minor accident with some super glue when the tube was opened the contents squirted everywhere. Soapy water and gentle rocking was applied and the bonded skin was separated. The LiPo battery has been placed in a metal battery box and care has been taken not to short out the connectors. The circuits were tested on breadboard before deploying to the stripboard/protoboard and connections were double checked with a multimeter before powering up.


Next: Enchanted Objects Design Challenge - How much!?

Following lots of rude interruptions from the Wolf, Hans decided the Arduino Yún's security needed beefing up. After a bit of reading Hans realised that this could be a 16 week design challenge in it's own right.


Hans' plan of action for the lock down was as follows:


  • Users and passwords
  • Handle brute force attacks
  • Remove unused functions
  • Apply principle of least privilege



Hans had already changed the default root password to something unique but realised if he was sending out lots of IOT devices it would make sense to have a mechanism where you could provide everyone of them with a unique default password. This could be printed on a label on the bottom of the device so if it was reset to defaults it would take this rather than something that people could google for.


It's possible to check the user accounts by looking at the passwords file.


cat /etc/passwd


Installed by default on the Yún are the following:



Given that there's no FTP then the FTP user is a candidate for removal, although it would make sense to check that is not used for the WebUI.


We can disable the accounts using


passwd -l username

Brute Force

The Enchanted Cottage has some protection against brute force attacks in that the Linino portion and hence the Wifi is turned off for most the the time hence there is no way to connect. However in the computer world the few seconds that the system is up and connected should sufficient for a break to be attempted.


The two areas that could be vulnerable to this are the Web Admin UI provided by Arduino and the SSH port. It might be possible to turn these off. Given that these are used to fix or configure the device that's maybe not a good idea.  It's also possible to configure SSH to use certificates rather than password for login. To do this on the finished product we'd need to have some way of getting the keys back and forth.


This can be setup by following the instructions for setting up Drop Bear SSH for Public/Private Key authentication


The best method for handling brute force attacks is to use a intruder detection system such as Fail2Ban which uses the inbuilt firewall IPTables to lockout IPaddress that have strange activity patterns. The only dependency for Fail2Ban appears to be Python so for the cottage this seems like a good solution. The module is not yet available as a downloadable OPKG package but it can be installed manually. Fail2ban install on GNU Linux


The daemon file need tweeking to run on this platform, one from RedHat was used as a basis.


and this was tested with

/etc/init.d/fail2ban start



/etc/init.d/fail2ban stop


Removing features

Whilst Hans was researching security he had a visit from the Woodcutter who wanted to see how the build was coming on. Whilst they were wandering around admiring the structure the Woodcutter tripped on a stump and reached out and grabbed the nearest thing to him, a hanging basket of flowers. The chain supporting the basket broken and the basket and Woodcutter went crashing to the ground. The Woodcutter picked himself up and brushed off the soil and flowers. He looked at the basket on the floor and said "a chain is only as strong as it's weakest link". He picked up the basket, passed it to Hans and wandered off into the forest.


Hans realised that there were features on the Yún that were not being used. These could be removed to stop them being the weakest link.


Looking at the list of installed packages there seems to be some candidates for removal.


  • avahi - A Zero Configuration network tool.
  • cpu-mcu-bridge - The bridge, this is already swapped out so is not used.
  • spacebrew - A friendly wrapper for APIs
  • temboo - A friendly wrapper for APIs


Hans also wondered about avrdude, the tool for putting new sketches onto the AtMega. But removing that would stop the end user applying patches over the Wifi.


opkg remove temboo
opkg remove spacebrew
opkg remove cpu-mcu-bridge


Removing avahi raised a warning that it was used by depended on by other package so it was not removed at this time.


The other key feature to review is the Rest API, the uhttp webserver publishes data on the Arduino pins and can control the ATMega via a correctly constructed URL.




We can disable the Arduino specific end points by editing the /etc/httpd.conf file to comment out lines by putting an # in front of them.




Principles of least privilege

This security concept is basically don't give more permissions that is needed to do the task required. Then if anything goes wrong or there's a security loophole then a hacker is less likely to be able to escalate their privileges further.


Again, swapping out the bridge code with the reduced functionality of the python script means that the ATMega has access to less of the Linino side. However, python is running as root, which is a bit much given that it only needs to read a configuration file and get a file off the network to process and send via serial the ATMega.


There are tools to help lock down these permissions such as SELinux but it would appear that these would need the Kernel patching which unfortunately means I don't have time to implement this process.


Next: Enchanted Objects Design Challenge - Tools



SSH Tutorial for Linux - Support Documentation

MQTT Security Fundamentals - Securing MQTT Systems

The 10 challenges of securing IoT communications  |  Atmel | Bits & Pieces List of Yún packages

Welcome to pySerial’s documentation — pySerial 2.7 documentation

20 Linux Server Hardening Security Tips

operating systems - Hardening Linux Server - Information Security Stack Exchange

Using REST with Arduino Yun | Open Electronics

Web Server Configuration (uHTTPd)

What is the principle of least privilege?

Minimize Privileges

SELinux The_security_context_of_a_process

Whilst Hans was coding Matilda was fine tuning the mechanism and finishing the housing. When the magnet housings had been tested their positions had put Hans and Matilda a bit far back into the cottage. The magnet carriers were redesigned so that the holes were towards one end, that would move the positions forward by about 7mm and the coverings for the holes turned out not to be needed so those were removed to reduce printing time.


Due to their simple design and shape they printed first time with no issues.


However not everything was so simple. After quite a few failures the spacers for supporting the Yún and shields were printed successfully by lying the models down, reducing the printing speed and printing at 1/2 speed for the first few layers. Also a brim was added as the footprint was quite small.

Spacers Printing


The final challenge for the printing was two buttons for the top panel. These went through several iterations and failed prints but eventually a design was created that fitted the panel and printed successfully. The small bobble on the stalk stops the buttons falling out when you turn the panel upside down.

Wifi and Power Buttons


The key lessons learnt here were not to have features too close to the edge, the printer can handle thin slots but not thin solid, adding a brim helps give a crisp edge and when printing the first layer don't make it too thin and print it slowly.

Button Success

There was a little clean up of the wifi logo needed but the power button was simply a case of removing the brim.


Source code and models:


Next: Enchanted Objects Design Challenge - Locking the doors

Disable the bridge

As mentioned in previous episodes the plan was to remove the bridge as that provided much more functionality than it needed to and it also provided root access to the Linino side from the Arduino code. Hans thought would replace it with direct serial communications between the two CPUs.


To stop the bridge /etc/inittab is edited to disable the connection of the console to the serial port ttyATH0, the Yún needs to be rebooted after this change.


::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
#Disable Bridge
#ttyATH0::askfirst:/bin/ash --login


Checking we can communicate

To test the solution Hans produced a simple loopback example




To get Python to listen to the serial port the PySerial module needs to be installed. That's simply a case of using the package manager.



opkg update
opkg install pyserial


The port is configured as /dev/ttyATH0 and when we open the port we can specify the speed and any timeouts. For testing purposes the timeouts were set to 60s each and the test programme simply echoed the inbound stream back down the line.


import serial

  ser = serial.Serial('/dev/ttyATH0', 115200, timeout=60, writeTimeout=60) # Baudrate needs to be mirrored on ATMega side
        exit(1)          # quit as we can't start the serial port

line = ser.readline()  # read a '\n' terminated line

while line != "":
    print(line);            # Display on console
    ser.write(line)        # Echo it back
    line = ser.readline()  # read next line




On the Arduino side the serial port is configured as Serial1 and the code to communicate over serial is very straight forward we can echo the message to and from the PC across to the Linino.


void setup() {
  Serial.begin(115200);  //To PC
  Serial1.begin(115200);  //To Linino

void loop() {
  //From PC to Linino
  int c =;              // read from USB-CDC
  if (c != -1) {            
    Serial1.write(c);            //        write char to UART

  //From Linino to PC
  c =;                // read from UART
  if (c != -1) {                      // got anything?
    Serial.write(c);                  //    write to USB-CDC


Test results

The Python script was started up manually using SSH so that the output could be monitored. A sequence of messages were sent from the PC down the USB, over the bridge and then bounced back again.

Serial Loopback Test

Give that the test was successful the next step is to add this functionality into our existing scripts and configure the inittab to run our weather script.


Code at:


Next: A bit of 3D Printing



Arduino - Serial

Welcome to pySerial’s documentation — pySerial 2.7 documentation

Startup and Run Levels

UNIX man pages : inittab (5)

When I was making the Topsy Turvy Clock I created a non blocking delay class so that the Arduino could be doing other things whilst waiting for a timeout. This avoids the use of the delay function which otherwise "blocks" the operation until the timeout is completed. I realised that this same technique could be used to control the flashing of the RGB LED. This will need to be expanded to handle the colour cycling which will indicate that the Wifi settings need configuring.




Example Usage

Here's an example of the blinking code using the LED on pin 13.


#include "Blink.h"
Blinker b(1,0);

void setup() {
  pinMode(13, OUTPUT);

void loop() {
  digitalWrite(13, b.Level());
  //Do other things here as desired



Virtual Prototyping


As an experiment the code was uploaded to 123D circuits.




This allowed the example to be tested from a web page without the need for actually having an Arduino plugged into the computer.


Next: Swapping out the bridge

The bridge

Hans had been spending too much time inside coding. So this morning he went for a wander down by the stream. As he neared the town he saw the new bridge that had been put in so that the children could cross the stream to get to the school. The bridge was made of iron and had gates so that cattle did not wander across. There was a solar powered telephone box so that the kids could make calls and send emails and notice board so that the school could leave important bulletins for them to read. The bridge also had a system of bells and whistles to give warning alerts.
Hans spotted the Uart twins, Tex and Rex with their little sister Parity. The three children approached bridge but rather than going through the gates they headed down the side of the bridge and hopped over the stepping stones. Hans remembered how he and Matilda had hopped over those same stones when he was younger.


The other bridge

Hans looked at the Arduino code and noticed that the size was 10% bigger when he compiled in the Bridge libraries. Looking at the code it was obvious why. There was code for handling web servers, email and code to start and stop the bridge and check it was running. Following Ambrogio Galbusera's idea, he decided to drop the bridge and use a simple serial communication instead. The Linino side could start up his Python code directly rather than provide a console with root access listening on the serial pins.


Are you ready yet?

One of the problems of turning off the Linino portion of the Arduino Yún is that it takes some time to restart and you need to know when it's ready for action.


This problem is compounded by the fact that whilst that side is booting the serial connection which is normally used for messaging between the Linino and ATmega sides is used as a console for the Uboot and Linux boot processes. If the ATmega was to send anything across the bridge at that point then it could stop the booting process. The way the Bridge code works is to delay starting until that console has not produced any content for over 1s, however this timing based approach is a little unreliable so some people on the Arduino Forum have suggested adding further delays into the code to ensure that Linux has fully booted.


Luckily the system has a hand shaking line installed and that can be used to signal that the process is complete. This is connected up via a level shifter which can be turned on and off via one of the AR 9331's GPIOs.


Eberhard Fahle has produced an article that explains what is needed to configure the handshaking line for the Arduino Yún we can then use that either as a digital line or via the interrupts to signal when the boot process is complete.



Eberhard's code was combined with the YunSerialTermial code to allow the boot process to be monitored visually as well as via the handshaking line.





The boot status script was uploaded to the init.d folder and configured for execution.


As suggested in the article the init script was tested with


/etc/init.d/boot-status start

Boot On

and with


/etc/init.d/boot-status stop

Boot Off

The serial monitor was started and the boot process watched. Shortly after the last message in the console the red #13 light turned on. The boot-status message does not show in the log.



Access GPIO from Linux user space | FalsinSoft

A trip up the fell

Matilda looked serious, she was dressed in a boiler suit, boots and a hard hat, she was leaning on a pickaxe. "Do you remember that watch my father gave you as a wedding present?", Hans nodded and took it out of his waistcoat pocket. "Put it in the drawer", Matilda commanded "and your reading glasses". Hans put the items in the drawer. "Put on your gear and meet me out front". Hans put on his boiler suit, hat and boots and headed out. He was met by Matilda and Farmer Hogg who was pushing a wheel barrow. "Upt yonder fell", said Farmer Hogg, Hans looked blankly. Farmer Hogg muttered something under his breath and passed a scrap of paper with a hastily drawn map.


As they neared the top of the hill, Matilda brought out a compass and started wandering in circles. Suddenly the compass needle twitched and Matilda smiled. She cleared off the turf and almost immediately hit rock. She donned her safety glasses and raised the pick, thud, thud, thud, sparks, "bingo!" cried Matilda. The ore was shovelled into the barrow and wheeled down the hill to C.Defoe's builder's yard.


Matilda asked Mr Defoe for 4 diametrically magnetised disk magnets and the Golem smashed up the ore and squashed it into a disk under great heat and pressure. "I'll plate them and drop them around in the morning" said Mr Defoe. The next morning the magnets were delivered with instructions to take care not to trap their fingers between two magnets. The diametrically magnetised magnets ensured that Hans and Matilda would remain facing in the right direction.

Diametrically Magnetised

Diametrically Magnetised Magnets


Magnet Holders

The initial thought was that the magnets could be attached to the mechanism using Sugru, however Matilda realised that this was a rubber compound and would cause friction.


There was a nylon bar that could be machined for a housing but that would be problematic to glue to the base / magnets. So a magnet housing was designed for 3D printing that could be clipped/glued onto the mechanism, ABS rubbing against the wood would run quite smoothly.



Hans and Matilda's platforms were carefully milled by hand so that magnets could be added to those too.


The magnets were test fitted in preparation for a full system test.


Thanks to Eric Styles from First4Magnets for advice on the right type and strength of magnet.


Next: Enchanted Objects Design Challenge - A tale of two bridges

Some fantastic examples from model making company Pantograph, I particularly like the binary type writer


Matilda does not see the light

When Matilda tested the temperature status LED it was clear that it was not going to be visible from outside the cottage. The dark cottage interior sapped away the struggling coloured lumens. However, Matilda spotted that the LED was positioned right opposite the fake painted window on the front of the cottage.


If that could be replaced with a real window then the LED would be clearly visible. Now some people when thinking about new windows would be looking at curtain material and lace edging. Matilda was not that sort of a person, she was thinking about how best to smash a hole the front wall.  Matilda donned her safety glasses and removed the flower box to provide access. She drilled a hole in each corner and then used a cutting disk to join up the sides. Finally the edges were trimmed up to give a clean hole. Matilda was happy with the job.

Windows Cutout

New Windows

Matilda designed some new frames using OpenSCAD and these went through many iterations. The early versions barely looked like Windows at all and an alternative design for Windows 8 was terrible so she returned to a conventional design and Windows 10 turned out ok. She sent the designs off to the blacksmith to be assembled.


Frame source:

Frame model:



Remarkably the windows printed correctly first time and the best of the two examples was installed using contact adhesive.

Windows Printed

Windows Installed

Next: Enchanted Objects Design Challenge - The Lode Stone

Whilst Matilda worked on the LEDs and top panel, Hans finished off the circuits for the MOSFET power switch and connectors.


Circuit Explanation


A MOSFET is used as a low side switch to turn the power to the servo, RGB LED controller board and humidity sensor. This is connected to the Arduino output with a few extra components from the Arduino Workshop KitArduino Workshop Kit.


The gate of the MOSFET effectively acts like a big capacitor and for a short period before the transistor turns on it can draw a sizeable current. So series resistor R1 is used to limit the current drawn from the pin. A second resistor R2 sinks that charge to ground when the switch is turned off and ensures that the MOSFET remains off when the Arduino is asleep. The ratio of these two resistors needs to be high so that there's not a big voltage drop over R1, as the MOSFET will only switch on when the threshold voltage of 4v is reached. The final component is a protection diode, this dissipates the charge from any inductive loads such as the servo's motor when the MOSTFET is turned off.


Power SwitchIRF520 Datasheet



By this point the protoshield had been through a few revisions. This was clear by the spaghetti layout of the resulting wires. The headers for the cables were also a problem and had to be bent over to allow the connectors to fit. Some of these also had to be repositioned so that they could fit around the support struts. Given that the MOSFET will mostly be off and switching infrequently, it should not be necessary to attach a heatsink.

ProtoshieldKnock Knock Cable


The cable for the new knock knock sensor was also created and Hans realised that the strip board had +V, SIGNAL, GND with the protoshield had SIGNAL, +V, GND as intended so that means the cable will need to be carefully fitted in the correct orientation.  Not an ideal situation but also not a complete disaster.


Next: Enchanted Objects Design Challenge - Windows 10

The Crystal Cave


It had been a hard week so a trip to the Adam and Eve Inn was in order. Hans and Matilda sat next to the dwarves who for once were not having an argument. The dwarves had recently discovered a new cave lined with amethyst and citrine crystals, they discovered a strange phenomenon that happened on a full moon. Tonight was a full moon so Hans and Matilda were invited to see. They were given hard hats with lights and headed off through the forest to the mine. As they journeyed a wolf howled in the distance. They arrived at the mine and headed into the tunnels. After several turns and forks they arrived at the new workings, "23m below ground" the dwarves told them. As they rounded the corner they were met with purple and yellow twinkles as their torches shone off the mineral deposits. The dwarves told them to find a comfortable place to sit and one by one all of the torches were distinguished. Hans nervously held Matilda's hand, he was not used to such extreme darkness. Matilda on the other hand found it calming and smiled in Hans' direction. Suddenly, light appeared from above, it got rapidly brighter until the whole cave was glowing, it was a magnificent sight. Then as suddenly as it appeared the light faded away. "It happens each day when the sun is overhead" explained the lead dwarf, "but it's better with a full moon as the light is softer". He pointed his torch to a hole in the ceiling, the light reflects of the internal walls of that shaft and bounces all the way down here to the cavern".


Extending the LEDs with fibres


Matilda realised that this idea of total internal reflection was also how fibre optics works, she wondered if these could be used to extend the LEDs that were deep in the heart of the electronics to the top of the house for display. Some fibres were purchased and Matilda played with bundles of these wrapped in tape to ensure that the light would transmit as desired.


She designed a part to fit over the LEDs on the Arduino Yún with slots to take fibres from the LEDs

Fibre Housing R1

The first version of this was printed and had a couple of issues. One of the corners badly distorted where the adhesion to the bed was poor, the second was that the holes were too small so installing the fibres would be challenging. An additional check showed that the holes for the support struts were a bit small so these were increased from 3.2mm to 3.7mm.

Fibre Housing R1 Printed

The new model resolved these issues with bigger slots for fibres, bigger holes and the sharp corners were chopped off.

Fibre Housing R2

That fixed the problems and the new part printed without issue.


A top panel for a couple of switches and 4 lights was also designed, the POWER, WIFI, LED 13 and USB LEDs are to be extended to the panel as all of these can be controlled by our code / hardware.


Top Panel


Testing the fibres


0.5mm fibres were used so that they could be in a straight line for the rectangular LEDs but in a circle on the top panel.



The fibre housing and top panel work well but the fibres are quite slippy (and have a low melting point) so the heat shrink tubing used to indicate the colours and hold the fibres together is not locking them in place. Some kind of adhesive will need to be added, I suspect Sugru will do the trick.

Fibres Top PanelFibres Arduino



Arduino Yún Fibre Housing Design:

Arduino Yún Fibre Housing Model:


Top Panel Design:

Top Panel Model:




Arduino Yun LEDs


Next: Enchanted Objects Design Challenge - Turn on and offable

No volts

When Hans wired up the comparator circuit he could not get the output to go high. He swapped out the sensor with a simple voltage divider but still nothing. Thinking that he'd got a duff component he tried another, still the output stayed on 0v. The data sheet provided a clue, the output needed a pull up resistor, it could only act as a current sink.

Driving CMOS

The resistor was added and the voltage divider circuit behaved as expected, switching from low to high as the trim pot was adjusted.


Updated circuit

The full circuit was re-instated and that also tested successfully.

Comparator on boardboardPiezo Comparator Circuit 2

This circuit would ideally be tested with an oscilloscope so you could see the low voltage jagged signal from the piezo transducer and the clean output from the comparator. Not having a scope, Hans tested it with his trusty multimeter checking that there was a good swing on the output when he tapped on the transducer. Even on the input, the transducer seemed to be able to create voltages up to 3v which is quite bizarre thinking that it's just a sliced up piece of rock.


Boarding it up

Given that there were no special requirements for the board and the component count is low, stripboard was chosen for making up the circuit. Also the protoboard was already full and there was some stripboard in the back of the spares drawer. The board layout was sketched on lined paper and then the parts were test fitted on the board to ensure there was space for everything.


There was not much space in their extension so the new board was placed in the loft also meaning that the wiring to the transducer could be kept short.


Another cable was made up to connect this back to the main board and a hole drilled in the back of the roof space to fit the connector through. A wooden support was made to hold the board to the roof and the transducer was connected using double sided tape.


Next: Enchanted Objects Design Challenge - The Crystal Cave