Archive | September, 2018

Level shifting NeoPixels for Particle Photon

14 Sep18

Level shifting NeoPixels for Particle Photon

I just miscounted how many GPIO pins I had for a project, so I had to find a way to save some pins. In this project we have a status LED that is either red, green or both (producing a somewhat orange color). I need 4 of these per Photon, so that's 8 pins. What about using programmable ws2812, sw2812b or SK6812 LED's?

They only need a single pin to drive many LEDs (NeoPixels is just the marketing name that Adafruit apply for all of these), so I can potentially save up to 7 pins, but also make other colors than red/green possible. Surely enough, I had some of these floating around from a former project.

For my Bitmart marquee sign I used maybe 90 of these, but I kept having bugs causing random flashes if I pulled too much power. Back then I used a 74HCT125 for level shifting, but I couldn't find either that or the 74AHCT125 variant in my component shelves. I did however find some 74HCT245 deep down in a drawer and surely enough - these are what is perferred for driving these programmable LED's in the Teensy community. Both will do the job!

I plugged it up and it worked perfectly! No glitches, just perfect timing. From the datasheets, the 74HCT125 and 74HCT245 looks to have very similar characteristics, but the first shifts 4 lines and the other shifts up to eight lines. The one I used in the Bitmart-sign was just one I found in a shelf at Bitraf. Maybe that one was damaged? Hmmm. I'll have to revisit that project to fix the glitches, but for now I've solved my problem.

I had a hard time locating pinouts / connection schematics for these IC's so here they are for use with Particle Photon.

Connecting Particle Photon to NeoPixels using 74HCT125

Connecting Particle Photon to NeoPixels using 74HCT245

Yellow wire is data out from the Photon. Purple is the level shifted data signal. Red is 5V. Black is GND. Do not omit the fat Capacitor that feeds the fast PWM LEDs.


Easter funtime with KiCad

06 Apr18

Easter funtime with KiCad

This Easter, my 17 year old son got sick for the last days of the holidays, so we left the mountains were we usually stay. All of a sudden had a couple days of spare time, so I sat down and made two PCB’s that I had been thinking about for a while!

The first is a huge 8x8 LED matrix made with 10mm LED’s. Every year at Westerdals ACT where I tech Embedded Systems, the students have a hard time understanding how these work, so I made a BIG one that I can pass around for them to understand. Each row and column has a switch, so they can easily toggle between GND, 5V and having that line controlled by the onboard ATMega328P. When controlled by the MCU, it’ll scroll a text. By turning a potmeter, the code will run slower and slower so that you eventually see each single line in the Matrix light up. I also added a button just in case I wanted to change the program or so. The parts for it arrived in just two days from Farnell and I orderd the board from PCBWay. It should arrive in about a week. Here's how it looks in the KiCad 3D view:

Persistence Of Vision research

I love how we humans use the slowness of our eyes to display pictures. For a long time I've wanted to make a board where I can use the programmable and tiny APA102 LED's (that Adafruit sell as DotStar) to produce POV imagery. For this board I wanted to try out a lot of things that I haven't had time to play with. I have a Lipo charger so the device can both run and charge from a small battery. The APA-102 RGB LED's require 5V and a single cell LiPo battery is anything from 3.6V to 4.2V, so I needed a Boost converter that only works when the battery has enough voltage. If not, the LiPo battery will drain and eventually it'll puff up and get destroyed. The setup I use should have this covered so that I won't need to disconnect the battery. The Microcontroller I'm using is one of the cheapest STM32's I could find that still has USB support. It's super tiny!

How tiny? Just look at the match I added for scale and the dust between the legs of it! The micro requires 3.3V so I needed to add that to the board & I've also added a Hall sensor and two Phototransistors on the board to input various data. Can't wait to get these boards and start writing the software! :-D


Embedding myself in devices

19 Nov17

Embedding myself in devices

This blog's been a litte dead the last year as I've been head deep in two big projects in addition to teaching more than before at Westerdals ACT. I'm not dead and I'm having a blast!

I'm doing exactly what I want at the moment and I feel that I'm creating really good stuff.


For the two brothers Simonsen, I'm creating the electronics and software for their Røst coffee roasting machine. It's a beautiful machine that has already won a RedDot Award for the design and "Best New Product" in the technology category at World of Coffee in Budapest. The software and electronics is controlling fans, brushless motors, stepper motors, super high precision temperature sensors, gas burner, spark ignition, capacitive touch screen, encoder, sensors and has a host of safety features. Read more about the machine here or check the video below.


This project I've worked on for almost two years by now. Imagine you're at a festival and need a beer. There's always a beer-line and the guy in front of you will always wait until it's his turn at the bar to start planning. Wouldn't it be nice if the bar had glasses ready and they started tapping the second you hit the BUY button on your phone?

What we've managed with this project is to take the already great BottomsUp system (taps a beer in 4 seconds!) and added an ordering system via an App. The App talks to a controller box under the bar that can remote control the entire tapping system. From you click the Buy-button until you have (up to) 6 beers is just 5 seconds - including payment! This has been a blast to develop and it's now ready for the masses. You can see an older version of the system in action here and this is how the (injection moulded) box now looks after 3 iterations.

