Skip navigation
1 2 3 Previous Next

Enchanted Objects

62 Posts authored by: Andy Clark (Workshopshed) Top Member

Proto-pic asked people to share their IOT projects and they picked mine as their favourite

Thanks to a "gentlemans flight" I did not have to rush to Heathrow and also had plenty of time when I was there. As the plane flew into Newark, I took the train and subway over to Queens and got a view of the city. The nearest subway to the hotel (an overhead line) had a view of the unisphere, observation platforms and the science centre and rockets.


In the morning I had a bagel at a local deli and headed over to the venue. I have been to a few other Maker Faires such as the UK one up in Newcastle and the mini makers faire that ran at Elephant and Castle for a couple of years. I've also seen the Makers at Mex that were at Sandown last year. However the Americans being the way they are, have a much bigger faire, I knew this in advance but was still surprised by the sheer scale of their setup.


The Makers Faire was divided into 6 zones, each focusing on a rough topic area such as electronics, maker spaces, education or robots and drones. As we were waiting to go in we were serenated by a stilt walking band with a dancing cardboard dinosaur. I knew this was a good sign of the great things to come. I shortcutted through the science centre gardens and said hi to the Atmel crew and spotted a familiar face at the Arduino stand.

ArduinoWithMassimoBanzi .jpg


I also headed over to the Makershed to meet fellow Brit and laser cutting expert Dominic who'd traded some of his time for free accommodation and was helping out with the Solarbotics stand. I also met up with Andy Sigler from Patchbay.IO who was unfortunately frustrated by lack of power so I promised to return later to see things in action. I was impressed with the number of medical makers and thought I'd seen Enrico's Meditech case at one point. There was a great example of a Lego MRI and proton beam machine that were used to show kids how they worked so they would not be so scared when inside. I also liked the add ons for kids motorised ride on toys that meant that not only were they easier to use for disabled children but they could also be used to help develop certain skills or muscles.


{gallery} Talks


Midi Guitar


Fixer Vincent


Daddy Daughter Electronics


Whilst I was there I also attended a few talks, some were thinly disguised sales promotions but others were from enthusiastic makers wanting to share their experiences and ideas. I managed to miss the start of the Les Machines De L'île De Nantes but saw the slides of their fantastic ride on motorised Elephant, factory/gallery and next project the Stork Tree which is a giant metal tree with two ride on storks that take 60 people at a time in huge baskets under the wings. They pay for their projects via grants, sponsorship and by charging an entrance fee to their gallery where they get the public to test out their latest prototypes. There were also some good talks on making, hacking and fixing.

3DPrintedCastle (1).JPGArcadeMachinesBig.JPG
There were lots of fantastic projects inside the science centre too, and I got to see a work in progress cardboard formula one car being made, Stirling engines, a semaphore flag game with imaging processing to rate the flag user, magical 3D printed castles and another fellow Brit, Ross Atkin from Craft Robot who is kickstarting his project shortly. There were a lot of people who were just about to run kickstarter projects, and a lot of those were in the Startup zone. Here there was gadgets to show what mood your dog was in by how he wagged his tail, giant building blocks, architecture kits, multi headed 3D printer, laser cutting milling machines and some chaps from Dublin with a novel pin board for holding circuits or projects in place whilst you solder them.

I ended the first day exhausted so managed to miss the Menthos and Coke show over at the UniSphere.


The next day decided to revisit the electronic section and say hi to Cadsoft. They were really friendly and explained the new licensing model to me. Also I spotted another celebrity Eben Upton.


There were a few announcements (that I mostly missed) whilst I was at the show. Arduinio has finished their new Wifi shield with Atmel's cyptography chip on it. Adafruit is bringing out a new board and Atmel were talking about the new Atmel Studio and their web based IDE.


I did however manage to see the Life Sized Mouse trap in action, watch drone racing, see experiments being done, talk to loads of people and buy some presents.


{gallery} Makerfaire


Filament recycling


Big 3d Printer


Cardboard formula 1 car



ExperimentBoy (2).JPG

Experiments with ExperimentBoy


Drone Racing




Hive76 Clyde Computer

InstructablesWoodCarving (6).JPG

Instructables chainsaw robot


Makerfaire sign

