User:Rando: Difference between revisions

From Noisebridge
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
10.20.1.1
[[User:Rando/Ordibooth]]


== Hardware ==
[[User:Rando/Maslow]]
Raspberry Pi 3 B v1.2


Raspberry Pi Display v1.1
[[User:Rando/Donate_v2]]


Cannon Powershot A2200
[[User:Rando/Gain_Clone_Notes]]
 
== software ==
=== pi ===
1. virtualenv
 
2. virtualenvwrapper
 
3. pyspacelib (ft interface)
 
4. python 3.5
 
4.1 pillow
 
4.2 pygame
 
4.3. kivy
 
=== Ordi server ===
 
1. Imagemagick
 
2. ptpcam compiled with chdk
 
3. python 3.5
 
For some reason, pygame and pillow are not installed with kivy, but are requirements.
 
for Flask, pip install python-dotenv
 
== CHDK ==
http://chdk.wikia.com/wiki/CHDK_1.4.0_User_Manual
 
Download using STICK: http://zenoshrdlu.com/stick/stick.html
 
Remote Pameters, enable remote
 
[[File:enable_remote.png]]
 
Remote Usage: http://chdk.wikia.com/wiki/USB_Remote
 
Note: the USB remote functionality is not used for this, we need to control it from the [pi <-> mac] mini device
 
=== Scripting ===
 
http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Page
 
click
 
is_key
 
is_pressed
 
press
 
release
 
shoot
 
wait_click
 
wheel_left
 
wheel_right
 
'''Transferring files'''
 
How to transfer to computer?  Perhaps the rpi can indicate to the macmini to mount the camera and tx the picture.
 
http://chdk.wikia.com/wiki/PTP_Extension/ptpcam_Examples
 
ptpcam / libptp
 
Install instructions
 
http://chdk.wikia.com/wiki/Ptpcam_in_headless_linux_Dockstar
 
ok, THIS is the one we want, it has the "ptpcam --chdk" option:
 
https://github.com/jrabbit/libptp-chdk
 
notes on usage: http://chdk.wikia.com/wiki/PTP_Extension/ptpcam_Examples
 
How to run one onn camera:
 
loadfile('A/CHDK/SCRIPTS/testprgm.lua')()
 
== ordi_controller.py ==
 
Handles from ptpcam functions from the mac mini as python calls using subprocess.run.
 
== scripting ==
 
http://chdk.wikia.com/wiki/Lua
 
The "Minimalistic Intervalometer" is a lua script that takes a photo, using half presses and full presses.
 
Steps:
 
# Write script
# Place <script>.lua in CHDK/SCRIPTS on SD card e.g. A/CHDK/SCRIPTS/testprgm.lua
# Run script with  loadfile('A/CHDK/SCRIPTS/testprgm.lua')()
 
 
Script Reference
 
http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Page
 
How to script and run and stuff
 
http://chdk.wikia.com/wiki/Lua/PTP_Scripting
 
> luar shoot()
 
Lua dev environment metioned here:
http://chdk.wikia.com/wiki/Lua_Development_Environment
 
== this is how! ==
[[File:ptp-cam-shoot.png]]
 
 
ptpcam --dev=028 --chdk="luar shoot()"
 
 
== Camera Disassembly ==
Why?  the power doesn't stay on without a button press.  so trying to replace the button so we can drive it via a GPIO on the rasp pi.
 
Wait, why. 
 
Because.  We're hacking.
 
https://www.ifixit.com/Device/Canon_PowerShot_A2200
 
 
== Power button modification ==
 
In order to control the camera power "remotely", the power button was modified to pull out wires and connect them to a GPIO of the pi.  This was the power can be turned on when the system boots.
 
The button was a SMD tact switch with barely exposed pads.  In order to get sufficient copper to solder, the solder mask was gently scraped off.
 
[[File:ordi_power_button_sense.png]]
 
[[File:ordi_power_button_mod.png]]
 
