RPi2.IT – Updated Raspbian released for Raspberry Pi – my project continues

Isn’t it a pain when our internet is capped because we have exceeded our download limits for the month?  Anyway, this was our situation for the past week – our 200GB was used up.  Ok, this is about the Raspberry Pi 2.  Remember when I tried it out when it was first released?  The RPi.GPIO module wasn’t working and to get it to work, I had to download and use a non-release version.  Just a few days ago, the Raspbian linux distribution was updated.  As we got uncapped yesterday, I was able to finally download and install it onto a micro SD card.  Raspbian is based on Debian Wheezy and is for Raspberry’s hence the name.  The current kernel is 3.18.

Alright, first thing was to run Python3 and then enter the command  “import RPi.GPIO as GPIO” – success, this was accepted without any errors.  Fantastic, I am now able to “RPi2.IT“.  I went through my standard steps to verify that the hardware was accessible, by downloading wiringPi and pigpio and confirming that these add-ons will access the RPi2 hardware – yes, confirmed that GPIO access was possible.

I checked the i2c bus, and yes, I still need to modify the /etc/modules file to add i2c-dev before the /dev/i2c1 device will show up.  I install i2c-tools then use “sudo i2cdetect -y 1” which ran successfully – showed no i2c addresses visible, because I haven’t connected anything as yet.

Now, this morning, I checked my breadboard wiring.  I have four MCP23017 chips ready to install onto the breadboard.  I applied 12V power to the breadboard, and my led lights up showing that I have power.  Then I used my multimeter to measure the 3.3V power rails.  Why 3.3V, you might ask?  The Raspberry Pi general purpose input output pins are 3.3V pins, so I cannot use 5V without using voltage level converters.


My previous plan was to use voltage level converters, but have since decided to make everything 3.3V to avoiding the hassle.  I found a nice 3.3V dc to dc converter made by Recom, that takes 6-28V input, and gives me 3.3V out – at efficiencies from 75-88% – not bad.  It has the same pinout as the standard linear voltage regulators like the 78M33 and doesn’t need the input and output capacitors.  In comparison, the efficiency of the 78M33 with 12V input and 3.3V output is something like 27.5% at rated load of 500mA.

Ok, time to bite the bullet – I inserted the four MCP23017 chips, then applied power.  No magic smoke was released – now let out a sigh of relief.  Checking the voltage on one of the interrupt output pins – I get 3.3V, ok – as I will be using these to connect to the Raspberry Pi 2.


Now, to get on with my software after a long delay waiting for the Raspbian distribution to stabilize for this new model Pi.

Repair.IT – Advance Combo 3800 stringing machine tension head

In July last year, the local Eagnas importer had referred an inquiry to me.  A man in Melbourne had a problem with his stringing machine.  The machine is a Combo 3800 which is also sold by Eagnas as well as other companies.  Anyway, the problem is that the machine reports a load cell cable error – which is a generic error that the readings from the load cell are out of range.

photo 2

The man sent this photo to me of what it displays when he does the +10 power on test.  I.e. press and hold the +10 button down, then power on.  It shows 99 – bad, which in my opinion very likely means that a transistor had failed causing the ADC to also fail.  I told him the location of the transistor and ADC.  He said that he had a friend who might be able to do the replacement for him and we left it at that.

Ok, around the end of January I was going through some old emails and I came across his, and wondered what had happened, so I asked him.  It seems that he didn’t get anywhere with it other than getting the transistor and replacing it.  Still the same error – so I said that the ADC replacement should fix it.  Eventually after a few emails back and forth, he decided that it might be best to send it up to me, which in due course he did, arrived last Friday week.  On that weekend, I had a look at it, found a broken wire, fixed that and after some measurement of signals concluded that the ADC had actually failed.  The ADC was out of stock at the supplier, but it eventually arrived on Friday – all the way from Singapore.

On Sunday morning, I woke up a little early and thought that while everyone is asleep, that might be a good time to tackle the ADC replacement.  The ADC is that flat chip next to the big chip.  That flat chip is a 22 lead SOIC.  The length of that chip is about the thickness of my little finger.


I use Chip Quik to help in removing these surface mount chips.  The Chip Quik is a low temperature alloy that mixed with the existing solder.  I put some flux onto the chip pins, then melt the Chip Quik onto the pins and go around a couple of times, then just lift the chip off the board.  Takes only seconds!  Then clean up the old solder and alloy with solder wick.  Then clean with isopropyl alcohol wipes, add flux again – drop the new chip in place and ready to solder.  To solder, I just need to tack on a couple of the pins on each corner – to stop it from moving around.  Then add solder onto my iron and just wipe the iron tip across the pins.  Do this a couple of times until each pin is wetted.  Do the same for the other side.  If any pins are bridged, just wipe the iron on the pins away from the chip.  All done – ok not quite.  I do this with the board removed from the machine, I had to then reassemble it into the machine which was a bit of a job because I find out that the board supports don’t line up with the mounting holes. No wonder the original supports were all loose, they had to be loose in order to fit.

Anyway, power on, the load cell error is now gone.  Go into the +10 power on test mode, and adjust for the appropriate value – should be from 34 to 39, not 99.  Great – next step, mount it on my test bench and try a low tension.  Not good – when pulling at 20 lbs, I get 13 lbs actual tension, try 40 lbs – only get 26 lbs.  Ok, I need to know whether or not the guy does tennis or badminton or both, so sent him an email.

He replied that he does tennis primarily.  Ok, so today I started to perform an adjustment at 50 lbs, which is adjust VR2 to increase the tension, until it is almost right, then check the reading in test mode is from 34-39, if not – adjust VR1, which affects the VR2 setting.  After doing a few iterations of this, I get it so that 50 lbs is actually pulling at 50lbs, and when I check at 20 lbs, I am getting 20 lbs – fantastic.  At 65 lbs, it is also pulling 65 lbs. Tennis is usually from around 45 to 70 lbs, so job is done – I packed it up and it is ready to go back down to Melbourne.

If you are looking for relatively inexpensive couriers and are not transporting glass, I would suggest e-go.com.au – I got a quote to send this 10kg parcel down to Melbourne – it would cost $11.22 if I take it to the Parramatta depot.  You can save 15% by sending depot-to-door, as opposed to door-to-door.  Door-to-door is less convenient as you have to wait around for the courier to come and pick up the parcel.  Since I go to Parramatta a few times a week, it is easy to take it to the Postnet shop which is the local depot for e-go.

One final photo – the failed ADC chip.


Repair.IT – Eagnas stringing machine tension head with LED display

Just over a week ago, I was asked to look at a couple of Eagnas electric stringing machine tension heads.  These are similar to the Hawk 126e with LED display.  One tension head was pulling much too high in tension, the other just broke my string because it didn’t stop pulling, and almost pulled my electronic calibrator apart – I remember seeing the display go up to 95 before the string snapped.  I was only testing it at 20lbs.  Note to myself, next time – use badminton string so it should snap a lot earlier without going to such high tensions.

Ok, this machine that didn’t stop pulling – I took it apart – it wasn’t easy.  I eventually worked out that it is best to remove the 240/120V selection switch first – there are two screws under the label.  Then coax the front switch out through the front panel, and remove the six plugged in wires – after noting down which wire goes where.  Also remove the push button switch out the front but leave it loose.  After removing the four bolts that hold the cover in place, it was now possible to lift the cover and essentially manouver it off. Then reconnect the front switch to the correct wires.

After doing all of this, I then found out why the machine would not stop.  When the motor runs and pulls hard enough, a long lever should push onto a microswitch that will then stop the motor.  The part that was supposed to press onto the switch lever didn’t because the lever had bent away from it.  I bent the switch lever back so that it would activate.  Then I wanted to stop it happening again – so I made a little piece of wood, that would fit under the switch mounting that would stop the switch lever from moving sideways.  It will still move sideways, but not enough that it won’t be pressed when the right tension is reached.


Next step was to check the tension that it pulls at.  To adjust the tension, I need to adjust these small trimmer potentiometers, the ones in blue.


I mounted the tension head onto my test bench and proceeded to adjust and set the tension at 55lbs.  This machine would be used for tennis.  If it was for badminton, I would adjust it for 25lbs.  Once this was done, I put it all back together and then did a final calibration check.  This is by setting the tension at 20lbs then pulling and recording the tension that was reached, then increasing by 5lbs, etc until I get to 65lbs.  I can’t go any higher with my test bench because the tension calibrator support was starting to bend.  I will add another piece of steel to stiffen it for future testing.  Finally a photo of my test bench with it tensioning at 50lbs and a slight cluttered working area – lots of xbox controllers.


[Note]  By measuring the tension at various points, we can plot this onto a chart so that we can determine what setting we need to get a particular tension.  This is what calibration usually refers to.

RPi2.IT – This just in, the Raspberry Pi 2 is camera shy!

I was reading recently about a minor bug found with the Raspberry Pi 2, however this one seems to be sort of, unexpected, but expected in a way.  Apparently a bright flash such as from xenon camera flash could trigger the Raspberry Pi 2 to shutdown, or at least go a little haywire, hence I thought that I should check it out.

I used my Sony a300 camera in portrait mode and took a closeup photo.  I had the Raspberry Pi 2 connected to a monitor so I could see if something happened.  I took a couple of photos with flash and sure enough the display went out for a second or two then came back on.  After examining the photos, I noticed that the Raspberry writing was upside down, so repositioned the Raspberry Pi 2 so that the writing was right side up, then took another photo – this time, the display went out and didn’t come back.


It appears from research that the problem is due to a CSP device that is sensitive to light. If you have a look at the word “HDMI”, then to the left of it about the same distance as the word, there is a black chip – a Chip Scale Package, actually.  A CSP does not have a plastic case around it and is essentially a silicon chip with solder balls on the bottom.

From this application note – http://www.silabs.com/Support%20Documents/TechnicalDocs/AN0878.pdf – we find that the fix would be to cover it with Glob-Top Epoxy.  Alternatively I could just put the Raspberry Pi 2 into an opaque case, but that takes all the fun out of playing around with it!

RPi2.IT – Trials and tribulations of Raspberry Pi 2, or the bleeding edge!

The news of the new model Raspberry Pi 2 came through in the early hours of Tuesday, 1AM to be exact. Since I had been doing some work on the Raspberry Pi, I thought it might be good to get a couple to play with. I checked stock at Element14 – no issue, over 2300 units in stock. As it was getting late, I went to bed and got up around 8 or so, and had another look at Element14. 1900 in stock, ok – maybe I should place the order, anyway – that is what I did, and quite quickly at about 12 noon, there was less than a thousand with all stock being depleted by sometime after 1PM. Later that day, I got an email that the order had been processed – great.

Anyway, on Wednesday I picked up the order, grateful to get my hands on these new Pi’s, but soon after I went out to look at a server problem.

Later that night, I checked the Raspberrypi.org website, it appears that I will need to download a new Raspbian image to run on the new RPi 2. This one is different to my old one, in that it has a Micro SD slot instead of a SD slot – no problem, as I was able to pick up my 8GB Micro SD’s that had been on order with ITestate – a good price at $6 each. Anyway, last night – same night, I put the image on the 8GB microSD and went to bed.

Today, when I got back from continuing the server job, I start up the Raspberry Pi 2, and go through the configuration and… some things are not working.

I test the I2C bus, and nothing is visible even though I have configured. Ok – go on to the next item. In python, I load the RPi.GPIO module and I get an error, that this module can only be run on a Raspberry Pi. Hey, what gives? Anyway, a check on the internet seems to show, that I am not the only one to have this problem – and that a new version of RPi.GPIO should be coming this weekend – fingers crossed. I use this module to access the General Purpose Input Output ports on the Raspberry Pi, so at the moment, this is a $42 paperweight – not heavy enough really to work as a paperweight.

Anyway, I start to look at the i2c problem and eventually work out that even though the i2c-bcm2708 kernel module is loaded, the problem is that the devices are not loading. To fix this, I edited the /etc/modules file and added i2c-dev and finally after rebooting, I have access to the i2c bus – great. Now just have to wait for the RPi.GPIO module to be fixed then I can “RPi2.IT“.

[NOTE] The old Raspberry Pi had a single core processor running at 700MHz. This new Raspberry Pi 2 has a quad core processor running at 900MHz. The /proc/cpuinfo file gives a version information that is probably the reason why the RPi.GPIO isn’t working, because it cannot work out if it is a Raspberry Pi and throws out that error message.