MechanicalHorse (2).jpg

Mechanical Horse

MouseTrap (2).jpg



Mario the Magician with Animatronic Monkey Marcel


Cloud computing?


Lego Crowd Creation


Multiuser Bike



Mural painted live

PowerRacers (2).JPG

Power Racers Parade


R2D2 Builders

RobotResurection (4).JPG

Robot Resurrection


Stilt walking jazz band and dancing cardboard dinosaur


Tiny Arcade Machines

ZegoBeast (2).JPG



I finished my weekend by watching the Eepybird chaps spraying coke zero all over the place, in time to music.

CokeMentos (4).JPG

A big thanks again to Element14 for arranging the trip and selecting me as the winner.

A quick report from Hans and Matilda whilst I'm writing up the main report.


Hans and Matilda travelled to New York in a stylish box.


At Heathrow they stopped off for a cup of tea, it was a bit big so they did not finish it.


A trip to New York is not complete without a coffee and bagel for breakfast.


They stopped in to see the Unisphere before the show


There were lots of interesting electronics to see at the show, including several new boards.


The locals were friendly


There were lots of exciting events and things to see, such as Power Tool Drag Racing.


Hans and Matilda liked the show and the USA so much that they've decided to stay there. I'll need to find some replacement meteorologists for the Enchanted Cottage,

The show is massive and I must have walked miles yesterday. There are lots of amazing things too see and lots of fantastic people. I also attended a few interesting presentations. One thing that struck me was the diversity, people have all different reasons to make and different levels of skills and technology. I had a fantastic day and am sure I'll have another one today.


I'll write a bit more and upload more pictures once I've access to computer.

2015-09-26 10.08.44.jpg

When I met up with shabaz and mcb1 the other evening they asked if I was excited about going to the New York Maker Faire. The answer is "not yet". Part of the reason for that is I'm still thinking about the logistics aspect, where can I get my dinner, how do I get from the airport to the hotel etc. I'm also still in my denial phase, not quite believing that I'm actually going!! Also there was not much to go-on for the Maker Faire website.


Today I saw a report from the Bay Area Faire and there was some amazing projects so I checked the Maker Faire site again and there are some details now available. It's beginning to become real for me.




World Maker Faire – 6th Annual

New York Hall of Science, Queens

September 26 & 27

Saturday and Sunday 10AM – 6PM







The overall programme for the New York Faire has not yet been posted but there are some heavy hints in the form of who the sponsors are and some of the makers who have already signed up.




Meet the makers


Free Tickets

If you live in the New York area and want to get yourself some free tickets, then you can sign up to promote the show as part of the New York Street Team


Maker Faire Bay Area reports

I spotted today a great selection of enchanted objects from the end of last year over on Instructables, including a Wall-E, robotic raven and selection of Tardis based projects.


Also David Rose from MIT has written a book about the subject, I think his introduction sums why we need enchanted objects.


Whilst the challenge was running I used the work on the project to spin a few articles onto the Workshopshed blog. It gave me a break from writing in the third party and also allowed the posts to span what was several weeks of the challenge.


3D printing

3D printing small details - Workshopshed

3D printing which way up? - Workshopshed


Different materials

Working with 3mm hardwood plywood - Workshopshed

Hacksawing sheet metal - Workshopshed


The latest article also gave me a chance to practice my technical sketching.

In the below presentation on security Rohini Pandhi mentions the problem of keeping your device updated.


Unconnected consumer items used to be simply build, distributed and sold with no process for doing any updates. Embedded systems did have options for updating but often this needed to be done by a trained field service engineer or by returning the item to the factory. Small issues spotted post production were fixed in new versions but often not patched in older versions. If there was a significant fault with a system then they would need to be an expensive product recall.


With connected devices there is the added issue of security. When there is a security issue these often need to be patched faster or there might be problems for the end users.

The fact that the device is connected means that patches can be downloaded and applied more easily as is done with mobile phones and PC.


For embedded products there are additional challenges

  • Lack of user interface
  • Always on
  • Power requirements (flashing a ROM could use a lot of power)
  • Handling failures
  • Automating the installation process


I've not really looked into these issues for my project so would be interested to know what other peoples thoughts are?


The 10 challenges of securing IoT communications | Atmel | Bits & Pieces

