So if you have been following my blog lately you may have noticed me rambling on about trying to get a Xbox 360 chat pad and an ps3 keypad working with a raspberry pi to make a portable terminal. I have finally finished my quest so join me below to see how I did it
- Raspberry pi zero w
- 3.5″ waveshare clone
- Rii Mini 518 Bluetooth keyboard
- Bluetooth dongle
- Power bank board
- 2600mAh lipo battery
- DIY USB hub
- DIY interface PCB for screen
- Various stand-offs
This is kinda where I got the idea to do this project in the first place but was nearly the undoing of it all. As I said in the other blog posts I first started with xbox 360 chat pad then moved on to the ps3 keypad then lastly decided on the Rii mini 518.
I thought it was all going to work out with the Rii mini but it had other ideas. The reason I went with a Bluetooth keyboard and the raspberry pi zero W was the fact that I wouldn’t need a dongle for it to work therefore it would leave the OTG port free for other things. The problem with the keyboard was it was old so used Bluetooth 2.0 and the raspberry pi didn’t like me using the onboard Bluetooth/Wi-Fi chip set in Bluetooth 2.0 mode and Wi-Fi at the same time. It would connect fine but after 30 seconds it would disconnect then take a further 30 seconds to reconnect. After a lot of googling around I found out other people were having problems with using Bluetooth A2DP on raspberry pi 3.
The work around I have found is that you can ether use a Wi-Fi USB dongle or use a Bluetooth USB dongle. To use a dongle you need to disable ether Bluetooth or Wi-Fi. You will need to add
To the /boot/config.txt file to disable to Bluetooth and add
to the /boot/config.txt file to disable the WiFi
Firstly I was just looking to make a hub that broke out the test pads on the underside of the Raspberry pi zero W to a full-sized female USB port so that’s what I did. I used 9mm through hole POGO pins because instead of having the USB port under the PCB I was going to sandwich it between the PCB and the raspberry pi to save on height.
This would have been it but the keyboard had other ideas. Because I now needed 2 USB ports I would need to make a real hub. While making this project I has having a look around to see if anyone else was doing anything similar and someone was. I seen that they had torn down a cheap microUSB OTG and used the board out of it to make a DIY USB hub. This is the OTG hub I used for mine.
I tore it down and tested it out before striping all the connectors off the board.
This was going to be hard one to design a PCB for because all the connectors for the hub were on top of the board. I had a brain wave, I would have to put the hub PCB on top of my designed PCB and have pads around the hub board where I would solder wires to. I used solid core wire out of an Ethernet cable to make the connections to the PCB.
After a bit of trial and error and printing out the PCB for size I finally ordered the board. As before I was going to be using 9mm through hole pogo pins and mound the female USB ports on top the PCB sandwiching them. As this board was going to sit flat I had to keep the though hole parts leads short, I clipped them down so they wouldn’t quite reach thought the layers of the PCB. This way the solder would fill the hole without sticking out the hole too much.
My next challenge was how was I going to power this project. Normally I use the board out of a xiaomi power bank because they are really cheap on aliexpress and can handle a high current draw.
The reason I didn’t use it in this project was surprisingly that once this project had booted it didn’t draw enough current to keep the power bank board on, This is a feature of some of the power bank board so that if they don’t detect much or any current they turn themself’s off to save power.
As soon as I knew this was the problem with that power bank board I started looking around my workshop to see what I had. Luckily I had a cheap power bank that I had been using and didn’t have the auto shut off feature. It also had power level LED’s so I would know when the batteries were getting low and I could shut off the pi
To get power from the power bank board all I did was solder 2 wires onto VCC and GND off the back of one of the USB ports to the custom PCB I had made that the screen and power switch were attached to. The good thing about using a power bank board is that you can use it as a power bank. If you phone needs charging or you need to use a USB fan or USB light you can do. I wired up a 2600mAh battery to the power bank board, This is more than enough for the pi and to charge a phone if you need to.
You may be wondering why I mounted the pi and screen the way I did, If I had mounted it the other way round I could have made it far more compact and had the GPIO at the top so It would have made it better for breaking out them. The reason I did it that way was because I wanted the HDMI and micro USB power port exposed. This way you could hook it up to a TV if you need to. I also wanted the power USB port exposed so if you were going to run this for long periods of time and had access to mains power you could power it that way.
I knew that the USB hub and custom PCB that mounted the screen was going to be a thick stack. This is where I got the idea of putting the keyboard on top of the power bank PCB and battery. Just as it happened they came to about the same height, I would like to think I planed it that way but it’s just the way it came out.
The keyboard was a really difficult thing to mound. I couldn’t just stick it down because that sync button was on the back. This is when I had another brain wave, I decided to order one of these magnetic phone holders where you put a thin steel pad on the back of your phone and mount the magnetic side onto your car dash or were ever you wanted it mounting. This still wasn’t it, I needed away to stop the keyboard spinning around while I was typing on it. I decided to add 4 bolts around the keyboard to hold it steady, This done the trick. The only thing I had to do was take the magnets out of their holder and super glue them onto the underside of where I wanted the keyboard mounting.
So you are probably thinking how I use the GPIO. Normally with the pi I will break out all the GPIO using a ribbon cable to a bread board, but you will notice that the keyboard is in the way. This is what’s great about the magnetic keyboard, It can be removed easily. All I do is attach the ribbon cable and remove the keyboard like below
Board files – https://github.com/facelessloser/pocketpi