Westerdals ACT

Four years ago a friend told me to apply for a job teaching Embedded Systems at Westerdals Oslo School of Arts, Communication and Technology (or Westerdals ACT for short). At that time I felt a little under-qualified, but they really needed someone to do the course. I said yes and over the years I've found that I'm certainly just as qualified as many of the other teachers. I built the course so that it's one of the most complete Arduino courses there is. It's 12 weeks with 4 hour lectures each week that takes the students from complete noobs to someone that could make a simple prototype for a project. I try to cover all the basics whitout going too far into the details, while covering all the things I think will be useful for them. One of the last lessions we have a PiDay where we go through some of the same projects in Embedded Linux, so they get to try it from that side also.  I've now done the course 7 times and the students love it!

Last year the school asked me to build a second course that builds upon the Embedded one. The topic is Machine to Machine communications and briefly said - it takes the prototypes that the students learned to make in the Embedded course and teaches them how to connect them to the cloud. We go though lots of cloud related technologies, play around with radios, communications protocols and build complete M2M networks. I score very well when the students review their teachers each year and I really enjoy the interation with the students. I've always loved presenting and teaching, so I think I might do more of this in the years to come. 


Anyone knowing me will probably know that I don't just have my office at Oslo's biggest Hackerspace, I also help organize it. I'm no longer in the Board, but I maintain our contact with the landlord (Olav Thon) and make sure things "just work" in general. Bitraf is a Do-ocracy and it's amazing how well this works even if there's just a few people doing things. Bitraf has grown from a 20 ppl Hackerspace with coworking (130 sq/m) to a massive combined Hackerspace/Makerspace/Coworking space with 250+ members and several events each week (now with 950 sq/m space). Back when we started, we dreamed about getting a laser. About two years ago I purchased one and last week we just received our second laser cutter. We now have 2 lasers, 4 CNC's, 2 lathes, complete SMD workstation, huge workshop, a sewing room, a chemistry/bio room, seven 3D printers, all the hand tools you'll ever need, lots of workspace for projects…

It's just grown really well organically and only with members funding it. We have done this completely without government grants, so I'll do a writeup on how to run and fund such a space soon.



Playing with LoRa radio

30 Jul16

Playing with LoRa radio

I've played around with different radio technologies the last year. Some are cheap, some are expensive, but most of these have a fairly short range. LoRa is different and well worth checking out! Here I'll go through the dev-boards I used, power usage and what range you can expect from LoRa radios.

A little different history

LoRa is a spread spectrum technology jumping between frequencies is at the core of the technology. Looking at the history of this technique, you'll discover that one of the inventors stands out by being a female Hollywood Actor! Hedy Lamarr developed this technique with a friend (who was a composer!) to prevent the Germans from jamming the Allied torpedoes in WW2. Not shabby?

Radios based on the techniqe have been available for some time, but they have mostly been used by military and niche businesses.

Availability and pricing

There is a lot of LoRa dev-boards out there. The castellated modules from Hope RF are nice and you can get these separately to build your own board, but I always have a preference for Adafruit when playing with new technology. It just makes things so much easier since they excel in doumentation and quality.

The Adafruit LoRa boards are $39 a piece and you can choose between 16Mhz 32u4 or 48Mhz ARM M0 microcontrollers to control the radio and do I/O. These come with a voltage regulator that switches automatically between exernal USB power and the builtin LiPoly battery charger. If USB is connected, it will use this to both run the MCU+radio, but also to charge any connected LiPo battery. Very convenient!

Test setup

For my test setup I used 2500mAh LiPo batteries and these lasted much longer than I had expected! For convenience, I stacked a 15x7 led matrix shield on the first radio. This one was just plugged into a 400 hole breadboard and I taped the LiPo battery underneath the breadboard. This made for a nice and fairly compact package that I could hold in my hand while walking. The output on the led matrix feather was the dBm received from the stationary transmitter.

The other radio was put on a protoboard for some testing of basic sensors. It was then put into a waterproof project box with a transparent lid. After some testing, I've now drilled a hole for the antenna on this one. Its a 10 dBm penealty to enclosing the antenna in such a plastic box. That's quite a bit more than what I expected, but easy to fix.

I used basic whip antennas made with solid core copper wire. I experimented with using half-wavelength antennas (15.59cm) but cut this down to 7.79cm as it produced a better signal. I used the excellent Radiohead library and set the radio to the recommended 23dB power setting. The software was the server/client sketch with a modification to confirm that the radio did indeed receive the full text sent by the stationary radio.

What kind of range can you expect?

I've tested 315Mhz radios before but they have rather limited range, so I was expecting more from the LoRa radios despite the higher frequency. I had seen some claim 20 and even 50km in some cases, so I was curious to see what I got.

My first test was just leaving one radio inside my house and walk around. From this, I got about 300 metres of range, provided that my house was in sight. Not shabby? If there was something big blocking the radio, no signal got through.