Efficient over-the-air software and firmware updates for the Internet of Things - Embedded Computing Design

Meraki firmware updates while you sleep

Open source solutions ease process of updating leg - AMD – Aerospace Manufacturing and Design

A router firmware update goes bad | Computerworld

Some photos that were taken during the project.




{gallery:width=600,height=600} Photo Story


Enchanted Cottage: Before it was taken apart.


Mechanical Prototype: Cardboard and brass tacks


Multiprint: Printing lots of parts for the mechanism


Test Jig: For testing servos

2015-03-29 20.20.54.jpg

Cutting: Strips of wood for the substructure


Planks: Initial pass at the frame parts

Printer in action

Printing: Printign the mechanism


Battery Delivery: Matilda checks out the new battery


Captive Nuts: Nuts to support rods to support PCBs

2015-05-04 20.53.10.jpg

Battery Test: Testing the battery

2015-05-09 20.16.07-1.jpg

Infineon Low Power: Testing low current options with the Infineon RGB Shield

2015-05-11 20.17.28.jpg

LED: A mini PCB

2015-05-12 20.44.33-1.jpg

Golem: Hans and Matilda's Metalworking Friend


Pins: Pins and Headers


PCB Stack: Test Fitting

2015-05-16 20.21.17.jpgR

Battery Box: Folded stainless steel

2015-05-16 21.21.51.jpg

Battery Board: Testing the board

2015-05-30 21.44.00.jpg

Knock Knock: Testing the sensor circuit


Protoshield: Surely I can fit more on it than this...


Knock Knock: Now on stripboard

2015-06-08 14.59.18.jpg

Fibre Housing: With fibres

2015-06-14 17.37.49.jpg

Just add magnets: Hans and Matilda get an upgrade

2015-06-18 22.33.46.jpg

Top Panel: Buttons and lights

2015-06-20 20.45.05.jpg

Printing Supports: Attempt 6


Buttons: Circuit board for the top panel


Fail: When buttons go bad


Magnet Holders: Hans and Matilda out up front

MagnetCarriers2 (2).jpg

Magnet Carriers: The new mechanism


Posing: finished cottage

2015-06-23 22.41.49.jpg

Electronics: Hans and Matilda admire the finished electronics

2015-06-22 20.58.26.jpg

Weather: Warm, slight chance of rain in Chicago

As mentioned it the demo video and Enchanted Objects Design Challenge - And they all lived happily ever after the Arduino Yún takes a long time to boot. I did notice that there's a bit of a difference between different file systems on the SDA. I also collected together some links in my research which give ideas on speeding up this process.


One tool that might help is BootChart that gathers some stats and presents them as a chart, as with a lot of things on the Arduino Yún this is for standard Linux so might not work for the Yún platform.

Boot Chart





This particular enchanted object is right out of the storybooks. Deep in the forest is a small cottage owned by a timeless couple, Hans and Matilda who are doomed never to meet. When it is wet he goes outside but when it is dry she must leave the house.


The idea was to take an old fashioned "cat gut" based weather house and use the electronic components to bring it up to date. The key features would be servo driven mechanics, LED showing the temperature and the Arduino Yun for getting the weather from the internet.


WeatherHouse.jpgFinished House~2[1].jpg


The project has stayed fairly true to it's original idea, the LED bar graph for the temperature has been swapped with the coloured LED and the need to have a button to check the temperature has been eliminated. The mechanics have been 3D printed and fitted together with magnets under the cottage so that the figures move straight in and out of the house with no obvious form of propulsion.




About me

Before the project I knew a bit about Arduino, nothing of the Linino portion of the Yún and had not touched Linux for years. I also had not coded in Python before or used RGB LEDS and piezo sensors. I'd only just started with 3D printed back in January. I do have some electronics background having done GCSE and AS-Level electronics and then a degree at Imperial college back in early 1990s. I've been in software ever since and just returned to electronics as a hobby in the last couple of years.



Hans and Matilda are just fictional characters so in reality all the work on this project was done by myself.


However, I can't take all the credit.


Thanks to Atmel, Element14 and Infineon for providing the kit for the project.

A special thanks to Christian DeFeo and team for setting up the challenge.


