This is a 'Lite' version of a previous project, the Touchscreen Display and Rechargable Battery Pack for the PiKon. While it uses the same touchscreen and point-and-click user interface, it does not include the rechargable battery, it is considerably lighter, and is also a little slimmer.

If you intend to run your PiKon Telescope / Raspberry Pi indoors close to mains power, or if you already have your own Pi battery power pack, then the TED VDU Lite is the one for you. If you require portability and mobility I suggest you check out the battery powered version mentioned above. If you are unfamiliar with the PiKon Telescope, please refer to the background story outlined below, links are provided for more information.

The PiKon 3d Printed Telescope

In 2014, Mark Wrigley of Alternative Photonics along with Andy King, a Physics and Astronomy research associate at the University of Sheffield, created the PiKon 3d printed telescope. Based on Newton's reflecting telescope design it uses a Raspberry Pi and the PiCamera module, with the camera mounted directly in front of the mirror.

I've always had a curiosity for astronomy, but was never keen enough to invest any money in purchasing the necessary equipment. But when the PiKon project featured in the news it was something that really captured my imagination. A year later in 2015, the PiKon turned to crowdfunding, giving everyone the opportunity to get their hands on one. Be it fully assembled or in a kit form that you can 3d print and assemble yourself, I wasted no time in reserving my perk and was eager to start my build.

The TED-VDU incorporates the following features:

  • 3d Printed enclosure
  • 2.8" Resistive touchscreen TFT display
  • A single cable to link the VDU to the PiKon (15-way HD15 cable)
  • Based on the Cam.py point-and-shoot digital camera user interface

While I designed this for the purpose of adding simple functionality and a friendly UI to my PiKon telescope, the TED-VDU can be used for any Raspberry Pi project that would benefit from an external touchscreen display.

Mark Wrigley has published an Instructable for the PiKon Telescope, you can find it here

Step 1: The PiKon Telescope

This instructable assumes that you either already have a working PiKon telescope, or you will be assembling your PiKon by following the instructions provided with the kit. If you don't have a kit yet they are still available to order via the Indiegogo crowdfunding site (link below). Some of the kits include a Raspberry Pi and the camera module, but you can purchase the Pi and the camera separately if you prefer. To build and test your TED-VDU you only need a Raspberry Pi with the Pi Camera module.

For the PiKon to integrate nicely with the TED-VDU, you will need to 3d print a modified version of the PiKon Pi mount. This is to incorporate the HD15 cable connector, the STL file is included with this instructable and is the only part required that differs from the original PiKon kit. I have also included the STL file for a modified version of the PiKon focus knob, I re-designed it to include some grips.

Step 2: Parts, Components and Tools

To build the VDU you will need the following tools and equipment:

  • Soldering Iron (also recommend a helping hand)
  • Wire cutters
  • Wire strippers
  • Pliers (small)
  • Phillips-head screwdriver
  • Multi-meter
  • Hot-melt glue gun
  • Super-glue

You will need the following parts and components:

Step 3: Mount the PiTFT in the Enclosure

Before we can use the 3d printed enclosure you will need to remove and clean-up any support material left over from the printing process. This is typically located around the D-Sub connector. There is also a small cut-out in one of the corners, be sure to remove the support material from this as well or the PiTFT's PCB won't fit properly.

To mount the PiTFT in the enclosure we will be using three of the M2 nuts, take care and follow the guidance below:

  1. Place the M2 nut into the hex cut out, being careful to align the rotation of the nut with the hex shape.
  2. Apply sufficient pressure to push the nut into place, the hex shape is designed to be a snug fit to help hold the nut firmly.
  3. If you need to remove the nut for any reason, you can screw in a M2 screw a couple of millimetres and use it to pull out the nut.
  4. Once you are happy that the nuts are properly seated you will need to use a couple of drops of superglue on each nut to secure it in place. Apply the glue around the outside edges of the nut, taking care not to spill any glue into the thread as you don't want to risk blocking it.

