Elite dangerous controller

Whilst ordering some new arts for a couple of projects, I came across the zero delay arcade by Reyann.

board

It is intended for raspberry pi etc. controls for creating arcade consoles and appears to be USB plug and play so I thought I’d give it a go and make some additional controls for elite:dangerous.

dscn4619

This prototype has been lovingly crafted for the cardboard box that my delivery arrived in. No setup required and it just plugged in and worked.

The kit comes with the wiring loom and usb cable so it’s just a case of slipping the buttons on to the wires and off you go. It connects perfectly with the arcade buttons but not so well with the smaller tactile ones which required some structural blu-tak – a couple of mins soldering would fix it but these buttons are only temporary.

dscn4610

Windows sees it as a generic controller and E:D responds in a similar way, so there is no issue in assigning the buttons to the massive list of controls available (copy and save your key binds though. They’re very fickle).

The arcade buttons themselves are made by Sanwa and are spot on arcade quality – you can roll your finger on them like a real arcade machine and they feel like they could go on forever.

The joystick too is a Sanwa item and just oozes quality.

The larger buttons are (I think) from Adafruit. They are a bit more clicky than the arcade ones but very tactile. The 100mm HAL special in the middle is impossible not to touch and brings out the father dougal in everyone.

lit

They also light up, I’ve not tried this yet but it looks to be pretty straightforward and some of the online pictures make them look very effective (e.g. the HAL 9000 replica on adafruit )

dscn4616

For a prototype it works perfectly and the next step is to work on the case and assemble the required buttons. This was pretty much thrown together to see if the board worked however having played for a bit today the HAL9000 / pacman mashup has really grown on me so I think I’ll keep it!

dscn4617

In summary:

Controller board

By Reyann. mod my pi link: https://www.modmypi.com/raspberry-pi/arcade/arcade-controllers/zero-delay-arcade-usb-encoder-and-wire-set/?search=arcade

Arcade buttons

 By Sanwa – mod my pi link : https://www.modmypi.com/raspberry-pi/arcade/arcade-buttons/official-sanwa-arcade-button-black/?search=sanwa%20arcade%20buttons

Arcade stick

By Sanwa Mod my i link : https://www.modmypi.com/raspberry-pi/arcade/arcade-joysticks/official-sanwa-8-way-arcade-joystick-jlf-tp-8yt/?search=sanwa

Illuminated buttons.

By Adafruit. Mod my pi link : https://www.modmypi.com/electronics/buttons-and-switches/massive-arcade-button-100mm-red/?search=arcade%20buttons

Trailcam – 8. updated

Other sections

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list
  8. Updates

Pi

The first main alteration has been to swap out the pi model A for a pi zero, partly to save power and partly to save space.

inside, showing the massive tangle - hopefully soon a longer pi zero -> camera cable will be available.
inside, showing the massive tangle – hopefully soon a longer pi zero -> camera cable will be available.

The main board is set up for a 26 pin header and not the 40 pin of the pi zero, so for the time being I’ve chopped a section out of a spare 26pin connector so that it fits. I intend to convert the whole setup to 40 pins in time.

chopped down 26 pin connector. I also removed the top layer of the pimoroni case to get it to fit.
chopped down 26 pin connector. I also removed the top layer of the pimoroni case to get it to fit.

Detection code

The pyhon prog that controls the light is a massive mess so I’ve streamlined it a bit after some further reading form mod my pi. This is a lower resource bit of code and I’ve also incorporated the date time module so that it doesn’t waste battery power turning it on it the daylight.

Initial results weren’t too good so I’ve tinkered with it a bit and will continue to do so until it works as required.

#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import datetime

#setup date and time vars
now = datetime.datetime.now()
dusk="2130"
dawn="0500"

# Set pins to BCM
GPIO.setmode(GPIO.BCM)

#PIR setup
#set up PIR pin
PIR_PIN = 22
#set PIR pin as input
GPIO.setup(PIR_PIN, GPIO.IN)

#relay setup
# Set relay pin
GPIO_LIGHT_ON = 17
# Set relay pin as output
GPIO.setup(GPIO_LIGHT_ON,GPIO.OUT)



def MOTION(PIR_PIN):
 print "motion detected"
 if now.strftime("%H%M") > dusk or now.strftime("%H%M") < dawn:
 GPIO.output (GPIO_LIGHT_ON,1)
 print "light on"
 time.sleep(10)
 while GPIO.input(PIR_PIN)==1:
 time.sleep(10)
 GPIO.output (GPIO_LIGHT_ON,0) 
 print "Light off" 
 print "motion stopped"

print "PIR Module test press Ctrl+C to exit"
time.sleep(2)
print "ready"

try:
 GPIO.add_event_detect(PIR_PIN, GPIO.RISING, callback=MOTION)
 while 1:
 time.sleep(100)