Thanks to everyone who's provided help and support along the way

My wife Rebecca for acting as a sounding board and putting up with the late nights coding and noisy printer in the kitchen.

Alan Barnet for support and ideas

Support and advice from the Element14 community Jan Cumps, Clem Martins, Frederick Vandenbosch, shabaz, Ambrogio Galbusera and Mark Beckett

Inderpreet Singh and peteroakes for their support and RGB lighting code

Charles Gantt for his enthusiastic reports

Eric Styles for advice on magnets

AdaFruit for their splendid Powerboost board and DHT22 library.

Michael Anthony Schwager for the Enable Interrupts Library

Michael Margolis,Philip van Allen and Korman for the variable speed Servo Library

jwaldha for the technique on how to turn off the Linino portion of the Arduino Yún

the members of the Arduino forum for their treasure trove of ideas and information



As well as the weekly "story" posts I added a few out of character ones for interest and to include extra technical details.


Enchanted Objects Design Challenge - Disaster strikes the Enchanted Cottage

A big thanks from Hans, Matilda and myself

Enchanted Objects Design Challenge - Remodelling the Enchanted Cottage

Enchanted Objects Design Challenge - Matilda is not happy

Enchanted Objects Design Challenge - The Woodcutter and the Blacksmith

Enchanted Cottage CAD models

Enchanted Objects Design Challenge - Back on the straight and narrow

Servo and mechanics in action

Enchanted Objects Design Challenge - Yum Yum Yun at the Enchanted Cottage

Enchanted Objects Design Challenge - Channels and a special delivery to the Enchanted Cottage

Enchanted Objects Design Challenge - The snake, the troll and the fighting dwarves

Setting up a Python Development Environment

Listening to weather on the radio

Enchanted Objects Design Challenge - The flaming postman, the blind man and a trip to the market

Enchanted Objects Design Challenge - The Blue Haired Woman and Off Grid Living

Enchanted Objects Design Challenge - Hans meets "Injector"

Enchanted Objects Design Challenge - Farmer Hogg and the Lockity Gowan

Enchanted Objects Design Challenge - Taming the Python

Enchanted Objects Design Challenge - The Glowing Golem and shiny battery box

Enchanted Objects Design Challenge - Sleeping Golem

Enchanted Objects Design Challenge - The townsfolk get Rickrolled

Enchanted Objects Design Challenge - This is not the WiFi you are looking for

Enchanted Objects Design Challenge - An unexpected visitor to the Enchanted Cottage

Enchanted Objects Design Challenge - Knock Knock

Enchanted Objects Design Challenge - The Crystal Cave

Enchanted Objects Design Challenge - Turn on and offable

Enchanted Objects Design Challenge - Windows 10

Enchanted Objects Design Challenge - The Lode Stone

Enchanted Objects Design Challenge - A tale of two bridges

Yet another way of blinking an LED on the Arduino

Swapping out the bridge

A bit of 3D Printing

Enchanted Objects Design Challenge - Locking the doors

Enchanted Objects Design Challenge - Tools

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

Enchanted Objects Design Challenge - System Overview

Enchanted Objects Design Challenge - Python Start, Python Stop

Enchanted Objects Design Challenge - Planning and Building

Enchanted Objects Design Challenge - Testing

Enchanted Objects Design Challenge - And they all lived happily ever after


General Interest

These posts were created for general interest and reference but were not specifically to do with the project.


Useful videos and references

Securing IOT devices

Other enchanted objects

More enchanted objects

Extreme Enchanting


Technical issues and challenges

The build for the Enchanted Cottage was not all smooth progress. There were a selection of technical challenges and mistakes along the way.


The servo provided was a continuous rotation servo, to use that would have made the project particularly challenging. The tinkerkit servo was also a bit large for my house so I purchased a smaller positional servo.

The Arduino Yún provided it's own set of challenges. Firstly was making it connect to the Web API using a HTTPS connection, this required installing the certificates and jumping through some hoops to get the python components needed. Luckily there was more than one Python library to use so I managed to find one that worked and validated the certificates.

The mechanics to make the figure move took a few attempts, firstly to get the correct motion then to get something that could be reliably 3D printed.

