Basic Blink example for dsPIC30F4013

20 Nov

Basic Blink example for dsPIC30F4013

With an Arduino, I can teach someone to blink a LED in 15 minutes. It will always work. In the world of PIC microcontrollers, there's nothing "that just works". To help others trying to make a dsPIC30 family microcontroller do just the simplest thing, I'm posting this mini tutorial including what they expect you to know and what you actually need to know.

The Arduino community has always been a place where newcomers could feel welcome. Even the simplest questions are answered politely and nobody looks down on someone just learning the ropes. In general, it's a very welcoming platform. You just download the IDE, plug the Arduino in via USB and you're already moving. I've now tought microcontrollers to students for 4 years and they really love using Arduino as their first hardware tool. So what's different with the microcontrollers from Microchip you may ask? The answer is simple - everything!

Read more...

Makeblock mBot review

02 Sep

Makeblock mBot review

One of my favorite tools is the Makeblock Robot contruction system. I've actually spent more than $7000 on parts, so you can certainly call me a fan! This weekend I'm hosting a robot workshop for kids and based on former experience, I suggested that we'd use the mBot robot kits. That suggestion has cost me quite a bit of time, so I'll take this oppourtunity to review of the kit to tell what's good & bad.

I sincerely hope that Jasen Wang (Makeblock CEO) and others will read this review and find it a useful tool to improve the product. At it's current state the mBot offering is unprofessional and not a good product.

Read more...

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.

Read more...

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?

Buying a laser cutter for your Hackerspace

15 Nov

Buying a laser cutter for your Hackerspace

At my local Hackerspace, many of us wanted access to a laser cutter. I had plenty of ideas of what to use it for and it's also one of the "Maker tools" that are the easiest to get started with. I started looking at DIY lasers like the Lasersaur project, but I felt like they were above my skill level and a little too big in size for our limited space. Now that we've purchased a laser cutter, I've gotten several questions from friends and other hackerspaces/makerspaces about the purchase process, how well it works and what to look for/avoid when buying a China-laser. Here's some of my experiences.

Picking a brand / model

We tried to save up for a laser that we could buy from a local supplier, but it was simply out of reach. Then I started looking into Ebay lasers. Ebay lasers are 3-5 times cheaper than what the commercial suppliers offer here in Norway. The drawback is that they come without any warranty or support. I gave it some thought and decided that we really needed to have a decent laser @ Bitraf - both for myself and for attracting new members.

I scoured different forums, but CNCZone in special and looked for reviews of China-made laser cutters. After much reading, I opted for a Redsail X700. It has a 700x500mm work area, a 60 watt CO2 laser tube, motorised Z-height and that's about it. They claim a lot of other features like auto-focus, but that's not really true. It can move along preprogrammed X, Y & Z paths and blast a laser that moves at up to 300mm/sec. There is no way to runtime-adjust the strength of the laser. It's on or off, but it runs off a PWM output so you can blast it for shorter or longer periods to "fake" that a bit. Setting the laser power on these cheap lasers are basically the same as setting the PWM frequency.

By comparison - a professional laser can tweak this quite a bit and even adjust the focal point at runtime. Using this, you can do a 2cm deep 3D engraving without leaving the wood burnt. With these chinese lasers you can easily engrave and cut at various "strengths" as well, but it's something you set per object. The software that comes with China-lasers are also extremely crappy, but I'll get back to that later.

Buying expensive stuff from Ebay

I looked around and there's at least 5 companies on Ebay that sells the X700. You won't find them by searching for the RedSail brand though, so search for "60W CO2 laser" and then you'll see the listings. After looking around, I went for the ebay seller CNCCheap. I decided this based on the usual thing you do on Ebay, I looked at the buyer ratings. It turns out that this is highly irrelevant for anything that ships in a container and takes longer than the maximum review-period to arrive. This post is in many ways a review of cnccheap and I'll tell you right away - they're not the least professional.

Up until I transferred the money, the sales personell at CNCCheap were really snappy. I asked questions and got replies back by the next day. The list of standard accessories is quite long:

  • Laser Engraving software Package (English Version)
  • User Manual (CD)
  • CW-3000 chiller
  • Air exhaust fan
  • Air Pump
  • Communication cable
  • 3 Reflect optics (installed in the machine)
  • 1 Focus optics (installed in the machine)
  • 1 60 watt laser tube
  • Other tools

