Pi Wars 2018

AI

Introduction

Caen Community Primary School coding club is full of enthusiastic students – though their ideas vary greatly, they learn to compromise, creating a master plan to win the next competition coming their way!

This year Caen Community Primary School has chosen to enter ‘Pi Wars’ 2018, and has inspired children to put their talent towards a good purpose. Pi wars encourages kids all over the UK to take part in an annual robotics competition. There are plenty of challenges to enter, such as the ‘straight line speed test’ and ‘the obstacle course’. To enter, you must visit the website (Pi Wars) and fill out the application form and, volia! If selected you are officially entered into the competition, taking part in challenges of your choice.

The competition is held in Cambridge, from the 21st-22nd of April, 2018, but I’d begin working on your robot now if I were you!

Club Update #1

This week we decided to test our driving skills. Using an RC Monster Truck we built a track in the playground covered with obstacles. Taking it in turns, we put our driving caps on and timed each other over the course.

There were some pleasant surprise and some really good times.

Club Update #2

If you keep up with our frequent blogs, you’ll know that Caen School is taking part in an annual competition known as – you know this by now – Pi wars! We are so excited to have this opportunity, and to just be a part of this challenge! Now onto last week’s news.

Last week, we had a go at ‘Python’- a programming language, which involves typing certain characters into the computer and creating a set of commands that you could even send to a raspberry pi!

Recently, I’ve had a look at the ‘hints for roboteers’ section on the pi wars page and we found some good tips for anyone taking part in the challenge:

  1. Start making your robot ASAP! It may be in April next year, but still, the New Year is racing toward us!
  2. I thought this was brilliant- allow others to drive your robot, they’ll immediately notice any faults in your robot- maybe try with more than one friend

So, we’ll sign off here- we have coding to do- but I’ll keep you updated. Bye!

Club Update #3

Well its been a long time since we did a club update (it’s now March!!). A lot has been happening. The basic chassis of the Robot has been built and we have had a go at driving (and crashing) it. We wrote off a camera in the process of doing some time trials to see who was the best driver. We also now have a Nerf Gun!!

Mr Harvey has split us into sub teams and has had us all working on the different challenge,s to try and come up with our own ideas to tackle some of the problems involved as well as designing various ‘add ons’ for the robot such as a Golf Ball guide and bracket to hold the Nerf Gun.

Club Update #4

We have all been busy working on our individual challenges and this week Mr Harvey got us to summarise what we have been doing. Here some examples.

 

Screen Shot 2018-03-15 at 11.46.46Screen Shot 2018-03-15 at 11.46.52Screen Shot 2018-03-15 at 11.49.01

Screen Shot 2018-03-15 at 11.47.49

 

Our Robots

Prototype Chassis

We started to look at what to build for the competition and for starters decided to go with a couple of chassis designs for initial testing. Firstly a standard perspex chassis / motor kit available from eBay and Amazon. And secondly the CamJam Edukit #3 Robotics kit.

CamJamEduKit3

MonsterBorg

After checking our club funds we decided we had enough money to invest in a more robust and better motors. This would give us an altogether better robotic chassis with which to work. After doing some research we came across the PiBorg web site and on looking at the various robot chassis available we went for the best we could afford – The MonsterBorg. This is a beast of a kit with a aluminium chassis and 4 motors capable of 300 RPM!!

MonsterBorg – The Final Solution

On the 22nd of December the package arrived. As well as the basic chassis we had enough for a few other bits and pieces such as a raspberry Pi 3, Camera, Servo / Sensor Board and a couple of Battery Holders.

 

IMAG9573

MonsterBorg Build

To build the MonsterBorg there are some fantastic ready made tutorials on the PiBorg site. First up you need to setup the SD card with all the required software examples. We will of course need to adapt these for our specific robot – more on that later.

The software setup guide is here.

One issue we encountered was that the MonsterBorg examples did not download correctly however that was fixed after asking a question on the MonsterBorg Forums

After successfully installing most of the required software it is time to assemble the chassis. The build guide is here.

IMG_1069

After completing the build we were unhappy with the location of some of the components. The default build locates the Raspberry Pi, ThunderBorg Motor Driver Board and batteries on the underside of the robot, this restricts ground clearance under the robot. When in the default build status it is impossible to get at the all but one of the USB ports, this means that plugging in peripherals will be very difficult.

Relocating the Raspberry Pi to the top of the Robot was fairly simple and the ThunderBorg / Battery Lid fitted in place also very simply but after taking it for a test drive the main flaw in this configuration that was notable was that it cannot be driven upside down. It went down a step, flipped onto its top and disconnected the battery pack!! This may cause issues on the obstacle course as it may take the odd tumble.

IMG_1070

Here is a pic of the Robot with all of the electronics relocated on top:

IMG_1072

in the pic above I had not relocated the camera, with the Pi on top the camera needs to be moved unless you buy a longer cable.

After building the Robot we spotted a major problem. We bought this in haste without considering the size. On checking the rules whilst the length of the Robot is OK, it is too wide!! To resolve this the judges are considering this rule although I don’t want an over wide Robot to jeopardise our chances in any of the challenges (getting stuck etc). We may need to try and fit some narrower wheels / tyres.

 

Power

In it’s  default build state power is supplied by 10 AA batteries, this means that any software amendment / dry testing has to be done on valuable battery power. This became apparent during its first test, I had found that some of the example scripts had not been downloaded and to do so would waste power.

To solve this we posted a question on Twitter and received a reply from the builders. They believed that as long as the battery pack was switched off powering the Pi using a standard Pi mains PSU would be fine. This was also backed up with an answer on the PiBorg forums.

Power Upgrade

Running on non rechargeable batteries is very wasteful but converting to 10 x rechargeable AA is not cost effective. The choice needed to be a conversion to a suitable LiPo battery. I had a spare 3S 11.1v but to power the motors, servos and sensors it is recommended to increase this to a 4S 14.5v LiPo battery.