The second test was placing the radio on (fairly high ground) outside a local school. First with the antenna inside the enclosure and then with the antenna out through the enclosure. I was quite disappointed with the first of these two, but as soon as the antenna was sticking out and had free sight it looked better.

I went for a walk to a local petrol station a few kilometers away and kept checking the radio status. When measuring in a straight line, I got 1.8km of reach until I lost the signal. During this distance, the radio never got a partial message. It got the full text always. I walked a road further up when going back and that gave me a better signal overall.

I live in a small town with up to 6 storey buildings. In this area, the signals bounced a bit between buildings but you can't expect many kilometers in such a setting. 2-300 meters is more realistic, unless you manage to place the radios really high up on the tallest building.

How about battery use?

This is the part that impressed me the most. These things are really not using a lot of power. None of my tests tried to conserve power in any way. I sent a signal twice per second and I blinked the LED on the server on each transmit. The receiver had the 15x7 LED matrix, so I expected this to drain the battery quickly. To make it last a little longer I only lit the display for 100ms after receiving a transmission. I expected maybe 3-4 hours for this one, but it lasted 12.5 hours before the 2500mAh battery drained. Not shabby?

The server is a different story! It transmitted for 71.5 hours(!) on that single 2500mAh LiPo. This really wasn't expected at all. I presume that by just turning off the LED and transmit just once every 10 seconds, I can make it last much, much longer! Then If you start playing with putting the entire microcontroller to sleep… My intent is to play around with solar charging next, so this could become something that keeps running for a very long time.

Final thoughts

I think there's no need to doubt that these radios can reach tens of kilometers given the right conditions. The ideal condition would be free sight to the receiver, so you need to get the radio high up on a house or a radio tower if you want to go really far. They were surprisingly solid and never skipped a beat. They work well in office buildings, so they could be well suited for sensors in a building where WiFi is spotty. I'm really looking forward to using these when teaching the M2M Communications topic at Westerdals this autumn!

90 RSSI at Kolbotn Church, 750 meters from the transmitter. Some nice Pokemons there as well. Pokemon Go goes really well with radio testing!


Milling 2-sided PCB’s

08 Jan16

Milling 2-sided PCB’s

Before xmas I did a lot of PCB milling for a client. Compared to getting the PCB's commercially made somewhere, this is the equivalent of rapid prototyping for circuits. Getting a board produced in the UK, Germany or Asia will typically take at least 2 weeks (but often 3). If you can reliably produce 2-sided boards using a mill, you'll iterate and find errors faster.

Milling is a lot cleaner than etching and you really don't want to hand-drill several hundred holes on an etched PCB. Getting perfect results every time took a bit of learning though, so I thought I'd describe my process for 2-sided boards here so others can use it.

Preparing the PCB

Unless I need components that only exist in Eagle, I make my boards using Fritzing since it's quick and it has a great UI (compared to Eagle). Fritzing allows me to export both Gerber files for production and SVG files for home etching or milling. Fritzing is super easy to work with so I won't go into details on it, but here's some things to keep in mind when laying out the PCB.

When creating the layout, set the PCB to be the exact sub-millimeter size of your PCB milling blanks. Don't be tempted to use a smaller size in the PCB design software since "you won't need that much". This will only give you headaches. Remember that using the size of the PCB blanks, you can easily add some cutting lines, so that when the PCB is perfect you can cut it to size. If you don't do it like this, you can't flip the board precisely enough. Trust me - I've tried and failed many times. It's just not precise enough.

Many components in Fritzing such as via's offer select a Home Etched version that is larger and easier to work with if you make the board yourself. You can also tweak components such as headers to be easier to mill.

One thing that isn't obvious is that on a home-made board, it's much easier to place components on the top and solder them all from the bottom of the board. Professionally made boards have through-hole plating so all holes are connected from top to bottom, but you won't have this so all solder points should end up on the bottom in some way. You can still place traces on the top layer, but you'll have to take them down to the bottom using a via for soldering. Don't forget that rotating components makes a world of difference when laying out the PCB. If you manage to get the top layer as a solid ground plane with no vias, you're saving a lot of manual labor.

A via for a homemade PCB is basically just a drill hole in which you solder a wire connected to both sides. Make sure to set the via to be large and not the tiny default used for professionally produced PCBs. This makes it much easier to solder them later.

It took some iterations to get it right…

Use the widest possible traces that will fit with the connectors and other components in your PCB design. The standard is to use 24mil traces. As we'll be milling along the outline of the traces, so by using 32 or 48mil traces, you can run your mill on the outlines and still have a trace left. Alternatively, you can widen the traces in a vector editing program later, but I find it easier to do it straight in Fritzing.

The next important step is exporting the files (Export > For production > Etchable). This will export files for the silkscreen, paste mask, etch mask and copper traces. We only need the copper. What you'll want is the "Copper top" and the "Copper bottom mirrored". If you select the wrong files, you'll have to redo (or mount the components on the "wrong" side of the board). I suggest that you print out these files on paper at 100% size, glue them together and cut to size so you get a "dummy" PCB before milling. Place your components onto it to see that it's all correct from both top and bottom.