The wiring took a couple of goes to get right, I had initially put the cables too far into the sockets leaving no room for the pins. I also used solid core for these wires which is all I really had spare. This mean that the wiring loom was quite stiff and difficult to manoeuvre, swapping this with flexible cable would make sense.

There were some physical issues too, the short cable on the LiPo battery is definitely one to watch for. Generally finding enough space for all of the components so that they did not clash and issues like the height of the components on the Yún and different holes in the proto board meant for a few on the fly changes being needed to the structure. The woodwork would be built differently knowing what I know now. The proto board inevitably ended up a little messy as the layout was revised a few times. Again there was difficulty finding space for the connectors so that they did not clash with the board and mounting struts.

Managing power became one of the key topics as I wanted to run the house on batteries, I found what I needed online for that and my experiments produced good results.

The Infineon RGB shield was easy to use and the previous challengers had generated some good documentation and code libraries. I knew I'd be right on the lower current limits of the board but with the right settings and timings the current was set correctly.

The knock knock circuit was heavily researched before incorporating into the project. The circuit was straight forward to understand and build with just the lack of a pull up resistor on the comparator output causing any delay.


I've learnt a few bits of electronics along the way such as driving MOSFETS and handling the signal from the Piezo transducer and I've learnt lots about the Arduino Yún.


Circuit Diagrams, 3D Models and Code


All of the files for the project can be found on GitHub which I've been using all through the project to manage the project and share files between computers.





The code is a combination of C++ on the Arduino side and Python on the Linino side, there are also some shell scripts to help setting up the system. The decision to use C++ classes to segregate the functionality was not done to create re-usable libraries for others but to make the code clear to read and maintain. The decision to use Python was based on that it was an easy language for beginners and that it was already installed on the Yún.


As mentioned above there are several libraries incorporated into the code


AdaFruit - DHT22 library -

Michael Anthony Schwager - Enable Interrupts Library -

Michael Margolis,Philip van Allen and Korman - Variable speed Servo Library -

Inderpreet Singh and peteroakes - Infineon RGB lighting Library -

Eberhard Fahle - configuring the handshaking line for the Arduino Yún




The original plan was to use Fritizing to document a lot of the circuits. Fritzing provided it's own challenges so a mini tutorial was written on what was learnt. As the project progressed many of the schematics were simply done using Visio as all that was needed was the high level blocks and wires. For the full schematic Eagle was used as it's libraries were more extensive so fewer components needed to be designed.

Many data sheets and websites were referenced and are too plentiful to mention here but they are mentioned on the specific posts that utilised them as a reference section.


{gallery:width=500,height=500} Circuit Diagrams

Power Switch

Power Switch: Switches on an off the peripherals

Knock Knock

Knock Knock: Sensor circuit


DHT22: Temperature and Humidity Sensor


RGB: Infineon RGB Shield and LED

Full Schematic

Schematic: Full schematic




The 3D printed parts were all modelled in OpenSCAD so they have a source code as well as the STL files that were generated for printing.


{gallery:width=500,height=500} Printed Parts


Mechanism: Parts for the Watts Linkage


Magnet Housing: Holder for the magnets


Fibre Housing: Attach fibre optics to the Arduino Yún


Window: Replacement window

Top Panel

Top Panel: Show fibre status and buttons


Buttons: A couple of buttons to control the setup


Spacers: Different heights of spacers for the boards


Security has always been in the back of my mind whilst working on this project, the wolf is never far from the door.


The thing that amazed me the most was that there were practically no end to end examples where people had created a secure connection to a HTTPS server. The ones I found had a one liner that mentioned installing certificates but no detail. I suspect this is because the Arduino Yún is targeted and used by hobbyists.


Secure communication could be done using a VPN but as the destination is not under our control, that's not possible, so an alternative way to secure the communication was used.

Enchanted Objects Design Challenge - Channels and a special delivery to the Enchanted Cottage


The key features of the communication are:

  • Certificates installed from a trusted source
  • Certificate provided by weather server validated to ensure identity of that server
  • Communication from weather server encrypted using TLS as provided by HTTPS end point

Enchanted Objects Design Challenge - Taming the Python


The cottage has been made to continue working in the case of a network failure of DOS attack

Enchanted Objects Design Challenge - The townsfolk get Rickrolled