Here is a pic with the 11.1v LiPo battery mounted:

IMAG9684

Software Setup

Download and flash a 16GB SD Card with the latest Raspbian OS, in our case this was Stretch. Next we setup some of the software needed for the MonsterBorg, namely the software required for the ThunderBorg motor driver board by following the guide on this page. This involves:

  • Expanding the filesystem
  • Setting up ssh and i2c communications for remote access and the ThunderBorg
  • Setting joystick controls
  • Setting up the Pi camera and associated software
  • OpenCV – we skipped this as we would be following a separate install (may need to come back and run this though)

After installing OpenCV (details later on this page), we installed some of the additional software required by the ThunderBorg motor driver board.

We also needed the Python 3 version of the ThunderBorg.py module, details on where this can be downloaded or installed can be found here.

To help transferring files from our computer to the Raspberry Pi we installed Netatalk.

 

Remote Control

Before building the robot we had a look at some of the controlling options for the remote controlled challenges. First of all we thought using a ‘hacked’ RC controller from a charity shop. After some testing we found that two sets of connectors output a voltage when the joysticks were moved and thought that it would be easy ish to read these voltages using a Raspberry Pi. After some more research it turned out that reading analogue voltages with a Pi is not easy so looked for other options.

We found out that one of the easiest way would be to use a wireless controller. We ordered a controller from the Pi Hut, which pricewise was great value.

PiController

Details on how to use this controller with the CamJam Edukit #3 can be found on GitHub here

To get it all working we connected the motor controller board from the CamJam EduKit #3 to a Raspberry PiZeroW (That’s the smallest of the Raspberry Pi Models with WiFi and Bluetooth built in). We also connected two DC motors, also in the kit, to the respective connectors on the board as well as 4 x AA batteries using the battery box provided.

We booted up the Pi, switched on the controller and ran the CamJam EduKit  controller python program :

sudo python3 camjamedukit3.py

After a brief delay a response was seen in the terminal window to say that the controller was ready and pressing the Left Hand Joystick forward the motors sprang into life. To be honest they were very responsive.

If you have not got any motors yet you can still test the joystick by entering ‘jstest’ in a terminal window.

MonsterBorg Remote

The MonsterBorg comes with a couple of pre-written python remote control examples. One of these ‘monsterJoy.py’ worked fine with the Pi Hut Wireless Gamepad Controller. The controls take a bit of getting used to and in full speed the torque is a little too much to handle but we can customise the code to suit us.

Better Control Solutions

One problem that we encountered with the PiHut Gamepad Controller was that it intermittently cuts out. We were advised by PiBorg that this could be due to the limited power supplied to the Pi by 5v regulator on the UltraBorg. Anyway, we needed to find a more robust solution, to avoid embarrassment on the day. After doing some more research, we identified two options:

  1. RC Transmitter / Receiver
  2. Bluetooth

The more robust of the two would be a dedicated RC Transmitter / Receiver however interfacing these with the Pi to control the motors fitted to the UltraBorg, whilst not impossible, would take up far too much time as very little information is available on the subject. So we opted in the first instance to investigate BlueTooth.

BlueDot – Bluetooth

After asking the question on various Forums Jon Witts suggested trying out an Android App called BlueDot, written by Martin O’Hanlon.

PS3 – Bluetooth Solution

MonsterBorg Playstation Bluetooth

Challenges

Duck Shoot – Weapons System

For the Duck Shoot challenge we need to be able to fire a soft projectile, such as a Nerf Dart, so why not add a Nerf Gun. We did some research and at first thought how complicated it would be rigging up servos to pull triggers etc, but then found that Nerf Guns cam with electric firing – Hack On!!!

Somewhere Over The Rainbow

Somewhere over the rainbow requires OpenCV for image recognition. Included on the page where the sample code can be found is a link to a really good guide on how to install it. This is the guide we followed. Be warned, the build of OpenCV is pretty technical and take a good few hours to complete, it is not for the faint hearted. It did not run without error and I had to re-run it a few times to correct (my errors).

Object and colour recognition is some pretty intense stuff and we have never had to tackle anything this complex before. This week (01 March 2018) however we had a breakthrough OpenCV has been installed and after a lot of head scratching and research our Robot can now recognise a Red Ball and stop when it is close. Finding it, let alone the other three coloured balls however is going to be an even bigger problem. Mind mapping and Pseudo Code / Algorithms needed before we start to code this one!!

 

Sample Code:

https://piwars.org/2018-competition/challenges/somewhere-over-the-rainbow/over-the-rainbow-sample-code/

 

 

 

Bibliography / Reference

MonsterBorg and ThunderBorg Setup

https://www.piborg.org/blog/monsterborg-getting-started

PiBorg Forums

http://forum.piborg.org/forum

BlueDot Bluetooth App

http://bluedot.readthedocs.io/en/latest/index.html

Google Search For RPi / Arduino / RC Transmitter Receiver

https://www.google.co.uk/search?q=Raspberry+Pi+Converting+RC+Transmitter+PWM+using+Arduino&safe=active&source=lnms&sa=X&ved=0ahUKEwjMq5y4sqDZAhWIHsAKHWTWBVUQ_AUICSgA&biw=1460&bih=725&dpr=2

Arduino / RC Receiver

https://www.sparkfun.com/tutorials/348

RPi / ATTiny167 / RC Receiver

https://www.impulseadventure.com/elec/attiny-spi-rc-pwm.html

RPi / RC Receiver Solution Using Pololu RC Switch with Digital Output

https://www.hackster.io/Granpino/rc-for-raspberry-pi-89dbb7

Pololu RC Switch – https://www.pololu.com/product/2801

MonsterBorg PS3 Controller Bluetooth Solution

https://www.piborg.org/blog/monsterborg-examples-joystick-control

ThunderBorg Python 3

http://forum.piborg.org/node/2523

Raspberry Pi Camera Mount