Preparing the output for milling

The exported SVG files will still need some "massaging" to work well. I use Adobe Illustrator, but you can also do this with free software as Inkscape. It just takes a little longer. First go into outline view so you can see any objects that the PCB software has placed two of. It's quite common that square pads have a circular outline under them so clean this up.

Then merge all the vectors into solid shapes so that we can follow the outline to cut the trace out. Remember to copy the holes onto a separate layer before merging, so you have what you need for drilling the holes. I usually use the "Outline stroke" feature to turn lines into fills and then I'll use the Pathfinder panel to Unite all the connected/overlapping vectors. Illustrator does this in seconds, but Inkscape can take 15 minutes for even simple boards.

When you have all the shapes merged into solids, you can move the file to your CAM software. At Bitraf, we use VCarve but all you need to do is to set up paths and drills based on the vector file you've made. I'm using a 90 degree V-bit for the traces and all I have to do is to follow the outlines and cut just deep enough to break connectivity. For the holes I use 0.8mm drills or 1mm if I'm to add through hole rivets like these

Now that we have the files ready, it's time to move on to the milling. For this project I used the huge Shopbot PRS Alpha that we have at Bitraf, but the process will be identical for any other mill.

How to make a good Jig

The entire secret to getting two sided PCBs perfect is to have a good "jig" - a setup that ensures 100% identical placement on both sides. I made my jig using a scrap piece of High Density Fiberboard (HDF) but you probably use can use many other materials for this.

- Fix a piece of fiber board blank to the drilling surface. This will become our jig. It should be somewhat bigger than the PCB itself.
- Use a mill to by mill away a millimeter or so of the surface. This will compensate for any deviations when mounting the fiber board blank and ensures the surface is 100% planar.
- If your PCB is 1.5mm thick, mill a pocket for the PCB that is a little less than the thickness of the PCB. I used 1.2mm, so the PCB was only sticking out a tiny bit. I made the entire pocket 0.05mm wider than the PCB and that gave me "push-fit".
- If you're making many copies of the PCB - mill a hole on the side of the pocket that is big enough for your finger, so you easily lift the boards out.
- Put the PCB in the pocket and make either a full frame (slightly smaller than the PCB) or use some small wooden pieces that you the fixate the board with. Don't over-tighten as that can cause the PCB to become slightly bent giving you uneven

With this technique, your board will be 100% in the same place when you flip it around to do the other side. On the boards that I make now, I cannot see any sub-millimeter deviation from one side to the other.

I initially tried tape/glue rather than milling a pocket. The result was that I bent the boards ever so slightly and that caused some traces to get uneven widths since the mill went deeper. This approach of just holding the board down solves this.

The finished jig with Polycarbonate pieces to hold the PCB down during milling

The importance of having identical blanks

For the jig to work well it's extremely important to have PCB blacks of identical size. Initially I was unable to find suitable size PCBs at my local electronics store, so I picked of some boards that were twice the required size and cut these in two. Despite using the mill, I didn't get these to the exact size and it bit me later on. I waited until my supplier had restocked and then this was no longer an issue.

Signs that something's wrong

Cutting 0.18 into the board should isolate the traces when using a 90 degree V-bit. If more is required, check alignment of the board in the jig! Twice I've spent hours on milling just to get the other side of the board wrong. Always start with the drills, then the layer with the least amount of traces (usually the top layer). This will give you the shortest route to seeing if things are correctly set up. Alternatively, do the drill holes from both sides to verify that they align.

I hope this helps others making two-sided milled boards. If you use the instructions, feel free to email me a picture of the jig & result?

Project: Makeblock 3D printer

13 Jul14

Project: Makeblock 3D printer

Up until now I've had two 3D printers. My first one was the Ultimaker Original and it now has more than 4000 hours of printing behind it. An incredibly solid machine! The next printer was the Printerbot Jr that my son put together. I haven't seen much of it as he's more or less confiscated it, but it's been a great investment into making him try out some real engineering.

The Ultimaker Original is probably the best Open Source 3D printer available today. Now I've built a third printer from scratch, using the Makeblock aluminium extrusions that I've become quite fond of. You can find the build log here, but why did I want to make a new printer?

Makeblock advantage

When you are making a printer based on Makeblock it is really easy to adjust the design as you go. It's also easy to add new elements when you need it. Not only that. When I at some point retire the printer, I can re-use all the Makeblock parts for something else! Makeblock was started as a Kickstarter and they really listen to their customers.

Less hassle!

The single thing that takes the most time for Ultimaker owners is clearing out blockages. They don't happen if you're careful, but every now and then you'll forget turning off the extruder and the heat'll sneak up the pipe to cause a block. When blocks happen this far up in the extruder, it'll take 10-15 minutes to clean it out. The new all-metal hotend from e3d & extruder design solves this completely and changing filament is done in a snap. Over all, I'm REALLY happy with this!