With the M2 nuts glued in place it's now time to test fit the PiTFT screen. The screen should fit snugly, and finish near enough flush to the front face of the enclosure. You may need to remove the protective film from the screen during this process as it can get in the way, but be sure to re-attach it to the screen afterwards to prevent scratching the surface.

If for any reason the screen won't quite fit in all the way properly, you can use the back edge of a fine flat-blade screw driver to remove a thin layer of plastic material from around the side frame of the enclosure.

Once you are happy with the fit of the PiTFT screen, it is secured in place using the M2 screws. The ideal screw length is 4mm though these are not easy to find, anything longer than this will require washers to be used to pack out the screw head, reducing the length that drives through the nut. In my case I used 6mm M2 screws with 4x washers on each screw.

Step 4: Breaking Out the Pi GPIO Headers to the HD-15 Connectors

This step is probably the most tedious of all the steps, breaking out the GPIO header pins and wiring them to the HD-15 connector.

You will be breaking out two flat ribbon header cables into HD-15 connectors, one for the VDU/PiTFT side, the other for the RaspberryPi/PiKon side, the VDU and the PiKon are then linked together via a HD15 cable.

To wire the VDU / PiTFT GPIO header to the HD-15 connector, follow these guidelines:

  1. Take the 26p to 26p GPIO header ribbon cable and cut the IDC connector from one end.
  2. Divide the individual cores, taking care not to damage the insulation.
  3. Cut the redundant cable cores.
    • Only pins 2, 4, 6, 9, 12, 13, 15, 16, 18, 19, 21, 22, 23, 24 and 26 are required.
  4. Trim the remaining cables to the desired length (with the IDC connector inserted into the PiTFT the cables need to comfortably reach the D-SUB HD-15 connector cut-out on the enclosure).
  5. Strip approximately 3mm of the cable insulation and twist the cable strands, then lightly tin with solder
  6. Solder each cable to the HD-15 connector pins in turn, as per the wiring diagrams provided (take care not to short any pins and try not to have any excess wire exposed from the insulation).
  7. All required pins are wired directly from the GPIO header to the HD-15 connector.
  8. Once all the pins have been soldered, visually inspect for any potential problems then test for shorts with a multi-meter. Make sure the GPIO header is not connected to the PiTFT as this may produce false-positives.

To wire the Raspberry Pi / PiKon GPIO header to the HD-15 connector, follow these guidelines:

The same steps as above apply, with the exception of a few minor differences.

  1. If you are using an A+ or B+ model Pi with a 40 pin header you will either need to source a 26p to 40p cable, or simply take a 40p cable and cut away the redundant 14 cores.
  2. Before soldering the ribbon cable to the HD-15 connector you need to make sure you feed the cable through the slot in the Pi Mount top cover.
  3. Trim the ribbon cable to the appropriate length, try to avoid having unnecessary excess.
  4. There is no need to divide the individual cable cores beyond a couple of inches as you want the ribbon cable to remain mostly intact, any divided cable should remain within the enclosure.
  5. Cut the redundant cable cores up to the point where the cables have been divided.
  6. Strip approximately 3mm of the cable insulation and twist the cable strands, then lightly tin with solder
  7. Solder each cable to the HD-15 connector pins in turn, as per the wiring diagrams provided (take care not to short any pins and try not to have any excess wire exposed from the insulation).
  8. All pins are wired directly from the GPIO header to the HD-15 connector.
  9. Once all pins have been soldered, visually inspect for any potential problems then test for shorts with a multi-meter. Make sure the GPIO header is not connected to the Pi as this may produce false-positives.

To secure the HD-15 D-Sub connectors to the enclosures, M2 screws with washers and nuts are used. Hot-melt glue is applied around the connector pins to act as a strain relief.

Step 5: Testing, Finishing Touches and Summary