https://www.thingiverse.com/thing:1579789

Pan Tilt Mount

https://www.thingiverse.com/thing:107957

GPIO ZERO Robot Scripts

http://bluedot.readthedocs.io/en/latest/recipes.html#variable-speed-robot

Somewhere Over The Rainbow – Sample Code

https://piwars.org/2018-competition/challenges/somewhere-over-the-rainbow/over-the-rainbow-sample-code/

OpenCV Install Guide

https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/#comment-450668

 

 

 

 

 

 

 

 

 

 

 

Advertisements

Robot Project

Introduction

This blog covers the build of my first ‘large’ and what I would consider to be ‘proper’ robot. It came about due to several factors, firstly because for a very long time I had been considering building a DALEK and decided it was time to start. Around about the same time I was (and at the time of writing, still am) in the middle of a British Computer Society Certificate in Computing part of which is a coding project for which I wanted to build a robot. Also just as I started the initial stages of the build Robot Wars was on TV and in school, where I teach, several of the children were talking about how to build a robot.

I studied peoples DALEK build on the Project DALEK forum and soon realise that building a full size DALEK is a big undertaking and to do it correctly (which I wanted to do) required a lot of tools that I just don’t have. So as I still wanted to eventually build a DALEK I settled the idea that I would build a large robot chassis that could later be used for the DALEK but in the interim would serve as a stand alone robot. Remembering something I read many years ago that said never take take apart a robot to build another one the idea would be that I would simply be adding a DALEK body over the original frame and moving some of the components around :-).

The Base

taking inspiration from some of the DALEK builds I set about constructing a frame using 2mm 20mm x 20mm boxed steel. I picked up the 3 x 2.1m lengths of box section from a metal fabrication shop on a local industrial estate for £15.

The base would initially consist of a rectangle made using 2 x 400mm and 2 x 200mm pieces of box section and would end up 400mm wide and 240mm long due to the fact that the 200mm lengths sat inside the 400mm lengths creating the extra 40mm (2 x 20mm). I cut four pieces for the first section and straightened off the edges. To help welding I also chamfered them. To ensure that the frame was straight I clamped the sections to be welded on a piece of plywood.

imag7993_zps0k4yehrn

First I tack welded each joint so that I could check the alignment and straightness of the corners using a set square and once the frame was tacked together I seam / butt welded all of the joints. Then I dressed down the welds (not completely to maintain strength).

imag7998_zpsgb20cilv

As I am impatient I did a test fit of the motors which were mounted by drilling our holes (two either side) through the box section. I do intend to weld a piece of flat bar onto the side pieces so that each motor will be held with four bolts. Whilst this is not necessary for this robot if I intend to sit inside the DALEK it will be needed to hold my weight.

I even wired up the original electrics to see it moving.

imag8002_zpsxmbqucp5

The next stage was to add a slightly angled front end using approx 600mm lengths (I will measure and edit this posts) your own lengths will be dependent upon your requirements. The welding process was the same using plywood to maintain alignment and spot welding all joints before going over them again.

imag8077_zps0wzudxna

Once the welds were dressed down I slapped on some Hammerite smooth.

imag8085_zpspxteegtv

All that is missing now is a castor for the front.

Electronics

On reading the DALEK motorisation guide I opted to use as much of the original wiring loom as possible. On my wheel chair there is a connector between the main control box / joystick and the motor and battery connectors. I decided to cut the loom off here but still leave enough wire to reconnect the joystick (if I ever needed to use it again). It took some time to work out what each wire was for. The two large red and black wires were the battery + and – (the batteries are connected in series somewhere in the loom hence only two wires at this end). The brakes are also connected in series so again only two wires exit the loom at this end (thinnest of the lot). The remaining wires are the Left and Right Motor + and -. After working out which wires wires which I stripped the ends and put them in a terminal strip which needs to be rated for the highest amp cable being inserted.

In the picture below the cables are as follows from the left:

  • Red – Battery +
  • Black – Battery –
  • Brown / Purple (two wires) – Motor 1 + and –
  • Black – Brake + or – (polarity does not matter)
  • White / Green (two wires) – Motor 2 + and –
  • Yellow – Brake + or – (polarity does not matter)

imag8089_zps4bmpkzpq imag8092_zps12c8cf1r

To help work out how to wire up the Sabertooth, as well as consulting the Sabertooth Manual,  I had to follow a couple of guides, one was a digital download on motorising a DALEK (Need to be a paid up member) and the other was this guide on building a Robot using an old powered wheel chair.

Fuse as recommended on some of the guides I have been looking at I installed an automotive blade fuse in line with the battery positive cable. I only had a 15Amp and a 10Amp available. The 15 Amp worked fine whilst I had the motors set to half speed but during a test I set them to full speed and after doing a couple of short turns I fried the 15Amp fuse!!

The Microprocessor(Raspberry Pi) – Initial Setup

The microprocessor chosen for the Robot was a spare Raspberry Pi 2. I decided to wipe a spare SD Card and start from scratch. Once the SD card was setup I did the following:

  1. Installed the latest Rasbian Jessie OS.
  2. Setup the WLAN to connect to my WiFi.
  3. Installed ‘netatalk’ a file sharing utility that allows my Mac to access the Raspberry Pi file system making file transfer a doddle.
  4. Downloaded and installed WebIOPi (used for serial and web control)
  5. You need to install a patch to get WebIOPi working with Pi2 Model B.

Use the installation instructions from the WebIOPi web page for detailed instruction on how to use WebIOPi.

To use WebIOpPi you have to start the webio service, after which WebIOPi is accessible on any other device connected to your LAN by entering the following as a URL in your web browser (insert your Pis IP address):

http://Pi IP address:8000

You will then be asked for the user name and password for WebIOPi which is ‘webiopi’ and ‘raspberry’ by default.