Polulu DRV8825 FTW!

I'm using original Polulu DRV8825 stepper drivers. This gives me 1/32 stepping that is noticeably more silent than the typical A4988 drivers with 1/16 stepping. These are also more powerful, but in reality I'm not using that advantage. If you have a noisy printer, be sure to check this video for a comparison. They're a direct replacement for 4988's on most Reprap hardware, so odd are they'll make your printer more silent too.

More space

The new printer has a bigger print area (31 x 31 x 34 cm). This was one of the goals of the printer and I'm very happy that I managed to go even a little bigger than anticipated. For comparison - it's 32600 cm2 are more than 4 times the volume of the Ultimaker (7700 cm2). It makes levelling the bed a little harder, but it's totally worth it just to have the ability to print larger objects.

More materials

I've changed the design to a Direct Drive Extruder that takes up less space than the original design. This allows a second extruder to be added at a later time. A Direct Drive Extruder it has one major advantage over Bowden-based systems: it supports virtually all the materials I want to experiment with. Flexible plastics, nylon, wood, clay, bronzefill and more. The current setup allows the extruder to go to 300C. With modifications, I can go all the way up to 400C if I want to.


Using Makeblock makes the entire design flexible, but the compact extruder design itself is also quite flexible. One addition I'm working on is adding Dual extrusion as in this video. It's the best approach to dual extruders I've seen to date, so expect an update when I get this working! The design allows me to easily swap out the print head fairly easily so I can play around with extruding chocolate and other fun materials.

So - all in all I'm very happy with the printer! All issues are now resolved, so the design phase is complete. Only minor tweaks remain & the BOM is now online at For now the page contains links to resources & the bill of materials, but I'll also add build instructions to it later.

But - I've got more plans! My Ultimaker with 4000 hours of printing on it's back will soon move to Bitraf and in November I'll (hopefully) receive my first SLA-printer - the Titan 1!


Project: wifi-enabled RGB LED displays

08 Jul14

Project: wifi-enabled RGB LED displays

Every now and then there's a project you can't say no to and this was one of them. is sort of Norway's version of Craigslist, a big online market where you can sell just about anything. As a marketing stunt, they opened a physical store downtown Oslo. I was called in via some friends in the agency that handled the project and they needed lots of things quickly. Since I was fully booked, I couldn't say yes to all the projects suggested so I passed some of them to my friend Thomas Winther who did a great job making an in-store Selfie-app using Unity & LeapMotion.

In the store they needed a way to show information from the website and this was the job I couldn't say no to. Apparently it isn't very easy to get hold of a wifi-enabled LED display that can pull data from the web? Also - most commercially available displays are small, monochrome and use tiny LEDs so they're not that visible when mounted high up on a wall. The agency wanted 5 large displays, perferably with more than one color display. Having recently read about Teensy 3.1 and the OctoWS library I promptly said I'd do it!

The Teensy microcontroller is a great alternative to using Arduino's in installations. It has a really fast ARM processor and lots of RAM, but it is still 99% Arduino compatible. This means that pretty much all Arduino code will run on it, but at blazing speeds. After installing a little extra software, you can use the normal Arduino IDE to program it, so it's really an "Arduino compatible". It's so compatible (and affordable @ $20!) that I feel that this is really the path that the Arduino Team should have taken instead of making bigger and more complex boards. Here's how the Teensy 3.1 looks next to an Arduino Nano. It's soo tiny that the Nano looks big!

For the parts, I could have saved some money by picking it up from different places, but I didn't have much time. I picked up tons of Neopixels & Teensy's from Adafruit since they'd ship the parts so I had them within a week. Buying parts from Adafruit really makes a difference since the whole process is completely trouble free. It's a little more expensive, but worth every dollar.

This is how the test-display looked when running the rainbow sketch:

Lovely, isn't it? You can see the neopixel strips lying in front. I stuck these to the back plate using the same clear silicone that I used to fix the panel to the front. The first test showed that we'd have to compensate a little for every 50cm as the neopixels are put together of 50cm segments and loose a few mm in the overlap between these.

Thanks to Jens Dyvik at Bitraf, making the wooden parts was short. Jens is really good at Rhino and CAM software, so the process from sketch to finished product was really swift. His huge Shopbot CNC'd all the lattices and backplates in one go! Nice to have good tools, right? Two things to note about the CNC'd parts:

  • When using MDF as material, make sure each protuding part has a certain minimum size or they'll break off easily.
  • Research carefully what kinds of silicone that will remain fully transparent over time. Most clear silicones will get a yellowish tone over time. The ones that are made for aquariums appear to be the most suited ones.
  • When exposed to heat for a long time, MDF will want to "bend". Make sure you stick it down properly to avoid too much maintenance.

Soldering and gluing together the displays took quite some time, but it was made a lot easier by Paul Stoffergren releasing these neat adapter boards. I added a 2.4Ghz radio to each of these and tucked it away on the back of each display. Here's a photo showing 1920 pixels running at once. Note that the Mac to the left is on full brightness! The displays are so bright that they're visible in daylight as well.

