Whilst ordering some new arts for a couple of projects, I came across the zero delay arcade by Reyann.
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.
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.
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.
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 )
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!
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.
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.
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/pythonimport RPi.GPIO as GPIOimport timeimport datetime#setup date and time varsnow = datetime.datetime.now()dusk="2130"dawn="0500"# Set pins to BCMGPIO.setmode(GPIO.BCM)#PIR setup#set up PIR pinPIR_PIN = 22#set PIR pin as inputGPIO.setup(PIR_PIN, GPIO.IN)#relay setup# Set relay pinGPIO_LIGHT_ON = 17# Set relay pin as outputGPIO.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()
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.
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.
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).
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!
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”)
It’s a huge lump in terms of capacity, physical size and weight however it has performed flawlessly in the last couple of years. It takes a while to charge but holds it really well and lasts long enough to power the pi all night as well as for an hour or so to get the videos off of it in the morning.
It needs a pretty hefty power supply and I went with the recommended, branded one – this is also really handy for powering a pi2 with Wi-Fi when not charging the battery.
Filmed outside running on batteries. Video has been cut down in length using windows movie maker so is saved as a wmv
Now using adobe elements and with the interesting vids cut together
Now that the weather has given me the chance to run the project outside, there are a couple of areas that I’m not happy with:
reflection – there looks to be a noticeable reflection from the light on the lens (not helped by the badger nosing it!. I need to find some way of keeping it waterproof whilst stopping the reflection – also might try and find a way to stop the IR filter cutting off the corners of the image.
Brightness of image – the image is too dark and noticeably darker than the previous version. I think that this is partly due to the camera being set as “auto” (hence it brightening up after the bager nosed it) and partly due to the lamp
Lamp connection – The hardware weak point is the connection to the lamp. At every opportunity the wires fall off to such an extent that the solder pads on the lamp have fallen apart.
Initially i’d hoped to dispense standard, roasted monkey nuts as the squirrels love them! I’ve built many variations of the dispensing mechanism out of foam card however it was proving to be really tricky with the irregularly shaped nuts and their friction.
I’ve tried all sorts of mechanism from the simple opening and shutting of a spring loaded door to the moving of gravity fed nuts using a cut out like the board game downfall.
The downfall was my favorite but very problematic with the monkey nuts so I changed to using shelled nuts which were much easier to dispense.
Above all the design needs to be reliable so I have constructed many prototypes with the most reliable by far being a simple trap door – I don’t mind it dispensing too many nuts at once however I don’t want it to clog up and this design proved to work well.
The whole thing needed to be motorised and the foam card just wasn’t strong enough so I reverted to creating the mechanism from Lego at this stage. This was an easy decision as I have tons of it ahnging about with the only downfall ( 😉 ) being that I didn’t want to conform to the lego standard dimensions however for a prototype it would be fine.
The hardware for the project can be broken down in to 2 main sections – the electronic control of the various sensors and the mechanism to dispense the nuts.
A) Electronic control.
Having played around a bit with breadboard I’ve worked out what I’d like to have for the various inputs and outputs:
1. Motor to drive the nut delivery system behind a reed switch or relay.
2. Microswitch to tell the pi where the motor is – to stop it chucking out tons of nuts or none at all!
3. Motion detector – I’ve bough one from Tandy which works pretty well .Not sure of the use for it yet but I:m going to add it in should it be necessary in the future.
4. Switch to trigger if the nuts are deployed. (possibly an IR breaker beam rather than a switch to avoid complex mechanical issues).
5. LED. A light that I can configure to show different colours. I’ve chosen a RGB LED so that it can be positioned in one place with the colours showing the status – I’d considered several different coloured ones but was concerned that the wildlife would notice the position of the light (i/e 3rd from left) rather than the colour = possibly a new experiment, though.
I wanted something that was easy to connect to the pi and so have come up with a veroboard circuit that connects to the pi via a ribbon cable.
This has the various connectors in place to make it fairly easy to connect up the swiitches etc and the ribbon cable to ensure that they are alwas connected to the correct pins on the pi.
The second piece of veroboard has the connection for the lego motor – these have special connectors and I decided to use an old battery box as a doner for the plug. I then soldered this on to some board and glued it down having worked out the pin arrangement from here: http://www.philohome.com/pf/pf.htm
It all works pretty well however the wires are inclined to come off the pins at the slightest vibration! Also I’ve had trouble passing 9v through the opto isolator as it sticks at anything over 3v – I’ve since got some relays that may prove better.
I’ve had a bit of a break from the pi powered feeder over the past few weeks however I’ve been using it to work with our ip camera to record some night shots of the wildlife in the garden.
Over the past few evenings we’ve set the camera to look at the garden with the pi running “motion”. I’ve got hold of this inexpensive IR lamp from amazon and I’m using it with a cheap ip camera from here.
I’ve altered the camera a bit so that I have a switch to turn on & off the built in IR lamps – they’re really good however the camera is behind glass (on the windowcill) and they reflected off the glass. – basically I simply dismantled it and ran a switch over the LDR so that it could be bypassed.
After a bit of setting up from both the camera and motion I can leave the pi running all night silently creating videos of all motion. – the camera was pretty simple to set up having used the disc supplied and motion works excellently after reading the very extensive and detailed online documentation. – once its set up it can be accessed on the specified port (8080 in my case) to work through the options.
I’ve installed Apache on the pi so that it can be accessed from the local network and the videos are saved in a default way that organises them in to month/date.
The link below is for a video recored last week:
(Neither of these seem to work properly and I’m getting pissed off with trying to get videos to work on this blog! – so no more posting of videos)
This video is not the best quality as I’ve got it set up for night vision with high brightness but you can clearly see our visitor – a small deer which is quite special in such an urban, shared garden!
I’ve also got the CSI camera fitted to the pi which is significantly better in quality – I’ve got this working in a slightly different way and it’ll make a huge difference in picture quality when I intergrate it in to the whole system.
Having made the decisions about the design of the feeder I needed to begin getting the basics of the pi set up together.
AS I’m going to be using RISC OS there are a couple of hurdles to overcome that aren’t present in linux.
The shopping list for the pi setup is:
1 – Remote access for running the program (or monitoring if autonomous).
2 – Wireless networking.
3 – Sending or recording video.
4 – Get it working from battery power.
Before I get to running wirelessly I thought I’d begin with accessing the pi from a remote computer using its current remote connection – For this I used the VNC server by Adrian Lees – http://adrianl.drobe.co.uk/
He describes this as a shaky alpha release but, while a bit slow, it is perfect for running my basic program.
I accessed it from the laptop using tightVNC which provided a good & stable connection. The pi is set up to display on my tv using hdmi and I didn’t want to fiddle with the screen resolution, so I wasn’t surprised when it didn’t like running at 256 colours.