Next to test that WebIOPi is installed and working correctly I wired up an LED to GPIO 27 and using the GPIO header GUI available when you access the WebIOPi URL above. Set the GPIO pin to OUT by clicking on it and the click on the pin number itself to activate it. If everything is working correctly your LED should illuminate 🙂 I found quite a good guide here showing most of the steps above.

The Serial Code

To initially test that I could control the motors by sending serial commands over USB I wrote a short python script using information from the webiopi tutorials. Here is a link to my script on GitHub:

motor_test.py

N.B. you need to know the serial communications port that you have your motor driver connected to. To do this type the following at in a terminal on the Pi:

ls /dev/tty*

This will list all of the tty devices. Your motor driver will be towards the end. Mine was /dev/ttyACM0. To help you find it run this command before you plug it in and then again afterwards and notice any addition port listed. This will be your port number.

You can also enter the following command in terminal:

dmesg

or

dmesg | tail

This will give you the device details in plain english.

Make sure that you study the tutorial and add the correct serial port in the DEVICES section of the webiopi config file (/etc/webiopi/config).

Advance Software Setup

Now that we know that we can send serial commands to the motor driver from the Raspberry Pi it’s time to get down to the real stuff, configuring a web based control panel to provide remote control.

To make the remote interface I installed mjpg-streamer, this is a great piece of software that I used on my Biscuit Tin Telepresence robot. A good up to date guide on how to do this is here. Once mjpg-streamer is up and running you now need to create you web interface. The interface will consist of two things:

  • A html script for the web interface
  • A python script which will interpret the commands from the web page using webiopi and send the appropriate serial command to the motor driver.

When I tried to connect the camera and the motor driver the camera stopped the Pi from sending serial commands to the motor driver.

reboot before trying to verify your device is listed in /dev

For information on how to create a bash script use this guide here.

Bibliography:

WebIOPi: http://webiopi.trouch.com/

Engineering Life Plus Hacks: http://www.deviceplus.com/how-tos/raspberrypi-guide/raspberrypi_entry_030/

Building an RC Robot Using a Wheelchair: https://www.allaboutcircuits.com/projects/building-an-rc-robot-using-a-wheelchair-base-part-2/

Mjpg Streamer

https://bbs.nextthing.co/t/mjpeg-streamer-with-compatible-usb-webcam/6505

 

MINI Multimedia – In Car Entertainment (ICE) Information System

MINI Multimedia – In Car Entertainment (ICE) Information System

Introduction

The aim of this project is to create an In Car Entertainment (ICE) system with the ability to utilise additional technology such as web browsing, voice control, satellite navigation etc. The project is being designed for and will be installed in a classic Mini that I have recently finished rebuilding. The project build thread for the Mini is here if your interested.

Overview

Hardware

  • Microprocessor – The main computing hardware for the project will be a Raspberry Pi 3.
  • Display – The display was going to use an In Car DVD player as a display however I have since bought a 7 inch touch screen display specifically for this system.
  • Power Supply – The power supply will be provided by a dedicated car 12v PSU.
  • SD Card – In order to handle large data files such as video a music a Class 10 is SDHC SD Card should be used.

Software

At the time of writing there were several solutions of Media Centre software that could be used for this kind of project. RaspBMC, a version of XBMC for the Raspberry Pi, Open Elec, OSMC, a custom image of Rasbian and Kodi (formally known as XBMC) or Kodi installed on Raspbian Jessie.

Microprocessor and Display

The first step of the build was to setup the Raspberry Pi using a mains PSU, Keyboard, Mouse, Ethernet and standard display etc. This would ease the software installation process before fitting the touch screen. Once I had installed and configured the operating system I took the RPi out of its case and fitted it to the touch screen and then put the touch screen and RPi in the touch screen case.

Audio Output

Whilst looking for audio solutions for my project I found out that the audio out of the Pi 3.5mm Audio Out socket is pretty rubbish quality. The audio carried by the HDMI may be better but needs to be separated from the video signal using an HDMI splitter. When using the Display Serial Interface (DSI), which is used for the touchscreen that I am using, I do not think a HDMI will be present. You can run dual displays (I found a thread discussing it here) but I did not want to overcomplicate things. The single best solution to improving the audio is to use a Digital to Analogue Converter or (DAC) this outputs much better quality audio.

So, after doing lots of research, I decided to invest in a Digital to Analogue Converter DAC, which is designed to provide quality sound output. I opted for a pHAT DAC which is designed for a Raspberry Pi Zero but is compatible with all Raspberry Pi’s with a 40 pin header.

pHAT DAC (after soldering on the 40 Pin Header)

After the pHAT arrived I unpacked it and had a look at how it would fit. I had envisaged that it would fit inside the 7 Inch Touchscreen case but on looking I realised that this would be a problem because (a) the pHAT should sit on the GPIO headers but 3 of these are already in use and (b) if it was connected to the GPIO header the audio outputs would be difficult to access. I decided that a way to resolve this issue by connecting the pHAT to the Raspberry Pi using some ‘dupont’ header cables.

First the 40 pin header needs to be soldered onto the pHAT DAC. To help with this I followed this guide.

phat_dac

After soldering on the header pins and RCA socket, before connecting the pHAT DAC to the Pi using fly leads, I needed to work out which pins to connect. I managed to find information on the header pins that the pHAT uses from this post. Details on the pHAT DACE header pins can also be found here.

Here’s the pHAT DAC after soldering on the RCA connector.

phat_dac

Once everything was in place I connected the Raspberry Pi to the touchscreen and fired it up. However before using the pHAT DACE it needs configuring so that the Raspberry Pi uses it for sound as opposed to the built in audio. Details of how this is done can be found here.

Once everything was configured I fired up Kodi but no sound seemed to be coming out of the pHAT DAC but soon found that you had to select the DAC as an audio output device from within Kodi. BINGO High Resolution Audio (24-bits at 192KHz) booming out of my ‘Jam Touch’ speaker (the speaker I was using for testing)!! Also when a DAC is fitted such as this one the sound control options on the Desktop are disabled.