Each sign requires quite a bit of cable and with the amount of current going through them, this was the first electronics project I've made where I've had to calculate the correct diameter of each cable. A good learning experience!

I could have built a Wifi adapter inside each of the displays and in hindsight, that would have been an easier choice if it wasn't for wifi issues. What I went for instead was a server-client solution where a single box would connect to the internet as well as serve up a webserver that could be used to control all the 5 signs. It has a Teensy 3.1 that holds a custom webserver, uses cable for internet access, has a display that shows status and the IP address of the webserver as well as a nrf24l01 radio (2.4Ghz) that sends data to the signs. This is put together in a nice 3D printed box that is wall mounted.

It's a pretty versatile solution and it works rather well. There's two drawbacks to this solution:

  • The NRF24L01 radio's are dirt cheap, but they have a limited range and are affected by other 2.4Ghz radios (bluetooth, wifi & more)
  • The Ethernet library for Arduino is a synchronous API. When the device fetches data from the internet, it'll freeze a short while until the data is received.

None of those issues are big problems, but they're worth noting if you are building something similar. Initially I planned to use a Raspberry Pi to be the webserver, but it turned out to be really hard to make the NRF24 radios work reliably with GPIO on the Pi. I've since noticed that the NRF24 dislikes fast CPUs, so if you're trying to make this readio work on the Pi, make sure to add a delay to your main loop. The Teensy 3.1 is also too fast for this radio.

The final result is that you can use any device such as your phone to control what is displayed on each of the signs. I've also built some remote admin to it as well. Every time the displays power up they'll await instructions from the server. The server fetches API data such as how many tractors are for sale or what are the latest boats available, and sends this to the displays. It's super flexible and a true IOT solution.

Disregarding some (serious) mounting issues beyond my control, I really loved solving this project and you can check it out if you're in Oslo. 


After making this, my wife said that I should start making and selling these commercially. It's probably a good idea, but I really can't see myself selling LED signage. However - if you have some weird project in the Internet of Things domain - feel free to contact me. I love a good challenge!




Making a scale for Arduino with INA125

03 Jun13

Making a scale for Arduino with INA125

For the recent project I did at EIS (The Energy Centre at Hunderfossen Amusment Park), I needed to build a scale. As kids walk around the exhibition, they're answering questions and at the exit there is a cool-looking scale. Here you select felt-bags based on your answers and their weight decide if you got the earth (or rather scale) in balance.

I picked up a couple Load Cells from Ebay and thought they were like the many other analog sensors that I've used. It turns out that a Load Cell does output a signal, but it's really weak. To get the signal I needed, I had to find a suitable "Load Cell Amplifier". After some quick searching, I realized that these come in many flavors and industrial versions are somewhat expensive ($200 and upwards). I did some more digging and found this nice little board from LeoBodnar as well as a nifty IC: the INA125. This is an IC that does exactly the required amplification for $7.

The premade board was nice and easy to mount, but I wasn't happy with the resolution I got from it. Since it has no adjustment options, I'd have to read up on the IC, get the correct SMD components, desolder and resolder. It seemed easier to build the circuit myself and with this great article as a guide - this is the circuit I made:

My Load Cell has other colors, so signal+ cable is blue, signal- is white, 5V is red and GND is black. I've seen load sensors with colors all over the spectrum, so make sure you have this documentation before buying from Ebay. Later this week I'll head up to the Hunderfossen Amusement Park to mount this modified version that gives me pretty much all the levels I want by just changing a single resistor. Not bad!

The image at the top is the finished version with screw-terminals on a proto-board (click to zoom). Below you can see how the scale looks like up at EIS:



Project: pressure sensitive floor

28 May13

Project: pressure sensitive floor

I just came back from the most challenging physical computing project I've ever done. It's a 13 by 8 meter labyrinth where you walk in the dark and get a sensory experience based on more than 300 sensors. The main challenge was actually how much time it took to execute it, but it was such a fun project that I didn't really mind. You can now try it out yourself at Energisenteret in the theme park Hunderfossen (Troll-themed!) near Lillehammer, Norway. I don't know for sure, but I think this is the worlds first "pressure sensitive floor"? (video further down)

I've worked on several projects with the company SixSides and about a year ago, they asked me if I could build a floor that reacted to the people walking on it. The basic idea was to play back sounds of walking on other surfaces than you really were. Of course I said yes to the challenge!


My first idea was to make a button-matrix that sensed where you stepped, but after making a quick prototype I realised that this wouldn't create a very believable experience. Then it dawned on me that it would be MUCH more fun if it was actually pressure sensitive. During this project, I've played around with different conductive fabrics and it's been a blast! I really cannot praise the company PlugAndWear (Texe srl) enough. They're simply the best source of conductive fabric that I have found and they ship crazy fast from Italy to Norway (2 days!).

This is how you'll receive 14 meters of conductive fabric!