These are all things that you'll need. The Chiller is crucial to keep the temperature of the CO2 laser tube where it should be. Water circulates inside the tube and keeps the fancy 3-layer glass tube at just above room temperature. The air exhaust fan and air pump (for air-assist) are also pretty much required, as are the rest of the list. They also offer a good list of accessories:

  • Honeycomb
  • Reddot Positioning
  • Rotary tool
  • Motorised up and down platform
  • Extra optics
  • Extra laser tube

I basically went for the "full package" of accessories with one exception - I did not buy an extra 60 watt laser tube. Why? I had learned that CO2 laser tubes only last about a year and then you have to replace them, so why keep a spare that you'll only throw it away? Turns out this was actually my biggest mistake. More on that later, but always buy that spare tube...

It feels a little odd to buy something worth $3800 via Paypal/Ebay, but not to worry! Ebay has their buyers protection, Right? Just 4 weeks after I hit the Checkout button (and before the laser arrived), the purchase disappeared from my Ebay history. Repeated emails / tweets to Ebay's support never resolved this and I never got an opportunity to leave my 1-star review of CNCCheap as a company. So - keep in mind - don't select your laser supplier based on the Ebay rating. Look around for real-world cases of companies that offer good service. CNCCheap is not one of these. I ordered the laser the 11th December 2014.

Shipping and getting it in the door

I read about the shipping process online and it's pretty straightforward. The seller will ship the laser to the nearest harbor and they'll also help you organise the last part as well. A local shipping company will then pick it up when it arrives, do the paperwork and after you've paid them - they'll deliver it to your door. Pretty straightforward. Due to unforeseen circumstances (these apparently happen all the time in shipping), the laser took quite some time to arrive in Oslo, Norway. I received the laser the 25th February 2015

The package was huge! It was well packaged and secured and had no obvious damage. Unpacking the laser we quickly realised that getting it up the stairs would be an issue. One of the Bitraf members had one of these neat electrical trolleys for moving heavy loads up stairs. Immensely useful, so if you have stairs - find someone that has one of these!

Assembly and sparks flying!

Setting the machine up was easy enough. Not because of the incredibly crappy documentation offered, but due to some videos I found on Youtube (from RedSail, not CNCCheap). The documentation was 10 pages of assembly for a different laser cutter and then 120+ pages on a different software than what we received. The software itself (AutoLaser) was delivered on a recordable CD. So much for "original software"? Me and Jon assembled the machine the same evening but it didn't work at all.

When we hit the Pulse-button, sparks flew about inside the laser Powersupply. A laser excites the gas inside the laser tube by shooting 27.000 Volts though it. You don't want to be near it when this goes wrong. Here's how it sounded:

The rest is a fairly long story that I'll condense here for brevity, but a log is here (in Norwegian) and my chat-log with the CNCCheap salesperson Lucy is here. Here's some dates and briefly what happened:

  • 2015-03-15 We confirm by testing that the laser PSU is working and that it's the lasertube that is dead
  • 2015-03-16 CNCCheap was told about the problem. They recognised the problem and said that they would ship a new tube.
  • 2015-03-25 The package arrives in Norway, but it's declared as worth $5. We need a proper invoice to get it out and CNCCheap takes forever to supply us this
  • 2015-04-07 We get the package and discover that they didn't send a laser tube - they sent us another power supply?
  • 2015-04-08 Despite solid proof, the seller refuses to send a new tube since they don't believe us. I get tired of arguing and order a tube from someone else.
  • 2015-04-14 New tube arrives and works on first attempt!
  • 2015-04-15 CNCCheap is told about the working tube and they still protest. They even go as far as claiming that we are past the 3 month warranty. Then I explode....
  • 2015-04-27 CNCCheap finally admits that the tube does not work, but insist that we smash the old tube. Apparently, they really don't trust us despite our problems...
  • 2015-05-04 Two and a half month after telling them about the defective tube, we receive the replacement.

Five and a half month after ordering it, we eventually have a working laser cutter on the cheap. We also realised that we never received the exhaust fan promised, but the non-working laser made that quite irrelevant. With the help of members Peter, Mubin, Kyrre, Vidar, Torfinn and Jon we finally got it up and running, but without their debugging experience from high voltage circuits I'd never make this. Thanks a bunch guys! I suggest that you find some allies that know a bit about high voltage circuits before buying.

Among the things we solved:

  • The interlock switch was loose
  • The safety connector to the chiller may be inserted the wrong way despite having a notch
  • Soldering the anode and cathode wires are incredibly hard. Use stranded wire as shown in this instructable, wind it really hard around the anode and then solder. Don't forget to add the isolation before soldering!
  • If the display does not light up, check the red emergency button. It's of really low quality.