Amplification

The audio output from the Pi (covered earlier) would need to be amplified and I was hoping to achieve this using the Pioneer DEH-1600R radio that came with the car. It turned out however that this model radio did not have an Aux In. I searched and found some hacks. Generally the hacks involve using the radios ability to be plugged into a CD changer but my model had no such luxury. The other hacks hack into the CD player sound output but require a CD to be inserted and played with a blank sound file. I was not a fan of this and then luckily I found another hack which uses the un-amplified sound output from the onboard Radio Tuner.

Basically this hack involves finding the pins on the PCB where the radio tuner module is fitted and then poking around to find a suitable Gnd pin (some work better than others) as well as the Left and Right channel audio. Sounded like a great idea so I gave it a go.

One example of this hack can be found here.

After reading up about the hack linked above I set about dismantling my Pioneer radio.

imag7197
Main PCB

After removing the outer casing and CD deck I removed the main PCB. I then located the radio module and turned it over to have a look at the radio module pins. To my delight these are all labeled and clearly visible.

In the picture above you can see that the bottom pin (let’s call it pin 1) is labelled Rch. This will be the Right Audio Channel. and pin 2 is the Left Audio Channel. Labelled Lch.

After temporarily wiring up the radio with only the radio and main PCB and checking that it worked I set about wiring in a 3.5mm auxiliary audio connector. I managed to pull a 3.5mm audio connector from an old CD Rom Drive and after tinning three wires I soldered them to the audio connector.

In order to have a sound source I decided to wire up the Mausberry 3A Car Switch that I had bought to intelligently turn the Pi on and off, so that I could use the Raspberry Pi. Details on how to set it up can be found here.

IMAG7217.jpg

It all powered up fine so I connected the Raspberry Pi and played a music video. With one of the audio channel wires touching Rch an the Gnd wire touching BEGND the audio came out of one of the speakers. I also tried DGND and that worked as well.

I then soldered the aux audio connector to the back of the PCB and as there was not a lot of space I used DGND. I then re-assembled the radio with the aux audio leads trailing out of the rear and cable tied in place.

IMAG7219.jpg

When I powered everything up again and played a video I had audio coming out of both speakers, HOORAH, but there was a heck of a lot of ground noise, possible caused by a ‘Ground Loop’.

After some more poking around and help from RetroRides Forum I found that the ground loop problem was probably caused by either using DGRND as my ground point. I disassembled the radio again and this time I soldered the Gnd wire to BEGND. This turned out to be the correct Audio Gnd and solved the ground loop problem.

After making the above changes it sound pretty good but I had to have the volume cranked up to 20/30 and when there is no audio coming from the audio source you can here the white noise of the untuned radio station in the background. There is also some slight interference which seems to be caused by the wireless keyboard?

Here is a video showing the audio quality using this hack.

CD Audio Hack

With the noise from an untuned radio station using the Radio Module Hack I opted to backtrack and try the CD audio hack. I removed the radio and disassembled it AGAIN! Once it was all apart I had a look on the main PCB where the ribbon cable from the CD mechanism connects. Sadly the audio tracks are not clearly marked. I then had a look on PCB that is mounted on the CD mechanism and low and behold the audio tracks are labelled but not particularly clearly. I then identified the correct pins and following the ribbon cable back to the main PCB identified where the corresponding lines are on the this part of the device.

I then stripped, tinned and clipped the leads from my 3.5mm audio socket and using a magnifying glass mounted on a helping hands I managed to solder on my three leads. I checked for shorts using a multimeter, cable tied the leads to the PCB and with the leads routed through the radio I re-assembled it all again.

Once it was back in the car it powered up OK (at least I hadn’t broken it). To test the Aux you need an Audio CD filled with silent music tracks. With this CD in the CD player and the unit playing the CD I connected the external audio source and it worked fine. There is still some interference but it is only noticeable when there is no sound playing. This noise interference may also be caused by the Logitech wireless keyboard that I am using as the sound increases when the mouse moves.

New Radio

If like me you get really annoyed when searching for help for a project you are working on, finding what you think is a solution to your particular problem and then part way through the guy has dropped what he was doing and gone off in a different direction. Well if that’s you then I apologise because yes that’s what I have done. Although the CD hack does work fine I decided to buy a second hand radio with Aux In. So after cruising eBay looking at radios, amplifiers and speakers I ended up bidding on and winning a Sony CDX-GT26 CD / Radio. It is capable of a similar output as the Pioneer (4 x 45w) but like most Aux Inputs its on the front. Only expensive radios seem to have an Aux Input on the rear. I am not sure if I want a cable hanging out of the front so maybe I’ll hack into the aux socket from inside and run a cable out of the rear?

imag7260
Sony CDX-GT26

Whilst researching audio I have also been looking at Amplifiers and Speakers, specifically the XPLOD range, this amp and these speakers. UPDATE ended up ordering the XPLOD XM1004 but opted for some better Pioneer Coaxial Speakers. I bought the Pioneer TS-A6923i 6x9s

Here is the Amp:

screen-shot-2016-12-18-at-20-48-35

And here are the speakers:

pioneer-ts-a6923i

The photos are for reference only as I am not allowed to have them until Christmas!! The speakers are a lot larger than I had anticipated. I should have realised this as they are 6 x 9 inches after all!! I could fit them to the parcel shelf but this would involve chopping out some more metal. In the end I have decided to make up a speaker board and fit them under the rear seat. The amp is also quite large (34cm x 23cm) and will probably also go under the rear seat on a separate board either fixed to the floor or the underside of the seat (if there is enough room)?

Installing the Speakers

Well it turned out that the only suitable location for the speakers was under the rear seat. So I set about making a speaker board.

imag7490_zpsokxmyy44

Installing the Amp

After trying various locations to best place I found to fit the amp was in the boot, to keep it out of the way I decided to mount it upside down under the rear parcel shelf.

