diff --git a/hardware/case.scad b/hardware/case.scad index 01edace..48387fc 100644 --- a/hardware/case.scad +++ b/hardware/case.scad @@ -408,7 +408,7 @@ module bearing (x, y, z, width= 8, hole = true, calval = 0) { module key_cap () { $fn = 60; thickness = .75; - innerD = 22.1; + innerD = 22.5; outerD = innerD + (thickness * 2); h = 18 - 2.5; diff --git a/hardware/intval3.scad b/hardware/intval3.scad index e8440ad..3761306 100644 --- a/hardware/intval3.scad +++ b/hardware/intval3.scad @@ -44,7 +44,7 @@ module exploded_view () { //intval_laser_panel_cover(true, ALL_RED=true); //rotate([0, 0, 13]) intval_panel_laser(); //rotate([0, 0, 13]) intval_laser_panel_cover(); -//key_cap(); +rotate([0, 180, 0]) key_cap(); //geared_motor_mount_120(); //motor_key(); //motor_key_120(); @@ -56,5 +56,5 @@ module exploded_view () { //translate([0, 0, 39 / 2 + 5.75]) bolt_guide(); //exploded_view(); -stl_plate(); +//stl_plate(); //dxf_plate(); \ No newline at end of file diff --git a/howto/RaspberryPiZeroW.md b/howto/RaspberryPiZeroW.md new file mode 100644 index 0000000..e594289 --- /dev/null +++ b/howto/RaspberryPiZeroW.md @@ -0,0 +1,69 @@ + +## Client Architecture + +* Raspberry Pi Zero W +* Raspberry Pi Zero (Development) +* Raspberry Pi 1 (Development) + +### Ethernet over USB + +From [this blog post](http://blog.gbaman.info/?p=791) + +1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card. +2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the ```config.txt``` file ```dtoverlay=dwc2``` on a new line, then save the file. +3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ```ssh``` in the SD card as well. By default SSH is now disabled so this is required to enable it. Remember - Make sure your file doesn't have an extension (like .txt etc)! +4. Finally, open up the ```cmdline.txt```. Be careful with this file, it is very picky with its formatting! Each parameter is seperated by a single space (it does not use newlines). Insert ```modules-load=dwc2,g_ether``` after ```rootwait```. To compare, an edited version of the ```cmdline.txt``` file at the time of writing, can be found here. +5. That's it, eject the SD card from your computer, put it in your Raspberry Pi Zero and connect it via USB to your computer. It will take up to 90s to boot up (shorter on subsequent boots). It should then appear as a USB Ethernet device. You can SSH into it using raspberrypi.local as the address. + +### Sharing internet from host machine (OSX) + +From [learn.adafruit.com](https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget?view=all) + +```sudo nano /etc/network/interfaces``` + +Enable wlan0 by adding the following lines: + +``` +allow-hotplug wlan0 +iface wlan0 inet manual + wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf +``` + +Enable with ```sudo systemctl enable wpa_supplicant.service```. + +For usb connection, add at the end: + +``` +allow-hotplug usb0 +iface usb0 inet static + address 192.168.7.2 + netmask 255.255.255.0 + network 192.168.7.0 + broadcast 192.168.7.255 + gateway 192.168.7.1 +``` + +This will give the Raspberry Pi the IP Address ```192.168.7.2```. Then run the following: + +``` +sudo ifdown usb0 +sudo ifup usb0 +ifconfig usb0 +``` + +In the OSX Network Preferences you'll see the device show up as an ```RNDIS/Ethernet Gadget```. It'll probably be set up for DHCP by default so change it to ```Configure IP4 Manually```. Use the following settings: + +``` +IP address: 192.168.7.1 +Subnet Mask: 255.255.255.0 +Router: 192.168.7.1 +``` + +Apply changes. Next, enable internet sharing from your machine (Ethernet or Wifi) to the ```CDC``` or ```RNDIS``` Raspberry Pi. + +On the Pi, change the line in ```/etc/network/interfaces``` that reads ```auto lo``` to ```auto lo usb0```. Remove or comment out the lines added to the file below ```allow-hotplug usb0``` previously and replace with ```iface usb0 inet manual```. + +### Modules and guides +* [BLE and pi and mobile app](https://www.hackster.io/inmyorbit/build-a-mobile-app-that-connects-to-your-rpi-3-using-ble-7a7c2c) +* [pi and i2c](http://www.maxbotix.com/Setup-Raspberry-Pi-Zero-for-i2c-Sensor-151/) +* [gpio module](https://www.npmjs.com/package/rpi-gpio) \ No newline at end of file diff --git a/howto/Readme.md b/howto/Readme.md new file mode 100644 index 0000000..36a1d6a --- /dev/null +++ b/howto/Readme.md @@ -0,0 +1,18 @@ +## Assembly + +The essential components of the intval3 intervalometer are the following parts: + + +The electronics that interface with the Raspberry Pi can be created in a few different ways. A board can be purchased (soon), put together by hand on a prototyping bonnet, or etched from copper-clad board using the circuit board design files. + + +## Installation + +With a fresh [Raspian installation on the Raspberry Pi Zero W](RaspberryPiZeroW.md), you can install the intval3 software with two commands: + +``` +wget https://raw.githubusercontent.com/sixteenmillimeter/intval3/master/scripts/intval3-install.sh +sh ./intval3-install.sh + +``` + diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..6d155e4 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,49 @@ + +#uncomment to host with ssl and redirect from http +#not advised + +#server { +# listen 80; +# server_name example.com; +# return 301 https://$server_name$request_uri; +#} + +server { + listen 80 default_server; + listen [::]:80 default_server; + #listen 443 ssl; + + #ssl on; + #ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; + #ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; + + #ssl_session_timeout 5m; + #ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + #ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; + #ssl_prefer_server_ciphers on; + + server_name intval3.local; + + location / { + proxy_pass http://127.0.0.1:6699/; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Real-IP $remote_addr; + #no need for gzip at this time, adds processing overhead + #gzip on; + #gzip_comp_level 5; + #gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json; + } + + location /static/ { + alias /home/pi/intval3/app/www/static/; + + #uncomment to turn on caching + #expires modified 1y; + access_log off; + #add_header Cache-Control "public"; + gzip on; + gzip_comp_level 5; + gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json; + } +} \ No newline at end of file diff --git a/scripts/intval3-deps.sh b/scripts/intval3-deps.sh index 299217b..c280d64 100644 --- a/scripts/intval3-deps.sh +++ b/scripts/intval3-deps.sh @@ -1,17 +1,17 @@ #!/bin/bash echo "Running intval3 dependency install script" -apt-get update -apt-get install git ufw nginx jq -y +sudo apt update +sudo apt install git ufw nginx jq -y echo "Installing node.js dependencies.." -apt-get install nodejs npm -y -npm install -g n -n latest -npm install -g npm@latest -npm install -g pm2 node-gyp +sudo apt install nodejs npm -y +sudo npm install -g n +sudo n latest +sudo npm install -g npm@latest +sudo npm install -g pm2 node-gyp echo "Installing bluetooth dependencies..." -apt-get install bluetooth bluez libbluetooth-dev libudev-dev -y +sudo apt install bluetooth bluez libbluetooth-dev libudev-dev -y echo "Finished installing intval3 dependencies" \ No newline at end of file diff --git a/scripts/intval3-install.sh b/scripts/intval3-install.sh index 06430fe..2c6ab53 100644 --- a/scripts/intval3-install.sh +++ b/scripts/intval3-install.sh @@ -1,36 +1,49 @@ #!/bin/bash -echo "Running intval3 install script" -apt-get update -apt-get install git ufw nginx jq -y +echo "Running intval3 install script (this will take a while)..." +cd +sudo apt update +sudo apt install git ufw nginx jq -y echo "Installing node.js dependencies.." -apt-get install nodejs npm -y -npm install -g n -n 9.1.0 -npm install -g npm@latest -npm install -g pm2 node-gyp +sudo apt install nodejs npm -y +sudo npm install -g n +sudo n 9.1.0 +sudo npm install -g npm@latest +sudo npm install -g pm2 node-gyp echo "Installing bluetooth dependencies..." -apt-get install bluetooth bluez libbluetooth-dev libudev-dev -y -systemctl disable bluetooth -hciconfig hci0 up +sudo apt install bluetooth bluez libbluetooth-dev libudev-dev -y +sudo systemctl disable bluetooth +sudo hciconfig hci0 up echo "Configuring ufw (firewall)..." -ufw default deny incoming -ufw default allow outgoing -ufw allow ssh -ufw allow http -ufw allow https -ufw enable +sudo ufw default deny incoming +sudo ufw default allow outgoing +sudo ufw allow ssh +sudo ufw allow http +sudo ufw allow https +sudo ufw enable echo "Installing intval3 project..." -wget https://github.com/sixteenmillimeter/intval3/archive/master.zip -unzip master.zip -d intval3/ -rm master.zip - +mkdir state +git clone https://github.com/sixteenmillimeter/intval3.git cd intval3 + +echo "Configure nginx..." + +sudo cp nginx.conf /etc/nginx/sites-available/intval3 +sudo ln -s /etc/nginx/sites-available/intval3 /etc/nginx/sites-enabled/intval3 +sudo rm /etc/nginx/sites-enabled/default + +sudo nginx -t +sudo service nginx restart + +echo "Install node" + npm install -pm2 start process.json +sudo pm2 start process.json +sudo pm2 save +sudo pm2 startup echo "Finished installing intval3" \ No newline at end of file