=== Pi GPIO ===
 
Well, pi GPIOs are 3.3V and the typical 3.3V -> 5V doesn't work.  The button sense's the ground but the high state does not trigger a high reading on the camera.  Since this is the case, it never is released from ground to reset in order to toggle on next "press" aka connection to ground.
 
Going to put together a simple logic shifter from a diode and a resistor i guess.
 
== Power ==
 
The pi needs '''5.1V @ 2.5A'''.  That, plus the LCD display max current draw is '''400mA''', so really need a 3A+ supply.
 
Ok, after creating a small cable assembly for the power so I can use anything but the USB port, things are stable and the new image installs properly.
 
== Pi Config ==
the SD card image now boots properly and everything installs.
 
VNC and ssh access are now enabled.
 
The inital plan is:
1. GPIO for camera power button
2. Simply kivy UI
3. python camera controller (uses CHDK underneath)
 
=== Performance ===
The pi performance is pretty shit.  there's another, bare distribution called devuan to try.  Plus I can rip out all the unnecessary UI garbage included in raspbian. 
 
The pi will have to be tuned further.  Overclocking is apparently possible, though might need a heatsink/fan, but that's fine.
 
https://www.raspberrypi.org/forums/viewtopic.php?t=138123
 
idealy can script the changes and run testing over night or something.
Change values, reboot, run benchmark, monitor failures, repeat.  How to restart the pi remotely remains a challenge.  Might need an arduino hooked up to serial and a small server on the machine.  Which is totally fun and cool and can be reused.
 
other tuning ideas
 
https://www.makeuseof.com/tag/raspberry-pi-performance-tips/
 
== Pi Image ==
 
I'm not sure if I HAVE to create a custom image, but it seems like I should make an attempt in order to load Kivy.
 
https://www.instructables.com/id/Creating-a-Custom-Shrinked-Raspberry-Pi-Image/
 
Not really into what that instructables is doing but will keep up. 
 
Next plan: emulate with qemu to get a custom image going
 
https://stackoverflow.com/questions/38837606/how-to-emulate-raspberry-pi-raspbian-with-qemu
 
totally custom i think, but like, don't have to.
 
https://github.com/RPi-Distro/pi-gen
 
Ok, so to get -M raspi3 natively, qemu currently has to be compiled from scratch. gfd.
 
https://github.com/qemu/qemu
 
But it should now include this patch:
 
https://github.com/bztsrc/qemu-raspi3
 
Ok, well, this image just wont boot.  I'll have to configure the pi by hand which fucking suuuucckkksssssssss
 
 
== Target Architecture ==
 
The pi will run a small kivy based app.
 
The app will determine and change the state of the camera.
 
The app will have a button to take a picture.
 
The app will display the taken picture
 
The app can delete the pictures
 
The app can save the picture
 
The app can preview the picture in the flashen taschen tester
 
The app can trigger a send of the picture to the flashen taschen.
 
The app can take in 140 characters of text
 
The app can send the text to the ordi_server
 
The app can trigger a tweet the picture
 
The app will produce a QR code / URL link to retrieve the picture
 
order server will run on the mac mini
 
it will be a flask web app with a thin wrapper for commands
 
the rpi will send commands to the order server
 
the order sirver will handle all image manipulation
 
the order server will control the camera
 
There should ever only be 1 picture on the camera.  This picture may include edited versions, so perhaps an object which contains on ordered list of file names.  This ordered list will be in editological order, e.g. the lasted edited version should be last, and any throw away edited versions should be trimmed.
 
Control commands will be send over https to a flask app running on the server.  There is one command, on/off, which is required to send to the rpi.  As the camera on/off is connected to the GPIO, the server needs to trigger the rpi to enable.  This can be turned into a poll using wget, but we'll check performance.
 
 
'''Don't forget'''
 
The camera is now open to air. Should print a new enclosure for it since hte button has been, uh...surgically enhanced.

Latest revision as of 15:41, 5 January 2019