Our little twitter bot @ViewFromRoots

ViewFromRoots tweets regular photos of the view from our showroom across the orchard. Photos are taken based on the position of the sun (even when it’s behind clouds) letting you see Sunrise, solar noon, sunset and a few other probably picturesque times of day. Eventually it will also make regular time lapses so you can see the seasons change and the orchard grow. You can follow @viewfromroots on twitter

Why we created it

We live and work in a lovely place, so nice in fact that customers have always commented on the stunning view across the orchard from one of our kitchen furniture displays. Steve Root decided it would be a good idea to build a twitter bot to share this view with the world. Building projects like this are good fun but also allow us to practice and develop skills and tools we use within our business to do the best work we can. Real world examples include a fibre optic starfield ceiling (with the stars accurately plotted to the day our customers married) and a graph plotting humidistat that allowed us to test if a new style of extractor was really effective.

How it works

The ZeroView camera mount is designed to mount a Pi Zero but I just used it to mount the camera to the window.

The twitter bot is built from a Raspberry Pi computer connected to a camera module by a long cable. That lets us hide the little computer in our ceiling. The camera is fixed to the window using a mount with suction pads.

The code used will eventually be shared on github. If you’re looking for the code now, email us and Steve will reply and share the code.

The code first uses a JavaScript library called SunCalc to generate a list containing the datetime stamps of when we want each photo taken based upon where the sun will be in the sky. I chose times around sunrise, sunset, when the sun is at its highest point and a few times I thought might make for good photos. It’s lucky for us that this window looks due west so the sun sets within the field of sight. The list is stored in a sqlite database file.

A python script is run every few minutes to query the database to check if any photos need to be taken. When a photo is wanted the script continues to;

  • Take a photo and send a high quality copy of the photo to a backup server
  • Reduces the photo size to suit the size used by twitter (1200px wide x 576px high)
  • Add a watermark to the image (our logo and the twitter handle)
  • Post the image to twitter along with a label and the date and time in UTC (rather than switch between GMT and BST). This allows you to use twitter’s search to see photos from particular days and events, for example: “20190514 sunset kent
  • [code still to be written!] Generate an animated time lapse from the photos

We hope you enjoy the ViewFromRoots and if you’re on twitter say hello 🙂

PartApproximate cost
Raspberry Pi 3B+ [link]
(This was spare from another project. A Pi Zero W for around £13 would have worked just as well)
£34
Raspberry Pi Camera module
[link]
£24
ZeroView camera mount [link]
Finding a way to mount the camera to the window was a challenge until I found this suction pad mounted circuit board.
£7
A case, a long camera cable, memory card and other sundries I had spare from past projects£30
Approximate total cost£95