Wiring

There is quite a lot to consider when wiring in a system such as this with an amplifier into a Car and in order to ensure that I went in with some sort of an idea I did lots of reading on Car Audio Electronics.

Here are some of the useful sources that I found:

Basic Car Audio Electronics

Crutchfield Amplifier Installation Guide

Automotive Wiring and Wire Guide

12v Planet Cable Sizing and Selection

Whilst you could buy all of the wiring parts individually I opted to go for a complete wiring kit (of which there are many to choose from). Being a perfectionist at heart I opted for a kit with high quality products which meant that the wiring had to be 100% Oxygen Free Copper. After lots of research looking at many of the kits on the market I eventually came across one that fitted the bill without breaking the bank. The Rockford Fosgate 8 Gauge Complete Amplifier Installation Kit. This came with power, ground and remote cables, speaker wire and RCA signal connectors as well as an inline AGU fuse.

Setting Up The Touchscreen

For this project I used the official Raspberry Pi 7 Inch Touch screen. A good guide can be found here and the PiMoroni one can be found here .

I also bought an official case for the touchscreen:

imag7286_zpsmeaywyal

In hindsight whilst the case is really good for a stand alone inside the car it may not be a good idea. I had real trouble working out a way to secure the screen in my custom dash and after installing the system for the first time it failed and I needed to remove it. This was a real pain so I think the best option would be to fit the screen in the dash and have an extra long video cable and have the Pi mounted somewhere more accessible. This would help with things like changing SD cards and general troubleshooting etc more later in this blog.

Software Build

For the software side of things, first I downloaded the latest version of Raspbian Jessie. Then I flashed the image to the SD card, as I am a Mac OSX person I used terminal to do this.

Once Rasbian (Jessie) was on the SD Card I fired up the Pi and saw for the first time the Sept 2016 edition of Jessie. Mmm not sure if I like the way this has gone, seems a little Microsoft Windows 10 for my liking!! Anyway first task with any new installation is to update it. To do this I did an update and upgrade by running the following at the terminal:

sudo apt-get update

then;

sudo apt-get upgrade

This took about 20 minutes to complete after which it is always advisable to reboot the system so that any changes take effect. There are several ways to reboot but whilst in terminal you can simply enter:

sudo reboot

After the reboot in the new version of Raspbian you will see a message telling you that some of your config files may have been overwritten. The message also tells you were backups of your original config files are located.

I installed netatalk to ease transfer of media files as follows:

  • In  Terminal type – sudo apt-get install netatalk
  • On a Mac click the Go menu / Connect to Server
  • Enter afp://<ip address of your Pi>.
  • Click connect and you will be prompted for a user name and password, this will be the user name and password for your Pi not your Mac.
  • A finder window will open showing the contents of the RPi.

Rotating the screen

If you need to rotate the screen you need to edit /boot/config.txt and add the line: lcd_rotate=2 to the top.

You can do this in Terminal by entering the following:

  • In Terminal, type “sudo nano /boot/config.txt”
  • Add the line “lcd_rotate=2” to the top of the file.
  • Press CTRL+X
  • Then Y
  • Then Enter.
  • And reboot!

Install Kodi

Next up was the installation of Kodi which, according to the Wiki can be achieved in Raspbian by simply installing it in terminal by entering:

sudo apt-get install kodi

After Kodi was installed again it is a good idea to reboot the system as above.

Setting Up Kodi

Once kodi is installed it needs to be configured to work with your setup however, the pre car setup may be different to the incar setup (Internet access using 3g or WiFi) Hot Spots, media file locations etc). As this was my first ever build I decided to set it up to work on my LAN get to know how it works, tweak it and then make any changes necessary for use as an ICE.

You can either start Kodi from terminal or from the start menu, I used the start menu in case I missed any options?

When it first fires up it will check for updates etc. Quite often messages will appear saying XXX is broken do you want to remove it (or something like that) for now I just declined. Kodi will also do a version check and complain that you are using v15.2 when v16.1 is available. At the time of writing from what I have read Rasbian is limited to v15.2.

It all fired up fine first time however as I had no media it was a bit of a non test? Another problem is when exiting Kodi it seems to power off the Pi. This may have been due to opening Kodi from the start menu in full screen and not from the terminal as a windowed program (if this is indeed possible)?

After some looking around on the Internet I found some interesting information that I had not come across before on using Kodi in the fashion that I wanted as an ICE. The blog can be found here. However whilst I was waiting for answers to some of my enquiries I had a look at Kodi and found a skin designed for use with a Touch Screen. The skin is called re-Touched and is easily installed in the system settings.

One issue I found was that the touchscreen mouse click was not responding. After a quick search on the internet this was fixed by changing the mouse click speed in system settings.

 

Screen Sleeping 

After everything was setup there where still a few problems. After a specified time period, the screen will sleep, it can easily be woken up by touching the screen however when Kodi is running there is no such luxury, once its asleep it cannot be woken up!! I searched for a solution for ages and found that this was an issue when using Kodi on a Raspberry Pi. Kodi opens in full screen and not in a window. Eventually I was pointed to this potential solution, It worked a treat – no more sleeping.

Music and Video

As this is an entertainment system it needs some media to play. I already had loads of videos and music and to transfer it I installed netatalk on the Pi. On a Mac having netatalk installed on the Pi allows you to open an AFP connections which opens a window allowing access to folders on the Pi. You could of course simply transfer files using a USB stick.

Input

As this is an in car system I needed a wireless setup. For this system I used Logitech wireless keyboard and mouse combination, perfect for use in the car (by the passenger of course).

Installation

As mentioned earlier in this blog I had some issues when it came to installing my setup in the custom dash that I was building. At first I tried to install the screen with the Pi fitted however this proved to be an error as after a couple of days due to a wiring problem the SD Card became corrupted and I had to remove the dash to get at it – school boy error!!!