One of the many products they have is called Velostat. This material has a very unique property - it's resistance decrease with pressure. It does so in a way that if you just put a layer of Velostat in between two conductive layers, it will give you about 800 levels of pressure for an adult person stepping on it. If the person weighs more than 90Kg, you will most probably be able to read out the remaining 200 levels using the 10-bit analog inputs of an Arduino.

So I knew that Velostat was a good idea, but I needed a conductive layer both at the bottom and above and one of them should perferably lift up to ensure that there was no contact if pressure was not applied. Copper tape is a really good conductor, so I figured that I could use that as the bottom layer. It is easily taped to the floor and you can solder onto it quite easily. You can get this at multiple locations. I found mine at a shop for artists that make glass paintings.

The upper layer was more difficult. I eventually settled for the fabric called "Doubleface knitted conductive fabric" that has a polyester-thread layer and a stainless steel-thread layer that are knitted together. In my tests, this has stood up to quite a bit of physical abuse so I'm pretty sure it'll last quite long before being fully compressed. The only drawback of such a fabric is that it's really hard to work with, given how different these two layers and velostat are. I tried sowing these together, but it was incredibly hard to get the fabric to stay straight.


After settling on Velostat and the knitted fabric, I started prototyping and this is what I ended up with:

I tried various methods for making the sensors, but the most lasting solution seemed to be using textile tape from Tesa. Just tape together a layer of the knitted fabric ( with the steel side up) onto the Velostat. My only problem was of course that this was a manual job and I needed 300 of them. More about that later.

Above the sensors there were to be a floor of some sort. I did my test using Linoleum, but we ended up using a softer floor covering. I also used Fritzing to make a custom PCB for this (download below). It's not that it was really required, but it made the installation look professional and simplified the mounting a lot.


Since my prototype was just one of the 7 strips required for a full meter, I really had no idea how much work was required before I started. I ended up spending two full weeks (14 hr days!) on making two 1 by 3 meter floors. This is how the process looked like:

First add 4mm plywood to put the sensors on, making a sort of cable-duct in between them. This ensured that the soft, silicone-covered cables were not too exposed to the constant pressure of people walking on them.

Add the copper tape…

Solder the copper tape to the 5V output of the Arduino Nano's…

Connect the cables to the analog inputs of the Arduino Nano's…

Mount the handmade sensors and secure them to the floor with two-sided tape. Then connect the analog input cables (using the grey tape) and repeat for another meter…

After this has been done to the entire floor, I put sounds on the SD cards, programmed the Arduino's with their sound-cards and mounted them along with some suitable speakers.


I'm really happy with the result! The finished floor is so sensitive that I can sense a soda-bottle cap falling onto it! The sound playback happens the instance you put pressure on the floor and it really seems like you're walking on ice or other things. Selecting the correct sounds is of course a difficulty, but it's easy to adjust this. It's just files on a SD card after all.

I've also written the software so that wear'n'tear on the sensors won't affect how the installation work. They don't use the real pressure-level, but rather changes in an averaged level. If a floor tile becomes fully compressed so it no longer produces level changes, you can just rip it up and tape down another, so maintenance is easy.

The floor consists of 40 strips of 15 cm width, each with an Arduino Nano measuring up to 8 sensors. The complete installation is using 55 Arduino Nano's as well as sound cards from Gravitech. I opted for these since they're small and thus easy to mount. They're also very easy to get replacements for if that should be required.

Lessons learned

During the project I've learned a few things:

  • I now know that I should have used a much wider copper tape rather than three separate ones. Each one of these needs a soldered joint. Having just one rather than three, would have saved me 600 solder points and it would have been just as good.
  • Another thing I've learned in the project is that building a small prototype really does not cut it. You need to build a bigger prototype to correctly estimate the amount of work required. In the end I spent about 16 hours on each meter of pressure sensitive floor. My estimate was just a third of this, so since this was a fixed price project I didn't exactly become rich. If I do a similar project, I'll definitely insist on hourly pay or get somebody else to do the actual construction of the floor.
  • I'm using .OGG formatted files. MP3 files will add a few milliseconds of silence at the start of the sound and in this case, it ruined the experience. The OGG format does not have this problem.
  • The next time I design electronics that require multiple similar resistors, I'll definitely look into using a resistor-network instead.
  • Plan ahead for the carpentry and expect lot's of adjustments as the project progress…
  • Making the pressure sensor tiles took forever… Help is required if you do something like this, so a big thank you to Liv @ Sixsides for helping me out!
  • As soon as the walls are closed, it's a lot more work to get cables to the right spot, so make cable ducts that are wider than expected.
  • Arduino's are really solid for use in installations, but poor quality USB cables will affect both sound and stability.

Despite taking a long time, this has been a fantastic project! I really loved to do the whole thing from concept, research and realisation. It's so many other things one could use such a floor for, so I can easily see people building similar things as inputs for games and music. It also involved lots of other sensors (touch + distance + movement), but I'll do a separate post on those at a later time.

If anyone is interested in such a floor, I also have several ideas for how to simplify and industrialise the production of such floors, so feel free to contact me :)


Custom PCB’s with Fritzing

27 May13

