Archive | November, 2016

Playing with LoRa radio

30 Jul

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! smile

 

Milling 2-sided PCB’s

08 Jan

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 http://www.ebay.co.uk/itm/200x-best-quality-pcb-copper-via-vias-through-hole-rivets-ID-0-8mm-OD-1mm-/321930742366?

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 Jul

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.

Flexible

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 reprap.org. 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 Jul

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. Finn.no 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 finn.no 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. 

Postnote

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 Jun

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 May

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!

Researching

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.

Prototyping

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.

Building

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.

Result

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 smile

 

 

Custom PCB’s with Fritzing

27 May

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 back.no 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.

My first PCB - a DS1307 based realtime clock

14 Mar

My first PCB - a DS1307 based realtime clock

The last months at Bitraf has been quite hectic in terms of workshops & activities. First there was a soldering workshop that I helped put on, then a PCB design workshop and that was followed by a PCB etching workshop. I also organized our third 3D Printer Meetup there. Peter, Trygve and Carl at the hackerspace has now gotten my dad's old Roland CNC to drill all the required holes in a PCB based on the Eagle files, so it's really possible to make nice things at Bitraf these days.

My first PBC, an RTC for Arduino

When an Arduino looses power, it's clock will always start in 1970 when it gets power again. For a client project I'm working on, I needed the correct time after a power outage. It was easy to find several RTC's online and they all cost something between $5 and $10. My problem was that getting it fast would be expensive and I happened to have the most used IC for this purpose. The DS1307 used in most of these modules is about a dollar each and the remaining components are not much either. Here's the Bill Of Materials along with links to where I bought them:

1 x DS1307

1 x 32.768 Crystal

3 x 10k resistors

1 x 104 capacitor (0.1 uF)

1 x 2032 battery holder

2 x 6-header pins

All together this is about $2 in parts, even for a very modest volume. Not shabby and I highly recommend both TaydaElectronics (Thailand) and Spiratronics (UK). Both are great shops that ship quickly to places in Europe and I use them a lot in addition to ebay.co.uk.

Designing it

I looked online, but couldn't find something that others had made that was "free to use" and I had an idea: why not make it plug straight into one of the header rows on the Arduino? That way it would be real plug-and-play since both power and the analog pins used for i2c are on the same side. Above you can see how this turned out - it plugs right into the Arduino Ethernet shield.

I looked up the reference design and looked at how others had done it before and then made a first go in Eagle. After a couple fails (I forgot to "fill" with ratsnest + had counted the pins incorrectly) I got a couple nice looking PCB's.

Making it

The etching went really well and with all the helpful people at Bitraf, it's not hard to get this right. I drilled this one manually, but I'll definitely use the Roland CNC as soon as we have a good way to cut consistent PCB sizes. Here's how it looked after cleaning with Acetone:

I didn't have the required clock crystals, but I got these from Spiratronics in just 3 days. Today I soldered it up and plugged it in. Guess what - it didn't work... I looked over the PCB with a magnifier glass and cleaned up some excess solder along the traces and it still didn't work. Bummer. I went online and looked at how Adafruit did theirs and then it struck me - I had put the IC on the wrong side of the PCB.

Using it

After doing this, it worked like a charm! I used the Adafruit 1307 library and it works just as I hoped. I'll definitely make a couple more of these for other projects and so can you! Below you can find the Eagle schematic + board and here's the final stencil to use for the etching.

See more pictures of the PCB etching process on Flickr

Meetup Pocket Sign

08 Mar

Meetup Pocket Sign

My brother is thinking about going back into the signage business and as he would start up his own company, he'll need to build himself a network. My favorite way to connect with people and communities these days is Meetup.com - a website that help you host meetings with ease. So - I set out on a mission to help people remember my brother and what his company delivers.

I've long wanted to do something with the neat little 1.8" LCD screen I picked up from Adafruit some months back and looking through their site I found that they also have this neat Lipo charger as well as slim, matching batteries. What if I made a small LCD-sign that he could drop in his pocket? I ordered the components and started modeling.

About a week later, the parts arrived and I modified Adafruit's example file a bit to load images one by one from the SD card beneath the screen. That gave me a simple, but effective slideshow. All my brother needs to do is to to change the contents is to make some BMP images and dump them onto the SD card. Easy!

After a few iterations I came up with this case. The part containing the battery is not the slimmest, but it's also meant to go inside your shirt pocket. I could have made it slimmer, but then I would have to sacrifice battery time. With it's 1300mhA battery pack, it lasts 2 hours on one charge and charging it takes a little less than an hour. I could have saved a little space by skipping the proto-board that lies in between the electronics and the battery, but it made mounting things and getting the USB-port right for charging. I might remove that if I do a next iteration.

The part that is visible on the outside of the pocket is much slimmer and it looks like the red and white Meetup.com logo. It took quite a bit of fiddling to get the case right. I learned that by slanting the print 28 degrees while printing, a lot less cleanup was required.

The supports came off really easy and printing the parts like this actually made them much stronger and easier to glue together in the end. I usually use PLA plastic for all my 3D printing, but for this I used ABS since it can be grinded and polished (PLA can't). Towards the end of the project I didn't quite get the time required, but it was a fairly polished thing I gave away. It took me 4-5 evenings to make this project and I think it was worth it. I could of course have bought a CD or something from a shop, but this was a personal gift that (as far as I know) nobody has. Much more fun!

Here's a shot of junior showing off the final sign and if you want to make your own - grab the files on Thingiverse and components from Adafruit.

A two dollar programmable FM radio

07 Jan

A two dollar programmable FM radio

It's been ages since I posted anything on electronics, even though I keep playing to learn more. I also frequent dx.com quite a bit and a fun little thing I picked up was a $2 radio-curcuit-board. It's a fully programmable FM radio that is 11 x 11 x 4 mm in size. As usual with electronics from China, the website barely says anything about the product. You just have to buy one and see if you can make it work.

The circuit came without any documentation, but Google is your best friend. The datasheet was all in Chinese, but thanks to Google Translate I figured out that this circuit was very similar to many other implementations of the TEA5767 radio chip. These chips all have the same pin-density as ZigBee modules, so I soldered on some ZigBee-headers to make connecting it easier. As you can see from the picture above, my cables were all over the place. Below is a cleaned up sketch of how to connect the TEA5767 radio module from dx.com (click to view full size). The audio amp obviously goes in between the speaker and the TEA5767 output.

The TEA5767 can be controlled using either Serial or I2C, so it's really flexible. It's not very powerful, so you'll need an audio amplifier to hear anything. I used an Adafruit MAX98306 amp breakout that I had from a former project. I won't get any style-points for this setup, but I'm glad I got it to work almost right away. This instructable made the code part really easy. Using a 10k pot to control the frequency also highlighted that more than 10-bit resolution would be nice (for better precision) or maybe one should rather use an encoder? Good learning fun anyway. Here's a vid of it working.