====== scrying====== //Note: This HOWTO does not [yet] cover use of the Scheme interpreter - only the logging application in SVN (serialtest.c) and mini_skry// ===== HOWTO: ===== ===== 1] Stack up required modules ===== Using spacers [M3 12mm] and nuts/bolts if required. eg. {{scrying:rssi_rot0.jpg|{{scrying:rssi_rot0.jpg|}} [with RSSI module based on the AD8313: see [[scrying:module_rssi]] ] {{scrying:cywm_scry2.jpg|{{scrying:cywm_scry2.jpg|}} [with CYWM6935 for spectrum analysis around 2.4 GHz: see [[scrying:module_spectrum]] ] Now [2009] replaced with a custom module based on the Cypress CYWUSB6935 IC. ===== 2] Attach battery (3x AA rechargeable battery pack (Energizer 2500 mAh)) ===== {{scrying:image014.jpg|}} Attach battery with red wire (+) at top of two pin connection and black wire (-/GND) at bottom. ===== 3] Attach USB connection board to 2x3 connector===== {{scrying:rssi_rot1.jpg|{{scrying:rssi_rot1.jpg|}} USB is used for charging battery pack, as well as for terminal connection. ===== 4] Attach USB cable, start up minicom or any serial terminal software (examples?) ===== [ GNU screen can also be used as follows: screen /dev/ttyUSB0 9600 with C-a H to log] Settings as follows: 9600 baud, /dev/ttyUSB0 (depending on other devices may be /dev/ttyUSB1), no hardware or software flow control, 8N1 [sets parity and stop bits]. Should see prompt as follows: {{scrying:scry_term1.png|}} And issue help command. Commands as follows: log: outputs log so far as stream of number/chars lv: print one sample for debugging nm: show log counter res: reset counter to 0 p: pause logging s: (re-)start logging d1/d2/d3: delays short->long between logging str: streams log data q: quit streaming data 8bit: char output 10: 10 bit integer output ant: antenna source (bare antenna into ADC) rssi: rssi board as source gps: toggle (on/off) and init GPS gpl: toggle live GPS messages for debugging gplog: print GPS log so far help: helps Use minicom logging functions to output to files for further analysis and graphing. ===== 5] The GPS module ===== {{http://1010.co.uk/images/skry_gps1.jpg}} Trimble Lassen SQ outputting NMEA GGA phrase every second. Remember to attach active antenna to MCX connector. It also may take up to fifteen minutes in plain sky view to get a satellite fix from a cold start. ===== 6] Sample session with RSSI and GPS (no fix) ===== {{scrying:scry_term2.png}} {{scrying:scry_term3.png}} Note that the output from gplog shows long and lat followed by the EM log figure (if delay is slow there will be little change). A bug was fixed [6/8/08] which logged all GPS data twice [now in svn]. {{scrying:scry_term4.png}} {{scrying:scry_term5.png}} ===== 6.5] Using GNU Emacs serial terminal ===== In CVS GNU Emacs 23: 1] M-x serial-term (eg. /dev/ttyUSB0, 9600 b/s) 2] and then C-c is escape eg> C-c C-b to switch buffers C-c C-k char mode C-c C-j line mode [with history accessed by way of M-p previous and M-n next] providing adequate console for scrying serial connection [/dev/ttyUSB0]. [Note: for some reason above works inconsistently!] 3] To upload a region of code to the serial device: (defun serial-send-region () (interactive) (let ((tmper (buffer-substring (region-beginning) (region-end)))) (switch-to-buffer (find-file-noselect "/tmp/scrying.transfer")) (erase-buffer) (insert tmper) (save-buffer "/tmp/scrying.transfer") (start-process "scrying-upload" nil "/root/scrying/scrying/scrying.sh"))) acii-xfer command is wrapped in scrying.sh: #!/bin/sh /usr/bin/ascii-xfr -sen -l 10 -c 10 /tmp/scrying.transfer > /dev/ttyUSB0 ===== 6.6] Plotting with gnuplot ===== {{http://1010.co.uk/images/24scry01.png}} 1] install gnuplot-mode for GNU Emacs: http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html 2] M-x gnuplot-mode 2.5] make sure logged data is clean and uses tabs and not commas 3] Example code: use C-c C-r to send region to gnuplot: set parametric unset key set style data line set surface set contour both set cntrparam bspline set dgrid3d 30,30,10 splot "/root/2310test.log" # flat heat map unset surface unset contour set view map set pm3d at b set dgrid3d 30,30,10 splot "/root/2310test.log" using 1:2:3 help splot # for line style plot (a la plot3) unset view map set ticslevel 0 set surface unset contour unset pm3d unset dgrid3d splot "/root/gijon/1903.log" using 1:2:3 with lines # animation and overlays?? ===== 6.7] Plotting with R ===== {{http://1010.co.uk/images/24scry05.png}} 1] Install R: apt-get install r-base-dev r-recommended 2] Install ESS for GNU Emacs: http://ess.r-project.org/ 3] Install needed packages such as akima: R CMD INSTALL /path/to/package.tar.gz 4] M-x R 5] Example code evaluated with M-x ess-eval-region (or C-c C-r): #simplest require(akima) require(lattice) mtab<-read.table("/root/2310test.log") par(bg = "slategray") persp(interp(mtab[,1],mtab[,2],mtab[,3],duplicate="strip"), theta = 110, phi = 100, col = "green3", ltheta = -120, shade = 0.8, border = NA) # cloud (lines) and wireframe mtab<-read.table("/root/2310test.log") temp <-data.frame(mtab[,1],mtab[,2],mtab[,3]) reggrid <-interp(mtab[,1],mtab[,2],mtab[,3],duplicate="strip") cloud(mtab[,3]~mtab[,2]*mtab[,1],type="l") wireframe(reggrid$z,scales=list(arrows=FALSE),drape=TRUE,colorkey=TRUE) help(persp) ===== 7] Develop the code ===== Code is divided into core library, logging application and Scheme interpreter https://sourceforge.net/projects/scrying ==== Programming: ==== Fuse bits for all options (4 MHz external): lfuse: 0xFD hfuse: 0x99 efuse:w:0xFF Eg: avrdude -c stk500v2 -p m128 -P /dev/ttyUSB0 -U lfuse:w:0xFD:m -U hfuse:w:0x99:m -U efuse:w:0xFF:m -U flash:w:serialtest.hex See also: http://1010.co.uk/avrprog.html ===== 8] Build and develop the hardware ===== 1] See: http://1010.co.uk/scrying_tech_notes.html for loose notes. 2] Latest hardware designs/schematics at: https://code.goto10.org/svn/xxxxx/trunk/scrying_hardware/ With main schematic as: https://code.goto10.org/svn/xxxxx/trunk/scrying_hardware/scrymain_newmemory.sch and BOM (Bill of Materials) as: https://code.goto10.org/svn/xxxxx/trunk/scrying_hardware/scrymain_newmemory.lst and all Kicad/Gerber files as: https://code.goto10.org/svn/xxxxx/trunk/scrying_hardware/larger_panel002.zip Pinouts of main pass-through connector for modules: {{scrying:skry_pinout.png|}} Pins: 1: 3.3v 2: PF0/ADC0 3: GND 4: PF1/ADC1 5: 5v 6: PF2/ADC2 7: PE1/TX 8: PF3/ADC3 9: PE0/RX 10: PF4/ADC4 11: PB0/SS 12: PF5/ADC5 13: PB1/SCK 14: PF6/ADC6/ANTENNA 15: PB2/MOSI 16: PF7/ADC7 17: PB3/MISO 18: PD0/INT0 19: PD5 20: PD1/INT1 21: PD6 22: PD2/RXD1 23: PD7 24: PD3/TXD1 25: BATTERY 26: PD4 And for serial connector (6 pin with pin 1 as bottom right): 1] GND 2] +V 5] RXD 6] TXD (top left) ===== 9] FAQ ===== === what is RSSI? === Received Strength Signal Indicator see wikipedia: http://en.wikipedia.org/wiki/RSSI See also details for the AD8313 chip used on the RSSI board: http://www.analog.com/library/analogDialogue/archives/33-03/ask28/ === Is the antenna of the GPS module an Active or a Passive one ? === The gps module has a MCX connector, (i wonder if one of this are compatible with it, http://www.u-blox.com/products/ann.html ,its what i got) A: It should be active - if the ublox antenna is this one: ANN-MS-2-005-0 (MCX) then it will be fine. Otherwise you will need an MCX adapter. {{ad_berlin:mcx_connector_gps.jpg|}} Q/So, What type of connector i need for this gps module (see picure above): A/ === Sound Output === Q/Since berlin i got used to the portability of a device that will allow me to listen in realtime the state of the em spectrum.. what do i need, what am i missing? A/Ok. Two possible approaches - one is that as the RSSI/AD8313 is really the only board that could provide an audio signal that you could solder on a minijack plug to the 26 pin connector (I need to check pins). Another would be to code some kind of audio translation onto the microcontroller and make a new board for audio out using PWM - this could be good. === === ===== 10] user notes ===== [[KDaG]] ===== 11] mini-skrying ===== {{http://1010.co.uk/images/micro_skry3.png}} Independent module for long-term logging to microSD card (around 1 month on 2x AA batteries) to be deployed en masse (16x) in Berlin in the next month. Logging wide spectrum RF and tight 2.4GHz wireless spectrum). Based on ATmega168, Analog Devices AD8313, and Cypress CYWUSB6935. Design: https://code.goto10.org/svn/xxxxx/trunk/scrying_hardware/ Code: https://code.goto10.org/svn/xxxxx/trunk/mini_skry/ avrdude -c usbasp -p m168 -U lfuse:w:0xE2:m -U hfuse:w:0xDF:m -U flash:w:sd-reader.hex Currently logs AD8313 and channel 11 2.4 GHz wireless to microSD. No configuration/running. Notes at: http://1010.co.uk/org/notes.html ==== mini-scry pinout for top 8 pin connector ===== 1] GND 2] +3.3v 3] RXD 4] TXD 5] ADC4 6] ADC3 7] ADC2 8] ADC1