Custom PCB’s with Fritzing

If you've played around with Arduino, you have most probably seen these nice and clean images of circuits that have the Fritzing logo on them? Fritzing is a PCB design program that I really enjoy working with. It's visual, intuitive and very easy to get started with.

At Bitraf (the hackerspace where I have my office) most of the other electronics geeks have a preference for CadSoft's EAGLE PCB design software. It's an impressive program, but it's also one of the least intuitive pieces of software that I've ever used. It's made by engineers - for engineers. While I have an engineering education, I'm not designing enough electronic circuits to feel comfortable with Eagle.

I've now used Fritzing on three different commercial projects and I'm quite sure I'll use it on many more. Here's one of my breadboard prototypes, with the finished PCB from Fritzing (the white board) to the left of the breadboard. As you can see, it simplifies the prototype quite a bit:

I did this project for my friends at and you can now view the installation at Oljemuseet in Stavanger. The plan was to make a PCB with a LED driver chip that could drive 2.3" segments. We only needed 7-segments, but we loved the colors emitted by these that can be bought from Evil Mad Science. They also had suitable MBI 5026 driver ICs and we love Evil Mad and their work.

The initial plan was to hook up 2 x 12 segments and then use an Arduino to fetch the numbers to display from a web service. The numbers were to constantly show the current number of people on the earth as well as the number of tonnes CO2 released thus far this year. During the project, we switched to using Rasberry Pi's instead since the Arduino network stack isn't exactly asynchronus and that made the numbers freeze while fetching updated data. Was great fun to use Python for a project!

How Fritzing is different

As opposed to Eagle and KiCad, Fritzing starts where YOU do - on a breadboard / perfboard. You just place the components in Fritzing, just as they are in your prototype. This breadboard view (step 1 below) is  unique to Fritzing and it makes it incredibly easy to make professional looking PCB's. The next step (2) is to create the schematic. I normally don't spend time on this unless I need to publish schematics, but I rather move straight on to the third view - the PCB layout (3) like in this example.

This is how the circuit above looks in Fritzing:

(Click to zoom)

I normally route the PCB by hand and it's a really swift process compared to how it's done in other software. Any cable that is connected in the breadboard view (1) must be routed on the PBC (3). If it's not, you will get errors when you run the "Design Rules Check" (DRC). This ensures that your circuit is electronically sound, but it does of course not compensate for human errors. If you forgot to add a connection in the Breadboard view, it will be missing in the other two views as well.

When you're happy with the PCB, you can either export to images (great for showing how to connect circuits), the Gerber format RS-274X (for PCB production) or as PNG/PSD for manual etching. You can also export a Bill Of Materials (BOM) so others can see what they need to build your circuit. Very nifty!

Fritzing Fab

The company behind the Fritzing software also offers a PCB creation service called Fritzing Fab. Here you just upload your Fritzing file, set the amount to order, pay and 10-14 days later you'll receive a white envelope with your own PCBs. These are not the thickest quality available, but they're solid enough for mounting with screws. They're two-layer boards in white with a brown/grey silkscreen and you can put pretty much any graphic you want on the designs.

Since the program exports to Gerber, you're not limited to using the Fritzing Fab service, but if you want high quality and stylish looking PCB's this is a very good option. It's not the cheapest PCB service out there, but I absolutely love these white PCBs. You can order just a single PCB to test a design, so there's no minimum. The more PCB estate you use, the less the price. It's not shabby at all for German-made quality. Another thing that can be a crucial factor when comparing to other PCB services, is that Fritzing can cut the board to any shape, with any number of via's and mounting holes for no extra cost. Other low-price services will not even make mounting holes or break up the boards.

Drawbacks of Fritzing

Anyone that have used Eagle or KiCad will say "Fritzing isn't professional enough" since it looks too simplistic, but that's just plain wrong. The software is very capable with two key exceptions that may be important to some.

  • The Auto-router is just crazy. It can spend forever without finding obvious routes from A to B. If successful, the routes look pretty weird. They're not something you'd be proud of showing to others.
  • While there are a decent set of standard components in the package, there's many components that are missing when it comes to SMD parts. Apparently it's quite hard to design new parts, so that limits people from creating more

There's a couple other minor annoyances as well:

  • It closes the entire program if you close the last sketch
  • I still haven't made an etchable PCB that worked well, but I'm sure that'll improve with time.

For me, Fritzing solves most of my PCB creation, but as soon as I want to use SMD parts, I'll have to change to Eagle. I do however think it's a great software to create your first PCBs with. I've now placed 4 orders with them and I'm sure I'll place many more.

Advantages of Fritzing

For a noob making his/her first PCB, Fritzing is ideal.

  • Great user interface
  • Easy to use
  • WYSIWYG breadboarding to PCB is so much better than making schematics
  • Constantly updated and improved
  • Custom PCB shapes with the Fab service is also a big plus (for me at least)

You can find the Fritzing file attached (Open Hardware licensed). Below is a picure of the final installation of the project that these were used in - mounted inside a big sculpture of the earth.