except KeyboardInterrupt:
 print "quit"
 GPIO.cleanup()

Lens glare

After fitting the lens in front of the filter I began to get lens glare. After a bit of experimenting I ended up turning the lens round so that the glass touched the end of the filter tube and the back end of the lens created a hood.

lens blu-tacked on upside down. If it works ok then I'll fix it properly and I've got a new IR filter switch coming which may change the arrangement.
lens blu-tacked on upside down. If it works ok then I’ll fix it properly and I’ve got a new IR filter switch coming which may change the arrangement.

Button(s)

Initially the pi had 3 buttons, temporarily fitted to a small breadboard. When the pi is setup outside it is put in position then the “reboot wifi” button is pressed to re-establish a link to the network.

In practice this soon became an issue as the buttons had to be forced in to the enclosure then the lid screwed on, resulting in lost screws and accidental shutdown by pressing a wrong button.

The box now sports a lovely maplin waterproof switch – this operates the wifi reboot and nothing else (the led to signal that it has worked is fitted in the box). Overall, much easier to use.

inside and outside pics of the button - apparently vandal proof but it remains to be seen if its squirrel proof
inside and outside pics of the button – apparently vandal proof but it remains to be seen if its squirrel proof

Lamp

The light from the lamp has been disappointing recently. It could be due to a variety of reasons including the angle (it is fitted to look downwards), battery voltage (it needs 12v but is getting 8.4v max from the rechargeable) & the settings within pikrellcam (e.g. white balance, night etc).

old lamp board, with the broken solder pads and bodge to get it to work
old lamp board, with the broken solder pads and bodge to get it to work

I had another kit so I’ve built it and swapped out the 220 ohm resistors for 100 ohm, based on information and calcs via ledcalc.net. Whist buiding the kit I took the opportunity to modify the way the lamp connects as the soldered joints were prone to detaching and multiple resolders have messed up the solder pads. Finally, I’ve changed the angle on it so that the downward angle is reduced.

It remains to be seen if this helps!

 

Edit:

it does – the video below was taken with the altered lamp and offers a significant improvement over the old. I just need to sort the white balance out (I’ve converted this to B&W to try and reduce the effect but it still “pulses”)

Trailcam – 1. Introduction

Other sections

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list
  8. Updates

 

Camera in window cill mode
Camera in window cill mode

Description

The intention is to create an animal camera to video the wildlife of the garden and the window cill bird feeder. The idea is that the camera could be used outside (night or day) powered by battery then be moved indoors to the window cill to record the bird feeder where it can be powered by mains.

Previous versions

This is the 3rd version of the animalcam / trailcam with the older versions showing the progression and further useful information. Previous versions can be found here:

Version 2

Version 1 

General construction

To create this I’ve used a raspberry pi A,* powered by battery (which can be disconnected when connected to the mains) along with a pi noIR camera that has a moveable IR filter to give reasonable colour in the day and respond to IR light in the dark.

*: now using a pi zero – see here

The trailcam comprises of a main breakout board with the other elements attached separately – this helped me to construct the project in sections and allows for a level of upgrade later on. I ran in to issues on the previous version where the female to female jumpers kept coming off, resulting in a bunch of wires that I had no idea where they went, so this time I’ve soldered on JST connectors and colour coded them.

inside the camera

Overall concept:

In its current form, the trailcam simply uses pikrellcam to record video when it detects motion.  In the dark, a PIR sensor is activated which turns on an I.R. lamp, pikrellcam then records the motion event as if it were daylight. A switchable I.R. filter is fitted to the camera which enables good quality day time video and I.R. sensitive night time video.

The facility for bypassing the software motion detection is built in so that the recording of video can be triggered by the PIR if required.

Useful links:

I’ve cobbled this together using the how-to’s, programs, diagrams and general knowledge of some very clever and generous people that have taken the time to make their information public knowledge online. Despite my limited skill level it actually works!

The following are the main personal blogs and websites that I’ve used for help. In addition, the suppliers as noted in section 7 have really useful websites and blogs to go with their products.

South Somerset Weather

This was the original inspiration and also has some great videos.

http://www.afraidofsunlight.co.uk/weather/index.php?page=trailcam

 

Pikrellcam

The motion detection software used for this trailcam

http://billw2.github.io/pikrellcam/pikrellcam.html

 

Envatotuts+

Description, diagrams and python prog to control the L293D chip that operates the IR filter

http://computers.tutsplus.com/tutorials/controlling-dc-motors-using-python-with-a-raspberry-pi–cms-20051

 

Trevor Appleton

Handy guide for explaining cron

http://trevorappleton.blogspot.co.uk/2014/06/scheduling-python-programs-using-cron.html

 

Raspberry pi spy

Lots of useful tutorials

http://www.raspberrypi-spy.co.uk/

 

This description has been split down in to the following sections:

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list