Before you complete the assembly and secure the cover and back panel, you want to double check all of your connections and wiring, I'd suggest you test all of your soldered connections for shorts using a multi-meter.

If all the above passes without a hitch, you are ready to apply some finishing touches, then secure the cover and back panel to the VDU and the PiMount enclosures. There are mounting holes included in the enclosure design, you can either use M1.2 self-tapping screws or simply secure it with hot-melt glue. The top cover of the PiMount is also glued on.

Important note regarding HD-15 / VGA / SVGA cables: HD-15 cables are commonly used for VGA monitors and often with these cables not all the pins are wired, many of them are wired to ground. As the PiKon VDU utilises a minimum of 11 pins you need to take care when selecting an appropriate HD-15 cable. If you plan on using a HD-15 VGA cable that you already have, I strongly suggest you use a multi-meter to verify if it is an all-pins wired cable. Using a cable with many of the pins bound to ground can short the GPIO pins and potentially damage the Pi and/or the PiTFT.

If you need to purchase an HD-15 cable that is suitable for the VDU, you can purchase one from Cabling4Less. Although this cable is listed as "all pins wired" some of the pins on the middle row and bound together for VGA ground.

To sum-up what we have covered in this Instructable so far:

  • We briefly covered the origins of the PiKon Telescope and the VDU project.
  • Listed the required tools, parts and components
  • Mounted the PiTFT to the 3d printed enclosure
  • Broke out the GPIO header to the HD-15 connectors
  • Performed some basic tests and inspections
  • Applied the finishing touches and secured the cover and back panel

With the hardware all taken care of that only leaves one final step, setting up the software on the Raspberry Pi.

Step 6: Raspberry Pi Software Setup

Before you can start using your newly assembled VDU/PiTFT you need to setup your Pi to enable the kernel support. Adafruit have a set of step-by-step DIY installer instructions as well as a ready to go Raspbian image pre-loaded with the kernel, links to these are provided below:

Download the Jessie-based PiTFT image for Pi1 and Pi2 (September 24, 2015) from Adafruit

Download the Wheezy-based PiTFT Image for Pi1 and Pi2 (September 9, 2015) from Adafruit

DIY installer instructions on Adafruit

Once you have installed the kernel and configured the Raspberry Pi as instructed above, you should now have a working PiTFT and touchscreen.

By default the Pi Camera is controlled using the command line interface in terminal. To make the PiKon more user friendly I wanted more of a point-and-click approach to the UI. To achieve this we'll be using the Cam.py program from the "DIY WiFi Raspberry Pi Touchscreen Camera" project. This provide an easy-to-use UI, as well as support for DropBox and extra features such as adding visual effects to your photos.

If you are using the Cam.py program mentioned above or you plan on creating your own UI using PyGame, you may need to downgrade the SDL on your Raspian OS. There are some incompatibilities when using SDL 2.x and SDL 1.2.15-10 with a touchscreen. To check which SDL version you are running type the following command into a Raspberry Pi terminal:

dpkg -l | grep libsdl

The following value needs to be returned:

ii  libsdl1.2debian:armhf      1.2.15-5+rpi1      armhf      Simple DirectMedia Layer

If you have a newer version you need to correct this by downgrading your SDL version, follow the steps below or see the article on the Adafruit forum for more info:

Create/Edit a new file with:

sudo nano installsdl.sh

Paste in the following text:

#enable wheezy package sources
echo "deb http://archive.raspbian.org/raspbian wheezy main
" > /etc/apt/sources.list.d/wheezy.list
#set stable as default package source (currently jessie)
echo "APT::Default-release \"stable\";
" > /etc/apt/apt.conf.d/10defaultRelease
#set the priority for libsdl from wheezy higher then the jessie package
echo "Package: libsdl1.2debian
Pin: release n=jessie
Pin-Priority: -10
Package: libsdl1.2debian
Pin: release n=wheezy
Pin-Priority: 900
" > /etc/apt/preferences.d/libsdl
apt-get update
apt-get -y --force-yes install libsdl1.2debian/wheezy