Big thanks also go out to the other RedSail owners on CNCZone. They deliver much better support than the resellers or Redsail themselves. If you want to see how it looks when you intentionally break a laser tube, check the video below:

Breaking the old tube was a requirement from CNCCheap. They wanted to ensure that I did not try to fool them into sending me a new tube while the old one was actually working.

How we like it

Despite the incredibly unprofessional behavior from CNCCheap, we're happy with the machine. You really should avoid CNCCheap at all cost and I truly think that RedSail should kick them as a reseller for treating customers like this. They are not the only bad reseller though, so be sure to check for good reviews by trusted sources.

Overall I'm pretty impressed with what we can do with this thing given the price. We can engrave lots of different materials and we can cut the following with good results:

  • 8mm clear acrylic
  • 6mm MDF board
  • 6mm plywood
  • leather

These are the max thicknesses we've cut. Anything less also goes fine obviously. 

The AutoLaser software is notoriously bad. It's unstable and only imports DXF format without crashing. It does work fairly well apart from those very noticeable flaws. The undocumented meny system on the machine may seem like a joke as the English is very poor. There's also three different "Enter-buttons" depending on what part of the menu you are in, so the usability of this thing is practically zero.

The most important thing you need to know is that "Back" actually means "Home" and that the X700 has several undocumented (but nice) features. To zero the X-height on the material, you either click 12 times in the crazy menus, or use the undocumented command of pressing the dot-button and then pressing Enter. To show the outer bounds of the area to be engraved, press the Range-button and then enter. There might be more of these, but it's hard to tell. These we stumbled on by random chance.

We started using the machine without a filter. Then I built a DIY filter. It did well for a while, but now we're getting a commercial grade filter. My self-built filter sent all the warm air out of the building. This is convenient during summer, but not so much during winter. The commercial filter will clean the air enough that we don't need to vent it outdoors.

Below is a video of the most elaborate project I've made thus far. It's a timing gate for the Nerdy Derby race at Teknisk Museeum in Oslo. I learned quite a bit from that - but primarily that objects made of laser cut wood should not be in public spaces were kids run around wink

React with Javascript package managers

13 Nov

React with Javascript package managers

One of the best ways to learn new software is to take on a commercial project and force yourself to use it. I do this all the time and with all the cool kids ranting about React, I felt that it was time to do a project based on it. It's been a bit painful, but I've come to enjoy the way React works. It's actually quite beautiful!

I've used Angular before and React feels much more solid and natural. It does require that you learn how React thinks (or want you to think), and that part might take a little time. Here's some of what I've learned while using React.

Read more...

Call me! (with Adafruit FONA)

09 Sep

Call me! (with Adafruit FONA)

About a year ago, Adafruit launched the FONA. It's a neat little breakout board that packs all the features you'd want in a phone such as Calling, SMS, Data and Lipo battery operation and charging. Add to that a good API that is easy to extend and we have a winner.

By itself, the module can't do much, so you'll need a microcontroller of some sort. My preference is using a Teensy 3.1 since these are just incredibly flexible, fast & cheap. They're also small and placement friendly. By now I've used the FONA for two commercial projects and I thought it'd be nice to collect my experiences in this post.

Call for pizza using the ad on a bus station

The first project had me build the FONA into an advertising board. Check this video to see it in action. The large timer was connected to a motor that pulled it slowly back to zero. At each end position of the timer, there was a manual switch that triggered the FONA in different ways. When the timer was set to 15 minutes, the Teensy set the FONA to call up the pizza delivery. If the person turning the timer wanted, they could get a free pizza within 15 minutes. When the timer was set back to Zero, the Teensy prepared the FONA for the next customer.

As can be seen in the video, it was a snowy morning and I got to do some extra troubleshooting in the bus shed since the timer motor accidentally burned out the evening before and the replacement motor made so much electrical noise that it messed up the sensing on the button pins. I solved this by moving the button pins to analog pins and using a different threshold than the normal digital I/O used.

The FONA used a normal headset-mic to pick up the sound. To play it back I used some more Adafruit components - a 3.7W amplifier and these neat transducers. Despite being only 5W, it was not a problem to hear the sound on a busy Bus-stop when attaching the transducer firmly to the board itself. While the person waited for their pizza, we also played them some cheezy elevator-music. This came from the Teensy using the Audio Adaptor board. I really dig this board. So many cool audio things you can do. Really powerful!

The installation stood there for a whole day and worked without any issues despite the moist weather.

Call anywhere in the world for free!