The cottage has been made to continue working in the case of a power failure

Enchanted Objects Design Challenge - The Blue Haired Woman and Off Grid Living


To lock down the Yún the following principles were applied

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

Enchanted Objects Design Challenge - Locking the doors


Instructions for use

Initial set up

  • The one time set up of the system is the out of the box experience provided by Arduino, you have to configure the WiFi to point to your local network.
  • Unless you live in Chicago,IL you'd also need to set your location in the configuration file.

User Operation

  • Then all the user has to do to get the weather is wait, the figures will automatically adjust their positions and the light changes colour as new data become available.
  • For impatient users they can simply knock on to roof to trigger a system wakeup and check for weather.
  • Rather than needing to read small digits the user can quickly tell the temperature from the LED colour.



The story aspect was written each week on the morning commute based on the planned work to be done. As the week progressed this occasionally resorted in a re-writing of the story so that the tale correctly reflected what was actually done, some of the topics were moved to later weeks as needed. Writing in the third person narrative was at times challenging and I decided fairly early on that it would be easier if Matilda did the mechanical aspects and Hans did the coding and electronics. However I did have to re-allocate some tasks between my alter-egos so that it was more evenly shared.


Costs and Cost Saving ideas

As mentioned in Enchanted Objects Design Challenge - How much!? there are many opportunities to reduce code on this project.


The key points are:

  • Build a single board based on a 3.3v supply, that would reduce a lot of the complexity such as connectors, physical support for the board, power regulators, level shifters etc.
  • Build the house from pre-printed panels that could be laser cut and simply assembled.
  • Simply assembly steps by eliminating some of the screws from the mechanism.

Working project demo

A quick demo of the house in action. The demo mostly shows the long boot time of the Linino portion of the Arduino Yún. It typically takes around 60s to boot and depending on the disk state it could take longer. I did some research into how this time can be reduced but did not have chance to implement anything.

On power up the figures move so that Matilda is just inside and Hans just outside. This would indicate a slight chance of rain.

The flashing light at the start of the process shows the system waiting for the boot. Once it's booted the light changes to indicate that it's processing the weather and then changes again to a the solid light with a  slight movement of the people to the middle position to show that it's going to be a "changeable day in Chicago" which is where I've configured the system to check for weather.





A few enhanced features have been suggested by various engineers, including Christmas lights and posting the status to the internet. Solar panels on the roof were also suggested, some calculations would be needed to determine if that would make a significant difference given the small roof size.


For me the biggest thing that could be improved would be reducing the size of the electronics and hence the size of the back if the cottage. With a custom board or simply smaller modules it should be possible to bring that width down to just a little more than the thickness of the servo.


It would also be good to have the weather information displayed on some kind of screen, I did look into 8x8 LED matrixes but those would consume a lot of power. The obvious low power option would be a electronic paper display as that only uses power when it updates. The Arduino could stream images from the Linino's storage onto the display to show for example a picture of a cloud when it's cloudy.


The software for the system focuses on the functional aspects, moving the servo, getting the weather etc. There is lots that could be done on the user interface such as providing an easy way to set the location and simplifying the UI provided by Arduino.


A couple of things planned for the project were dropped along the way. One idea was to use capacitive switches for the controls, however this was dropped in favour of the knock knock switch and simple top panel buttons. A clear plastic housing for the back of the cottage was planned but got cut at the end due to time constraints. A rather crazy idea of using a model railway smoke generator to provide a smoking chimney (on cold days) was also abandoned.


The Low Battery signal from the charging board is wired to the protoshield but nothing is done with it. That could be wired to one of the inputs and read in the code.


As mentioned above improving the boot speed would be a significant improvement to the system.


The Infineon shield was investigated to see if the Flashing and colour cycling functions could be offloaded to it's MCU. This required a special cable and software so was not attempted.




The design challenge has definitely lived up to it's name, it was very challenging. I've learnt a lot about embedded systems during this project, from interrupts and low power options on the Atmel microcontroller to MOSFETs and power control thanks to Infineon. I've also learnt a lot about 3D printing and designing models to make them print reliably. One of my key lesson's learnt is keeping an eye on the physical space required for connectors so that they don't clash with other components.


I'm happy will the end result and enjoyed making the Enchanted Cottage, and I'd like to thank Element14 for giving me the opportunity to participate.



And so our enchanting tale comes to its end. If you go down to the forest, there in a little clearing you will find an Enchanted Cottage. If you knock on the door then a delightful couple will pop out to tell you the weather. But be careful not to stay too long as you might bump into the wolf.

There was a new version of the Arduino IDE, this week was not the best time to download it, so that was left until after the challenge.


Due to the modular nature of the design the boards and components could be tested as they were assembled. The boards were tested with modified versions of the example code that were originally used in the development. Prior to assembly the proto-shield was visually inspected for problems.


Test code and example:


Powerup Test

All the plugged components were removed, the Arduino Yún and Protoshield were plugged together and it was powered up from the micro USB connector. This tests that there are no serious faults with either board. The LED light pipes were visually inspected and although there was a little bleeding of light between the outputs the overall result was acceptable.


Knock Knock and Top Panel Buttons

The knock knock sensor was plugged in and tested. This did not work as expected and was tracked to a dry joint on one of the power wires on the protoshield. Whilst trying to diagnose that issue a short sketch was written that output the button status to the serial port for monitoring and this was used to test the top panel buttons. A note was added to ensure connectors pushed on properly.



This was not testing correctly, the MOSFET switch code was added to ensure that the DHT22 had power but I could not get this to read. I suspected the power switching so investigated that on it's own.


Mosfet Test

An LED was attached to the power connector normally used for the Infineon shield, it was a bit of a lashup as the cable was not very long. The problem was identified as a software issue, it was that the pin that turned on the MOSFET had been entered as 11 rather than 12. This was corrected in the test code and project code.



Now that the MOSFET was working, the DHT22 tested correctly, the local temperature was 25.3°C and 43% relative humidity, very pleasant.


Mechanism test

The mechanism was tested to ensure that it moved freely and that the figures were running smoothly.


The servo was tested without the wire link to the mechanism using the slow sweep code.


Because the servo had been binding in the previous tests the springy connector was moved to the outer hole on the horn, this meant that the line to the mechanism was straighter eliminating that problem. However, the limits of the movement needed to be recalibrated from the original 50° - 100° values. A new sketch was created that used the top panel buttons to move the servo and output the angle, that allowed new values to be set.



Battery Test

The power was switched over to the battery to ensure that module was wired correct, that was all fine.


Infineon RGB test


The last shield was fitted and the wires added. The LED did not turn on and the code froze on LED.begin(), this was identified as the I2C pins connecting the protoshield headers as being open circuit. They were re-soldered and the LED worked.



Testing the code

RGB Shield

The RGB shield was behaving strangely. It was not flashing the LED correctly, it would go on and then stay off for ages, blink for a very short time and then stay off again. It was setting the intensity to zero that was confusing it. So the solution was to flash between brightness 1 and a larger value.

Serial Bridge

So that the state model and bridge could be tested, the code was scattered with messages to send back to the computer. The state model was working correctly but the weather returned was gibberish.


The SerialParse script was installed to send the request to the Linino. The weather-daemon was stopped and ran manually.

This returned the error.


ERR,[Errno 2] No such file or directory: '/etc/WeatherAPI.conf',3,10.00


The missing file was copied on and a new error appeared

Traceback (most recent call last):
  File "/mnt/sda1/Python/", line 217, in <module>
  File "/mnt/sda1/Python/", line 200, in main
  File "/usr/lib/python2.7/site-packages/serial/", line 363, in write
    raise TypeError('expected str, got %s' % type(data))
TypeError: expected str, got <type 'unicode'>


This showed that the weather was being read correctly but the script was failing to send it back to bridge.

Googling showed that this was an encoding issue pyserial ser.write('string') TypeError in OS X | Python | Python


The change was made to the code and it correctly returned the weather to the Arduino.


        w = getWeather(l['humid'], l['temp'])
        print (w)              # Write to Console, for testing


The main code was still erroring, seemingly returning junk back to the Arduino. However, when it was left for a period, subsequent reads did successfully return the weather. This was repeatable.


A simple flush command was written to ensure that the serial buffer was cleared of any booting garbage before requesting the weather.