Save the script created above and run:

sudo chmod +x installsdl.sh
sudo ./installsdl.sh

This will force SDL to 1.2.15-5, you should now be ok to continue with PyGame or Cam.Py

In the next step we can make some customisations and tweaks, these include adding a splash-screen, making Cam.py start automatically when we switch on the Pi as well as shutdown when we exit Cam.py, also disabling the red LED on the Pi Camera module. As I'm using the Cam.py with my PiKon telescope, we also need to add some additional code to rotate and flip the image to compensate for the reflecting mirror and allow for the camera rotation.

Step 7: Customisations, Settings and Tweaks

Standalone Mode

You can set the Pi to boot straight into the Cam.py software at startup by editing:

sudo nano /etc/rc.local

Add the following lines before the exit 0

cd /home/pi/adafruit-pi-cam-master
python cam.py

Next time you boot it should show the text console for a few seconds then start Cam.py.

Auto Shutdown

To have the Pi shutdown when exiting the Cam.py software simply edit the rc.local file as above and add the following line after python cam.py but before exit 0

shutdown -h now

Increase Camera Speed and Redraw rate

This is a performance improvement to make the camera more responsive, do the following:

sudo nano /boot/config.txt

Look for the dtoverlay line near the bottom and update the speed and fps values:


Disable the Red LED on the Pi Camera Module

If like me you are using your Raspberry Pi Camera on the PiKon telescope, you'll probably find that the red LED on the camera can add unneccessary glare on the mirror. If you bought your camera as part of the PiKon kit you normally find that there is some black removable paint covering the LED. If you want to make doubly sure that your LED is not glaring across your mirror you can disable the LED via a software setting, just do the following:

sudo nano /boot/config.txt

Add the following line to the end of the file:


Reboot the Pi and the next time you use the camera, the LED will be disabled.

Rotate or Flip the Camera Orientation when using the PiCamera Module

These commands apply when you are using the python-picamera module, the code below specifically applies to the Cam.py program. At around line 170 of the Cam.py file, you can add/modify the various values supported by the picamera module, in this example we are adding vflip and rotation values.

# Init camera and set up default values<br>camera            = picamera.PiCamera()
# Adjust camera orientation to compensate for mirror and rotation
camera.vflip     = True
camera.rotation      = 90
camera.resolution = sizeData[sizeMode][1]
#camera.crop       = sizeData[sizeMode][2]
camera.crop       = (0.0, 0.0, 1.0, 1.0)

More information on the python-picamera interface is available here.

Add a Splash screen to the Cam.py Program

If you want to add some customisation to your Pi based camera, you can easily add a splash screen by having the program load an image during startup. To do this you'll need to upload your chosen image to the Pi, I suggest you size the image to 320x240 to match the PiTFT's resolution. Add the following line to the Cam.py file at line 41:

# Display Third Earth Design - PiKon splash screen on start-up with 5 second delay
os.system("sudo fbi -T 2 -d /dev/fb1 -noverbose -a tedpikon320x240.jpg")

Replace the file name with the path and name that matches your image, I've used the time.sleep command to keep the splash screen on long enough to see it properly.

Step 8: Finished!

You've completed your build, setup the software and made some tweaks, now it's time to have some fun with it! I've included some of my moon snaps above, I hope you find the Instructable helpful, please let me know if you have any comments or questions, they are always welcomed.

<p>wahooo! that's amazing! </p>
<p>Thank you :)</p>

About This Instructable




Bio: Making and tinkering for fun. Dreaming of doing it full time.
More by ThirdEarthDesign:All-Day Breakfast in a French Toast Sandwich Hand-etched Spiderman Light With 3d Printed Base The Ultimate Coke Float With Coca Cola Flavoured Ice Cream 
Add instructable to: