Remake.IT – Raspberry Pi 3 with 7″ Touch Screen and housing

A while ago, I bought a couple of the new Raspberry Pi 3’s and at the same time, bought a 7″ touch screen and a housing (which was on special) for it from element14.

http://au.element14.com/raspberry-pi/raspberrypi-display/raspberry-pi-7inch-touchscreen/dp/2473872

http://au.element14.com/multicomp/cbrpp-ts-blk-wht/raspberry-pi-touchscreen-enclosure/dp/249469102

As usual, there can be a delay between purchase and actually assembly or use, due to other commitments. Anyway, a couple of nights ago, I decided to assemble the Raspberry Pi with the touchscreen. The touchscreen was pre-assembled, so all that I had to do was to attach the screen cable to the Raspberry Pi 3, then connect the four wires to provide power and the data signals to the touchscreen controller board. By the way, the instructions did not say that the SDA and SCL signals had to be connected and showed only connecting the ground and +5V pins.

I also needed to download the latest Raspbian operating system, and copy the image to a micro-SD card which I did the next day. Then finally plugging in the card, and fastening the Raspberry Pi down with four tiny screens. Next was placing all this in the housing. All went together and I connected up a suitable power supply and powered up.

Voila! Hmm, the display is upside down – ok, and the touchscreen wasn’t working. Checking out the FAQ on the appropriate sites indicates a fix for the display – to rotate by 180 degrees in the /boot/config.txt then a check to see if the touchscreen hardware was seen by the OS.  Yes, the drivers are active so what is going on? I decided that it was time to open it up and check the touchscreen cable.

To my surprise the cable was disconnected and sticking up at a right angle – then the penny dropped. Putting the case on, must have disconnected the cable, which was connected, but now is not.

DSC_0310

This is the touchscreen cable, the one that is attached to that black square chip – the cable is a little bent at the edge which meant that something was pressing on it. Turning the back of the case around showed me the problem.

DSC_0311

The cutout for the touchscreen cable has a sharp edge, which was pressing down on the edge of the touchscreen assembly with the chip on it, and since the thinner cable is not that long, pushing down on it would pull that thin cable out. Which is what must have happened. I measured the distance from the edge of the case to that touchscreen assembly, then marked on the case where I needed to remove that sharp edge. I got out my trusty file which happened to be almost the right width at the area I needed to file out, and proceeded to remove some plastic material making that marked area more rounded which would reduce the pressure on that assembly.

DSC_0312

Here is the final result. After careful reassembly and checking of the cable which was can just see through slots in the casing for the HDMI socket, I can confirm that the touchscreen cable is still attached.

DSC_0316

After powering up, I now have touch!

 

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.

SONY DSC

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.