The second project had us set up a telephone booth that looked kind of like a 1.2 meter tall iPhone. It was to promote the mobile provider MyCall and the idea was to make a phone booth where you can call for free (3 minutes at a time). JCDecaux also made a nice video for this one that highlights that the campaign gave 30% boost in sales.

The interface to the user was a 47" touchscreen showing a multi-screen AIR app that communicated with a Teensy 3.1 via Serial. Before calling, the user was asked to input their existing phone number. After their free call was finished, we used their phone number to send them a polite SMS telling that MyCall offered great prices on calls abroad (their specialty). The project stood outside in a very public space (outside the Oslo central station) for 10 days and worked without a single error. I'm really happy with the stability of the FONA/Teensy combination!

Both projects were done for JCDecaux with MesseTjeneste making the enclosures and me doing the software + electronics.

Fona tips and tricks learned

Here's some things that are nice to know about FONA that you won't find on the (as always) solid tutorial pages on Adafruit.com:

A lipo battery is indeed Required
The FONA needs a battery to be able to source the required power upon connecting to the network. A 2.2A / 5V dedicated power supply was not enough, but a half-charged 150mA lipo in addition to the USB connection did the trick. The lipo battery is now added as a requirement on the FONA product page.

GSM calling produces serious EMP
Once a call was placed or the FONA connected to the network, the audio chip in the Teensy Audio board was completely messed up. It produced random and unpleasant audible noise. I solved by moving the FONA away from the Teensy, putting them in two separate boxes. I also tried shielding them from each other, but I got very varying results. Much easier to just move them away from each other.

Not all SIM cards will work
I initially picked up a dirt cheap SIM card at a kiosk and it worked right away. This was from MyCall, the company I later made the kiosk for. I then needed to make a copy of the installation, but when I tried to use a SIM card from Norway's largest telco Telenor, it didn't work.

The SIM worked like a charm when inserted into a phone, but on the FONA I was unable to connect to the network. The SIM unlocked successfully, but I was denied access to the network. I later learned that holding down the KEY button for 20 seconds can solve this.

Library only covers some
I needed to blink some lights while a call was in progress and play some audio when the call ended. There currently isn't a method in the default library to check this, but all I had to do was to look up the SIM800L datasheet to find the required AT command.  I then looked through the Adafruit code to see how they had implemented similar features and added this (gist). It's all just serial AT-commands that are wrapped nicely. Super simple!

Using Teensy
Since the Teensy has several Serial ports, you may need to make some minor changes to the default FONA sketches and lib. I've detailed these in this gist.

Ideas aplenty

My initial thought seeing the FONA was to build a phone, but I still haven't done that. Instead, I've used it for installations. Using a phone rather than wifi or bluetooth has advantages and drawbacks, but there are some pretty cool things you can do with this. As an example of something I'd love to do:

  • Imagine an interactive window display controlled via SMS?
  • Using it as a transparent network access point?
  • Click-this-big-button-to-talk-to-support/sales?
  • Circuits that allow you to check status or remote control vending machines or controls? It would be really simple to make a machine send an SMS if it fails to do it's task, so it can alert you that it needs service.
  • It could also be perfect for simple surveilance of hunting spots or beehives in rural areas where there's no phone coverage
  • Turning on the heat at the family cottage via SMS

It's so many cool things you can do with this when you don't need to think about having wifi available!

I really dig how easy it is to build connected installations with the FONA board and it looks like others also think so since Adafruit has now expanded the range to also include a board with a GPS and some convenient starter packs. I'm looking forward to play much more with FONA in the future!

Fixing avr-eclipse paths

20 Aug

Fixing avr-eclipse paths

Just before summer, I started consulting work for a hardware startup here in Oslo. As part of this I've gotten to play around with and integrate lots of new toys such as VISA card readers and various communication solutions. I also inherited some AVR code for a circuit developed specifically for the project and yesterday I set up the tooling.

I guess I could have used all sorts of software alternatives to program the microcontroller, but since the people that created the codebase used Avr-Eclipse, I figured that I'd check it out. Using a GUI makes finding the right fuse settings a breeze and I love to have proper syntax highlighting and completion. Setting it up was easy using this guide, but getting the code to compile properly was somewhat difficult so I thought I'd jot down what I learned in case it helps others.

Setting path for AVR tools in Eclipse