Here is the first attempt with the Pi fitted in the touchscreen case:

imag7803_zpsyqy1dqid

And then I removed everything and fitted the extra long ribbon cable:

imag7836_zpscwampq3u

Plan B

I decided to remove the Pi and mount it in the glove compartment making it accessible. To achieve this I bought a 75cm ribbon cable for the screen a USB to 2 x Micro USB splitter cable (one for the Pi and one for the screen) and a USB cable with a switch. The switch is needed to turn off the Pi after it has shutdown otherwise as soon as the ignition is switched on it would fire up.  Sorry no pics 😦

Car Specific Wiring:

When fitting the Pi, Screen, all of the new instruments and a Radio in the car, as well as running a new dedicated power supply for the Amplifier from the battery, I opted to fit completely new wiring for the remainder.

Car radios need two 12v supplies one switched (comes on when the ignition is switched on) and one constant supply (to maintain radio stations in the radios memory etc). I ran a new 12v constant from the cars solenoid rated at 15Amp and a 10Amp rated switched supply from the cars fuse box.

The power for the instrument lighting also came from the fuse box as there was a spare connector fitted to the cars Instrument panel fuse. This meant that the instrument lights came on when the headlights were switched on.

As with the amplifier a lot of information regarding what gauge wiring and where to fit fuses came from a great website called Basic Car Electrics. Basically the wire needs to be of a suitable gauge / amperage rating for anything that it is supplying.

The Finished Article

imag7847_zpsuhhis2yq

Well it’s not actually finished but it is in and working. Here is a video showing the interior with the entertainment system working (sorry more Ironman themed AC/DC!!). Oh the engine was running that’s why the rev counter was at 1500 rpm but you can’t hear it – probably due to the music 🙂

Additions

As this is based on Raspberry Pi there are endless possibilities for addons, these could include voice control, GPS mapping etc? The voice control will be developed alongside Pi Central, which is another of my projects. The only issue I have at the moment is that I have installed the pHAT DAC using a stacking header but as the header pins have been soldered onto the pHAT DAC I cannot use any of the GPIO. I may have to go back to my original option and connect the pHAT using fly leads. I would also like to build a custom case to fit everything in.

Useful Links and Bibliography

In researching and building this project I found information from the following web sites or forum posts useful and I would like to thank everyone involved for their help.

Everything you need to know to integrate your Raspberry Pi in your car

Car PC using Raspberry Pi and Kodi Car Skin

Engineering(DIY)

Engineering DIY Index

Pi 3 + pHAT DAC + 7 Inch Touchscreen in Case

Build your own car PC

Raspberry Pi 3 Kodi Tutorial

12 Volt Planet (Cabling Help)

Basic Car Audio Electronics

How to fit a head unit from Scratch in a Mini (old thread with some photos missing)

Pi Camera HDMI Extension

3D Printing

Hi and welcome to my blog on 3D printing the aim of which is to share my experiences in this immersive subject and hopefully pass on some useful information.

The Beginning

As soon as I heard about 3D printers and the ability to ‘make’ real objects, I was hooked. I didn’t see an actual 3D printer for a long while but spent lots of time reading about them and watching videos and as a result I decided very early on that I just had to have one.

ultimaker2plus_0

Probably the first 3D printers I actually saw were in a FabLab in Exeter, I think they were Ultimakers but I am not so sure. I did then see an Ultimaker 2+ in the flesh at the BETT (British Educational Training and Technology) show in London. It looked and sounded great but at around £2800 was just way too expensive.

Along the way I did find what seems like a great little pre assembled printer. The Fabrikator II Mini. This is available from HobbyKing and retailed at the time of looking for around £160. I have just looked again and they are now £123 (absolute bargain). The build size is restricted to 100mm x 100mm but that is reflected in the price.

FabMiniII

Buying a 3D Printer

Before eventually buying a 3D printer I spent a great deal of time finding out about them, what different types there were, what they could do and more importantly why should I get one. I looked initially at assembled printers, mainly I guess because that’s all I thought was available. I looked at makes such as FlashForg and Ultimaker but everything was either out of my budget or just didn’t tick all the right boxes.

3D Printer Kits

Whilst looking for the right model to buy I came across the term RepRap, a repRap printer is basically a 3D printer in a kit for that you build yourself. Until now I did not even know that you could buy a 3D printer in a kit – how exciting I thought. The purpose of the RepRap project was to produce a self replicating machine, basically you build a 3D printer and use that printer to make another one. It is not quite as simple as that but that’s basically the ethos of RepRap. A DIY RepRap 3D Printer in kit form seemed like the ideal solution and a cheaper way of getting my hands on one.

After looking at lots and lots of different DIY kits and working out the pros and cons of each of them I short listed two. The Anet A8 and the Hictop Prusa i3. I nearly bought the HicTop because of it’s more sturdy aluminium frame however after a lot of soul searching, head scratching and more research the Anet A8 won. The deciding factor was support. The Anet A8 has a massive user community and once I purchased it I found that this support was and is absolutely fantastic.

AnetA8

I bought the Anet from GearBest, a Chinese re-seller, I knew it would take a while to be delivered (nearly 30 days to be exact) but I was not in a massive rush and buying from China saved me money. In the end I managed to get it for around £109 (which included insurance and free shipping). A trick when buying it was that if you order the UK plug model it was about £50 more expensive, but if you bought the US or EU version it was cheaper and they send you an adaptor based on the country it is being shipped to. I bought the EU version to ensure that the PSU would be 220/240v however they all come with a switchable 110v / 220v PSU anyway – bonus!!

Anet A8

My Build

After deciding on which printer to buy, I finally ordered the printer on the 24th November 2017. After waiting patiently it finally arrived on the 23rd December 2017 at around 16:30 (just in time for Christmas).

 

 

 