[NOTE2]  I need the I2C bus, because that is how I am going to access a real time clock module and some additional input/output chips that I am awaiting – 4 Microchip MCP23017’s each of which will give me 16 i/o ports, with a grand total of 64 i/o plus the ones already available on the RPi 2.  I also have some N channel MosFET’s on order, to do the voltage level conversion between 3.3V on the RPi and 5V on the MCP23017.  I could have bought the MCP23018 and did away with the voltage level conversion, but would have had to pay nearly four times the price of the MCP23017.  10 BS270 MosFETs cost less than 1 MCP23017 and I only need two of them to make the level converter – a win win situation.

Reinvent.IT – The wheel, no – not really, but similar!

Last Monday, on Australia Day, I had a meeting with a company to discuss a project. I can’t say a lot about what was discussed but suffice to say that it is an automation project. The meeting went on for over 3 hours – what is required, what could be achieved, can I do it, what can I do, etc. We want to be able to see what switches are turned on and do something with this knowledge. It would be microcomputer based of course – what automation project is not about micro’s? Now, these things are already on the market, but is it really necessary to “reinvent.it“? Yes, if you want to put your name on it, and own the design – you should!

We decided to work with the Raspberry Pi (RPi) – which some of you will know, is a little credit card sized computer, with a System on Chip (SoC). There are a number of versions of this, but essentially, it is like a desktop computer without the desktop. It has memory, a SD card slot, network interface, hdmi output and a couple of USB ports. Oh, I have a Model B on hand, and it is low power, I use my phone charger to power it through the micro-usb port.

The RPi also has a number of general purpose input/output ports – which will come in handy since these are where the signals will come in. For a small number of inputs, we can just poll them – i.e. check each one to see if it is active, but for a larger number – this can be cumbersome especially if there are time constraints. I knew that I would be needing interrupts to handle the inputs. The RPi will also be running a version of Linux, which will also have the Python interpretive/scripting language installed, hence this would be a good choice.

Anyway, after discussions, I said that I would be able to come up with a PoC (Proof of Concept) in a week’s time. I would need a couple of days for research, i.e. google, then a few more days to do some circuit design and programming, not being familiar with Python. On Thursday I rang the company and made a few corrections on our initial assumptions, now armed by my research, and confirmed that I would be on track with a working concept by Monday.


So, now we are at Monday, I have a RPi connected to a breadboard with a number of dip switches, which will simulate our inputs. Yes, that is a tooth pick next to it for size comparison – and I use it to press the tiny switches. A fair bit of time was spent working out how to do things in Python – a very powerful language. Some more time was spent in coding so that we can put the parameters in lists to avoid hard coding. When communicating with the GPIO ports, we can use either pin numbers or port numbers. I chose to use pin numbers since that way I can confirm that I am connecting a particular switch to a particular pin. The software works out how to translate the pin number to the actual GPIO port, so all I have to do is to refer to the inputs as being 1, 2, 3, 4, etc. I don’t have to worry about 1 being actually 7, or 2 being 11, etc.

More software testing was done in order to determine its performance, how many inputs could be checked if polling the ports were done, etc.  This is to get an indication of the maximum polling rate – we won’t use polling, though, but it is to get an idea, so we know how long things could take at worst if polling was used.

Also, the RPi doesn’t have a realtime clock – I will need to add one, but that won’t be necesary for this PoC – isn’t that great? The PoC is ready, and it’s running on a SoC. Just waiting until the company can come in and see it in action, so in the meantime, I can relax and think about more code enhancements.

[Note]  I also had a look at Copyright’s and Intellectual Property rights – this is quite a complex area.  But anyway, if I write the software, then I own the copyright – but if I am employed by a company, then the company owns the copyright, or if this done for the government, then the government owns the copyright.  Whew!  Did you know that a circuit board cannot really be copyrighted?  We could claim the copyright on the artistic and literary works of the circuit board though, but it can be difficult to prove and doesn’t really stop anyone from making something similar – maybe that’s why some boards come with the important bits covered in epoxy.  However, all is not lost because usually, the secret is in the way the program works, and this is copyrighted.  Python is used for the PoC, but for production, this would be C++ most likely.