All my problems boiled down to Eclipse not using the PATH variables for avr-gcc and avrdude. On my system I have CrossPack installed for working with pure AVR projects and then I typically use the Arduino tool + Sublime for anything Arduino-related. The Arduino tool automatically adds some things to PATH on the Mac/OSX so in theory, avr-eclipse should just find and use this. It didn't. Instead it pointed to an old, uninstalled version installed by MacPorts on my old Mac that got ported over to my second Mac. All the folders were empty as I unsinstalled MacPorts to use Brew instead several years ago, but the "smart" feature insisted that these empty folders were better than looking at the system PATH variable. I altered the PATH values to point to the CrossPack installation but that didn't help either.

The creators of the avr-eclipse plugin have tried to add some smarts to the configuration, but that failed completely for me. To set the correct location of the AVR tools you want to use, open the Eclipse menu > Preferences and then expand AVR > Paths like this:

Forget the Rescan button if you know what path you want to use. If you don't know the path to avr-gcc and the other tools, just open a terminal window and type:

which avr-gcc

This will tell you the path of the avr-gcc that can be reached through the normal PATH settings on your machine. Now you'd think that this is all you need to do, right?

Fixing the standard includes

I kept getting errors like this.

undefined reference to `debug'
undefined reference to `asm'

It basically means that AVR-eclipse can't find the class definitions for these files. To fix it, Right Click the name of your project in the Package Explorer window and select Properties at the bottom of this menu. This brings up the local preferences for the project. Go to the "C/C++ General" entry and expand the "Paths and Symbols" option. Make sure you're linking to the right version of the include files here:

If you've set the correct AVR hardware and the right programmer, you should now have a working setup. Hope this helps someone as it was rather hard to google all the bits required to get to this.

 

Testing with Testflight

10 Jul

Testing with Testflight

After Apple purchased Testflight, the service has been integrated into the workflow when publishing apps. Any app with a distribution profile can be sent to users for testing and the process is actually quite smooth compared to the old version. First your build is vetted by Application Loader (or XCode) and then you turn on testing for that specific build. I did however run into an issue worth publishing in case others run into it.

Normally, you'll just flick a switch to turn on Testflight Beta Testing and the app is ready to be tested by all internal to the team. In my case, I could flick the switch but nothing happened. I called Apple Developer support, but the guy I talked with completely failed at understanding what my issue was and he insisted on sending me something I knew was incorrect. He just wouldn't listen when I tried to tell him that something was wrong:

I eventually understood that the first of the two warnings (... must contain the correct beta entitlement) did not have anything to do with my certificate or provisioning file, but rather a missing directive in my app descriptor. Some googling led me to this article that explained how one had to add the beta-reports-active key to the Entitlements part of the descriptor. I now got an error when uploading the 

Build 168 does not contain the correct beta entitlement.

After reading all the replies to this thread I realised that I should not set the mobileProvision-file to be for AdHoc distribution. It should just be a Distribution profile for App Store. That's it.

I also had another issue getting my AIR app published this time. After updating to the latest XCode, I got the following error when uploading the app:

Invalid Bundle: The bundle does not support the minimum version os specified in info.plist

Turns out one have to add a bit about MinimumOSVersion to the InfoAdditions-section of the descriptor file as well. My entire iPhone descriptor settings are now like this:

<iPhone>
<InfoAdditions><![CDATA[
  <key>UIDeviceFamily</key>
  <array>
   <string>1</string>
   <string>2</string>
  </array>
  <key>UIApplicationExitsOnSuspend</key>
     <false/>
     <key>MinimumOSVersion</key>
  <string>6.1</string>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
<Entitlements>
        <![CDATA[
   <key>aps-environment</key>
   <string>production</string>
   <key>application-identifier</key>
   <string>XXXXXXX.com.myapp.appname</string>
   <key>keychain-access-groups</key>
   <array>
    <string>XXXXXXX.*</string>
   </array>
   <key>get-task-allow</key>
   <false/>
   <key>beta-reports-active</key>
   <true/>
        ]]>
</Entitlements>
</iPhone>

Popcorn Time!

06 Jul

Popcorn Time!

Just a little summer sigh... I keep reading articles like this one (translated to English) about the famed Popcorn Time software that let's anyone view pretty much any movie when they want. In this article, the word "strømming" means "streaming" and the headline is that streaming of pirated movies has more than doubled the last year.

Nobody but the movie industry is surprised! We all want to stream movies like we've been able to for music for quite some time now.

In my opinion, Popcorn Time is Netflix done right, but without any legal issues holding them back. Suing Popcorn Time or it's users will not solve the problem. Just as with music - new distribution models will pop up and they'll be your competition in the future. The longer you wait, the worse you basically make it for yourself.

Read more...