It arrived very well packed but with everything being placed between three layers of polystyrene. As it was a Christmas present I was not allowed to officially open it until after Christmas (apart from checking for obvious damage). I was also not allowed to build it until I had finished a previous project that I started in the Summer (building a Man Cave) where ultimately the printer would sit. So, no shed, no printer.

I did decide however to carry out the electrical checks to confirm that it all works.

Upgrades

Whilst researching this printer I had identified that there were a whole load of upgrades available for this printer. Some of the upgrades are printable whilst others need to be bought. The point of upgrading the printer is that, although out of the box it will work, with a few upgrades this soon becomes a great printer. Some of the upgrades that I opted for were Mosfets to divert power for the Hot Bed and Extruder from the MainBoard, a sheet of borosilicate glass to print on, replacement GT2 belt for the motors, a Fused 3 Pin Socket to enable the printer to be turned on and off without having to remove the power cord. PSU cover, Mosfet stand, Frame Supports and Belt Tensioners to name a few.

Build Videos

There are plenty of build videos available and on the supplied SD card (or linked from the GearBest sales page) you can find printable build instructions and links to the official videos on YouTube.

Here is a link to the dropbox site with the contents of the SD card.

Electrical Tests

As is stands, from a UK perspective, straight out the box, printer is not particularly safe. The mains leads are screwed into terminals on the PSU and apart from a small plastic cover, they are exposed, which could lead to electrocution. Until I could build the printer properly I decided to go with the power lead that was supplied with the printer for testing purposes only.

Anet_Electronics

 

 

First test was the PSU itself. The wires came pre-stripped and tinned so I simply inserted them into the respective screw terminals and secured them in place. At first I did not think that the PSU connectors had been labeled as the build videos that I was following all had a white stick on label. I then noticed however that the connector names are actually embossed in the case above the terminal. Terminal 1, 2 and 3 are Live (Brown), Neutral (Blue) and Ground or Earth (Yellow / Green). All these are UK colour coded. The remaining 6 terminals are the 12v outputs (3 (-12v) negative / common / ground and 3 (+12v positive).

Before connecting the 12v leads I tested the output using a multimeter. My 6 terminals read – and + 12.54v.

Next job was to connect the 12v outputs for the  mainboard.

 

 

 

Before connecting anything make sure that you disconnect the PSU from the 240v mains supply.

Contrary to the leads shown in many of the build videos (apart from the 240v cable) mine all cam with a 2 blue forked crimp connectors fitted making them easier to fit. Whilst comparing the build videos to my mainboard connections I noticed that the polarity on my 12v power connections on the mainboard were reversed. This is marked on the mainboard with a + to the left and a – to the right of the far left hand connector. Connecting these incorrectly would lead to a damaged  mainboard!!

Also notice in the far RH pic that the screw terminals are only soldered to the mainboard via the connections themselves there is no additional support so make sure you take care not to overtighten or you may snap the terminal block off of the mainboard.

Next – Connecting everything up.

 

 

 

Connecting everything to the mainboard is relatively simple, everything is labelled. One thing that diod confuse me was the polarity of the Hot Bed power connections. As you can see in the LH pic I connected these with the + on the RH side and the – on the left. This is in sync with all ot the build videos that I could find but it would appear that the polarity for the power to the Heat Bed does not matter?

After connecting everything up I followed one of the electrical testing videos and checked the fans, the motors, the end stops, Heat Bed, Hot End heater and Extruder motor. As far as I could see everything operated OK. I did not however like the push button menu system. Upgrading this is not essential but I do believe whilst researching everything else I came across some info on replacing the LCD for a rotary knob version?

Building The Frame

When building the frame there are a couple of things to consider. First up all the ‘Shi Shun’ acrylic parts that frame is made of are covered in a brown protective paper. You will need to remove this. The best way to remove this material is slow and steady. If you just try and pull it off it will tear everywhere and it will take forever. Start at one end and start to peel off the paper pull it nice and slowly and every time you get to a corner or  cut out it will want to tear in the weakest spot. To avoid the paper tearing pull it towards the weakest area and as long as you are gently it will continue to lift. After sussing out this method I managed to get most pieces off in one go.

The other issue was working out which screws are used where. This was solved when I realised that in the build instructions, eventually found online (mentioned earlier in this blog) there are pictures of the nuts / screws etc for each of the build steps. These are also shown in the official videos.

First I started with the main frame:

 

Anet_Main_Frame

Then I built up the rear panel that houses the Y Axis Motor:

 

 

Then the bottom frame to house the Hot Bed:

 

 

Before installing the Hot Bed Frame Bearing Housing I removed the original bearings and fitted the Igus DryLin self lubricating bearings. These were one of the suggested  upgrades to reduce noise.

Next I installed the HotBed supporting H Frame. As advised somewhere I installed this upside down, this allows for better running of the belts. Once it was all in place it seemed rather stiff. I loosened and then re-did some of the screws which help somewhat.

IMAG9625

After fitting the belt however the Y Axis seems a little stiff (maybe that’s normal) but there is an annoying ratchet noise that seems to be coming from the motor but only when it gets halfway to the front?

IMAG9626

The screws that hold the Y Axis to the aluminium H frame are inserted into threaded holes, two of theses threads failed but I managed to fix the problem by fitting some M4 washers and nuts that I picked up from my local hardware store.

To address the stiffness I may loosen off some of the nuts and bolts and check all the angles with a set square and re-adjust and see if that helps.

HyperCube

9a7992ef0b766a7c55fbc20530dc7c8b_preview_featured

Before deciding on the final model that I would buy I came across the ‘HyperCube’. The ‘HyperCube is basically a hybrid DIY printer built using an aluminium extrusion frame. The first HyperCube was built by an Australian gentleman going by the pseudonym Tech2C. The first one that I came across though was a remix being built by Fugatech.

It is a great looking machine and like anything RepRap completely customisable.

 

References

http://reprap.org/

http://www.anet3d.com/

 

 

This is a featured content post. Click the Edit link to modify or delete it, or start a new post.