void CONTROLLER::flushserial() {
    while (_serial->available()) {
     int inByte = _serial->read();


This did not help with the problem so a simple retry mechanism was added to the code.


That approach worked.


The code is not perfect but it's enough for a demo to be recorded.


I'm speculating that the handshaking line is going high too soon as it's fired off by a different process to the weather-daemon. Perhaps a resolution would be to toggle that GPIO line in the Python code instead.


Next: Enchanted Objects Design Challenge - And they all lived happily ever after

Planning and Research

The project was planned by creating a calendar of the 15 weeks in a spread sheet then mapping the high level tasks to the weeks. Two weeks were left empty to allow for issues and overruns. Critical path items such as the house were ordered early on and potentially long lead time items such as the battery were ordered as soon as possible.


I knew that I would be out of town for a couple of weeks during the project so I effectively did twice the work in the preceding weeks so that I could have something to show. Many of the posts were drafted well ahead of time and photos or videos were added when they became available, the topics were re-ordered as necessary and some topics dropped or added. The story lines were often written on the way to work in the mornings.


I was not familiar with the Arduino Yún and some of the electronics so lots of research was done into these during my commute from work or during lunch times.


Nearing the end of the project, roughly around the start of June the remaining tasks were drawn up into a "snagging list" each being a single low level item such as "paint frame", "C++ code for blinking LED" etc. This meant that the list of things to do grew quite rapidly but because each was smaller and more focused they also got completed quickly. It also allowed "non-critical" items to be discarded.


The last week was reserved for commissioning but unfortunately some software items over ran and had to be completed that week too.


The Build Process


The process of building was to strip down the old weather house to analyse how the new mechanism could be added. After removing the old mechanism the house was fixed back together. The roof was made so that it could be lifted on and off. The new framework was intentionally made to be stand-alone, this allowed changes to be made without risking filling the house full of holes. It also allowed testing to be done without risking damaging the house. Where possible the new parts added were from the kits provided. The electronics and coding was done in a modular fashion with each component being constructed and fine tuned before incorporating into the over all design.


Next: Enchanted Objects Design Challenge - Testing

Putting on the roof

One of the big physical jobs left for Matilda and Hans was putting the roof back on. They realised that they could not do the job by themselves so they wandered down the Adam and Eve Inn to look for volunteers. It turned out that everyone wanted to help so the barkeeper closed the pub and he and the snake came along too.


The helpers were of various use, the Dwarves spent most of the time arguing and Farmer Hogg kept saying things like "I'd not have started from here". However the barkeeper and snake were very useful. Whenever the barkeeper wanted the snake to do something he'd command "Python Start" and whenever a job was done he'd say "Python Stop". The roof was quickly done and Hans and Matilda posed for a photo.


They thanked everyone who in turn decided to go back to the inn to celebrate. Hans and Matilda had plenty to do so celebrating would have to wait.


Hans had forgotten

Hans realised he'd forgotten a critical step in the process. How to start and stop his Python script. He looked back over his notes and realised that he could use bits from the Handshaking code and from the Fail2Ban setup.


Init script

An initialisation script was created.


#!/bin/sh /etc/rc.common
# Initialise Python Listening on Serial Port


start() {
    cd $workdir
    /usr/bin/python /mnt/sda1/Python/ &
    echo "Weather Server started."

stop() {
    pid=`ps -ef | grep '[p]ython /mnt/sda1/Python/' | awk '{ print $1 }'`
    echo $pid
    kill $pid
    sleep 2
    echo "Weather Server killed."


Changes to Python Code

The python code needed minor changes so that it would respond to the shutdown request

# Handle exit and kill from OS
def set_exit_handler(func):
    signal.signal(signal.SIGTERM, func)
def on_exit(sig, func=None):
    print "exit handler triggered"

# Run program
if __name__ == '__main__':



The init script was tested with

/etc/init.d/weather-daemon start



to check it was running


Then shutdown using

/etc/init.d/weather-daemon stop


Finally, it was installed using

/etc/init.d/weather-daemon enable


Next: Enchanted Objects Design Challenge - Planning and Building



"Now is the time to add some magic & mystic back into the world of everyday objects"


Yup, this fits the brief.... Motorcycle + Toy Horse = MOTORHORSE