<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Physics Archives - ClickedyClick</title>
	<atom:link href="https://gergely.imreh.net/blog/category/physics/feed/" rel="self" type="application/rss+xml" />
	<link>https://gergely.imreh.net/blog/category/physics/</link>
	<description>Life in real, complex and digital.</description>
	<lastBuildDate>Mon, 21 May 2018 15:32:42 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Dual Satellite NTP server with Navspark</title>
		<link>https://gergely.imreh.net/blog/2015/11/navspark-beidou-ntp/</link>
					<comments>https://gergely.imreh.net/blog/2015/11/navspark-beidou-ntp/#respond</comments>
		
		<dc:creator><![CDATA[Gergely Imreh]]></dc:creator>
		<pubDate>Thu, 26 Nov 2015 10:46:14 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Lab]]></category>
		<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[beidou]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[navspark]]></category>
		<category><![CDATA[NTP]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<guid isPermaLink="false">https://gergely.imreh.net/blog/?p=2144</guid>

					<description><![CDATA[<p>A friend from NIST recently told me about a Raspberry Pi Stratum-1 NTP server project, and that reminded me of the experiments I did with the Navspark dual GPS+Beidou receiver module. Navspark is a small, Arduino-compatible module that besides GPS can also receive data from China&#8217;s Beidou 北斗 satellite navigation system , that is currently being built. [&#8230;]</p>
<p>The post <a href="https://gergely.imreh.net/blog/2015/11/navspark-beidou-ntp/">Dual Satellite NTP server with Navspark</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A friend from NIST recently told me about a <a href="http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html">Raspberry Pi Stratum-1 NTP server</a> project, and that reminded me of the <a href="https://gergely.imreh.net/blog/2014/05/navspark-beidou/">experiments I did</a> with the Navspark dual GPS+Beidou receiver module. Navspark is a small, Arduino-compatible module that besides GPS can also receive data from China&#8217;s <a href="https://en.wikipedia.org/wiki/BeiDou_Navigation_Satellite_System">Beidou 北斗 satellite navigation system</a> , that is currently being built. I thought it would be fun to build a Beidou-powered Stratum-1 NTP server to see how does it compare to GPS.</p>
<h2>Hardware</h2>
<p>To have a really good really good, satellite-powered reference clock, I have to have access to a 1-pulse-per-second (1PPS) signal from the receiver. The pure USB-connected receivers don&#8217;t really seem to do that yet (looks like plenty of opportunities there!), instead I have to use separate hardware for it.</p>
<p>The Navspark module has a 1PPS pin (GPO3 below), and the only other pin I&#8217;ll really need is a serial pin to receive the NMEA stream of the satellite lock data (TXD1 below).</p>
<figure id="attachment_1768" aria-describedby="caption-attachment-1768" style="width: 500px" class="wp-caption aligncenter"><a href="https://gergely.imreh.net/blog/wp-content/uploads/2014/05/pinout1.jpg"><img fetchpriority="high" decoding="async" class="wp-image-1768 size-full" src="https://gergely.imreh.net/blog/wp-content/uploads/2014/05/pinout1.jpg" alt="Detailed Navspark pinout with pin functions" width="500" height="530" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2014/05/pinout1.jpg 500w, https://gergely.imreh.net/blog/wp-content/uploads/2014/05/pinout1-472x500.jpg 472w" sizes="(max-width: 500px) 100vw, 500px" /></a><figcaption id="caption-attachment-1768" class="wp-caption-text">Navspark pinout from the User Manual</figcaption></figure>
<p><span id="more-2144"></span>These pins have to be connected to a Raspberry Pi 2&#8217;s GPIO pins.</p>
<figure id="attachment_2155" aria-describedby="caption-attachment-2155" style="width: 882px" class="wp-caption aligncenter"><a href="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/raspberry_pi_circuit_note_fig2a-min.jpg"><img decoding="async" class="wp-image-2155 size-full" src="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/raspberry_pi_circuit_note_fig2a-min.jpg" alt="Raspberry Pi 2 pinout diagram" width="882" height="770" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/raspberry_pi_circuit_note_fig2a-min.jpg 882w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/raspberry_pi_circuit_note_fig2a-min-500x437.jpg 500w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/raspberry_pi_circuit_note_fig2a-min-768x670.jpg 768w" sizes="(max-width: 882px) 100vw, 882px" /></a><figcaption id="caption-attachment-2155" class="wp-caption-text">Raspberry Pi 2 pinout diagram</figcaption></figure>
<p>Based on the pinout above, and some digging around, the connections I needed to make between the Pi (left) and Navspark (right) were:</p>
<ul>
<li>5V <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2194.png" alt="↔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> BATTERY</li>
<li>Ground <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2194.png" alt="↔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> GND</li>
<li>GPIO15 (UART0_RX) <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2194.png" alt="↔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> TXD1</li>
<li>GPIO8 <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2194.png" alt="↔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> P1PPS (GPO3)</li>
</ul>
<p>Some things to remember here, that on serial connections one side&#8217;s RX line is connected to the other&#8217;s TX  and vice versa. Also, as much as I gather any other GPIO pins on the Pi could be used to receive the 1PPS signal, I used GPIO8 because it&#8217;s been used by other projects and playing it safe&#8230;</p>
<p>The adapter board was easy enough to put together (though single-side pads are a pain when the components are on both sides, as it is the case here).</p>
<figure id="attachment_2147" aria-describedby="caption-attachment-2147" style="width: 604px" class="wp-caption aligncenter"><a href="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/RPi_Navspark_testrun_home.jpg"><img decoding="async" class="wp-image-2147 size-large" src="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/RPi_Navspark_testrun_home-1024x715.jpg" alt="Raspberry Pi 2 with Navspark adapter board" width="604" height="422" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/RPi_Navspark_testrun_home-1024x715.jpg 1024w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/RPi_Navspark_testrun_home-500x349.jpg 500w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/RPi_Navspark_testrun_home-768x536.jpg 768w" sizes="(max-width: 604px) 100vw, 604px" /></a><figcaption id="caption-attachment-2147" class="wp-caption-text">Raspberry Pi 2 with Navspark adapter board</figcaption></figure>
<p>The adapter works well enough, though I&#8217;m sure that it could be done nicer.</p>
<h2>Software</h2>
<p>I found a lot of examples and help from other people&#8217;s similar projects but there were still some differences to be figured along the way. The overall setup was to be as follows:</p>
<ul>
<li><a href="http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2">ArchLinux ARM</a> for base platform</li>
<li><a href="http://www.catb.org/gpsd/">gpsd</a> for interpreting the Navspark NMEA messages</li>
<li>LinuxPPS for 1PPS signal passing from GPIO to the userspace</li>
<li><a href="http://chrony.tuxfamily.org/">chrony</a> as time server (as opposed to the usual ntpd)</li>
</ul>
<p>Installing the system was straightforward enough (well, because I&#8217;ve done it so many times, but I digress), and added a few required basic packages: gpsd, chrony, git, the base-devel group, <a href="https://wiki.archlinux.org/index.php/Avahi">avahi</a> (for easier network discovery).</p>
<h3>GPSD</h3>
<p>UART0 serial communication is done through the /dev/ttyAMA0 device in Pi, though the default settings needed some change for gpsd to be able to receive the data from Navspark.</p>
<p>Most of the changes our <a href="http://logicalgenetics.com/serial-on-raspberry-pi-arch-linux/">outline in a blogpost</a> where I have learned from as well. First remove all config settings from /boot/cmdline.txt, basically these parts:</p>
<pre class="lang:default decode:true">console=ttyAMA0,115200 kgdboc=ttyAMA0,115200</pre>
<p>Next disable the automatic serial console on that device with removing relevant systemd unit with</p>
<pre class="lang:default decode:true">sudo systemctl disable serial-getty@ttyAMA0.service</pre>
<p>Then have to set up the serial channel&#8217;s baud rate to enable communication, and here I&#8217;ve done that with udev: create a new rule file at /etc/udev/rules.d/AMA0_serial.rules with the content of</p>
<pre class="lang:default decode:true ">KERNEL=="ttyAMA0", RUN+="/bin/stty -F /dev/ttyAMA0 115200 raw -echo"</pre>
<p>which will set the 115200 baud rate used by Navspark when the ttyAMA0 device comes up.</p>
<p>Finally have to add gpsd&#8217;s default settings in the /etc/gpsd file:</p>
<pre class="lang:default decode:true "># Default settings for gpsd.
START_DAEMON="true"
GPSD_OPTIONS="-b -n"
DEVICES="/dev/ttyAMA0"
USBAUTO="true"</pre>
<p>Now it&#8217;s ready, and should be able to run gpsd and see some communication.</p>
<pre class="lang:default decode:true">sudo systemctl start gpsd</pre>
<p>and if want to start it on boot, then run the same command with &#8220;enable&#8221; instead &#8220;start&#8221;. Use gpsmon to see what NMEA data Navspark sends, and hopefully it will lock on soon too (mind the sky visibility!). Can also use cgps to monitor which satellites the system is locked onto.</p>
<h3>1PPS</h3>
<p>For 1PPS I had to add an item to /boot/config.txt:</p>
<pre class="lang:default decode:true">dttoverlay=pps-gpio,gpiopin=8</pre>
<p>This adds the relevant device tree overlay to enable the pps-gpio driver on GPIO8. Upon boot there was a /dev/pps0 device that can be poked at e.g. with ppstest from <a href="https://github.com/ago/pps-tools">pps-tools</a>. Since pps-tools did not have a package on ArchLinux, I made one, and the <a href="https://gist.github.com/imrehg/5548370432737a82f58c">PKGBUILD is available on Github</a>. That package also adds the timepps.h header file which is required for the chrony PPS driver to work.</p>
<p>The pps signal can be checked by running ppstest:</p>
<pre class="lang:sh decode:true ">$ sudo ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1448436177.999366423, sequence: 199 - clear  0.000000000, sequence: 0
source 0 - assert 1448436178.999373610, sequence: 200 - clear  0.000000000, sequence: 0
...</pre>
<p>but it needs a 3D fix for the signal to show up.</p>
<h3>Chrony</h3>
<p>Next up is the time server itself. The satellite time will be pulled in using two &#8220;reference clock&#8221;: the GPS timestamps provided by gpsd through a memory interface, and the PPS data that locks those timestamps. Unfortunately the PPS driver is not built in by default because it needs the timepps.h header. This means after installing pps-tools chrony needs to be recompiled.</p>
<p>Update the chrony configuration by editing the /etc/chrony.conf file. I usually leave the defaults alone, and add my modifications to the end of the file for clarity. Here&#8217;s my current setup:</p>
<pre class="lang:default decode:true">lock_all

logdir /var/log/chrony
log measurements statistics tracking refclocks

# being a server
allow 192.168/16

server 2.tw.pool.ntp.org iburst
server 3.asia.pool.ntp.org iburst
server 2.asia.pool.ntp.org iburst
server 1.europe.pool.ntp.org iburst

# on-boot time setup, from https://news.ycombinator.com/item?id=9796885
makestep 0.1 1

# from https://www.raspberrypi.org/forums/viewtopic.php?f=41&amp;t=1970&amp;start=275
refclock PPS /dev/pps0 lock GPS prefer refid PPS0
# If Beidou, there is a day offset somehow
refclock SHM 0 offset -86400 delay 0.1 refid GPS noselect

leapsectz right/Asia/Taipei</pre>
<p>It uses <a href="http://www.pool.ntp.org/en/">NTP pool servers</a> for initial time setup and a quick on-boot step (as we don&#8217;t want to be stuck at 1970, do we?). The time service related settings are the &#8220;<a href="http://chrony.tuxfamily.org/manual.html#refclock">refclock</a>&#8221; parts. The first line sets the 1PPS lock-on and I tell chrony to prefer that over other sources so we&#8217;ll switch over to that when there&#8217;s good-enough data. The second refclock section uses gpsd&#8217;s NMEA data. The large offset there is due to some issues where the reference time shows up with 24h offset. That I still need to investigate. The delay time set needs some fine-tuning too (I think), though from comments 0.1-0.3 (that is seconds) seems to be suitable? I also tell chrony not to use that for reference.</p>
<p>I also set leap seconds timezones (with the &#8220;right/&#8230;&#8221;  TAI time zone, see e.g. the <a href="http://support.ntp.org/bin/view/Support/TimeScales">NTP support page</a> and a <a href="https://lists.debian.org/debian-user/2005/12/msg03343.html">discussion on the Debian mailing list</a>). And I enable the server on the local network so other can connect to it and get the time.</p>
<p>I&#8217;ve enabled logging of the tracking data (so there&#8217;s offset and other information available) and refclocks (tailing /var/log/chrony/refclocks.log continuously is a handy way to see when the lock is lost).</p>
<p>Start chrony (or enable if you want to start it on boot)</p>
<pre class="lang:default decode:true">sudo systemctl start chrony</pre>
<p>and the results can be monitored with chronyc.</p>
<h3>All together now</h3>
<p>If everything worked well, gpsmon should show a good locked signal after not too much time, something like this:</p>
<figure id="attachment_2149" aria-describedby="caption-attachment-2149" style="width: 823px" class="wp-caption aligncenter"><a href="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_gpsmon.png"><img loading="lazy" decoding="async" class="wp-image-2149 size-full" src="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_gpsmon.png" alt="Navspark lock in gpsmon" width="823" height="513" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_gpsmon.png 823w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_gpsmon-500x312.png 500w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_gpsmon-768x479.png 768w" sizes="auto, (max-width: 823px) 100vw, 823px" /></a><figcaption id="caption-attachment-2149" class="wp-caption-text">Navspark lock in gpsmon</figcaption></figure>
<p>From the interface above I can also see that Navspark has a 3D lock (Mode A3) to satellites number 209, 207, and 206, which are Beidou birds. And that the time offset is 86399.96 seconds (~24h), that is what the chrony configuration compensates for.</p>
<p>Checking the results in chrony I the system time it&#8217;s locked to PPS0 where the last sample had 410ns offset (pretty good).  Also printed the sourcestats.</p>
<figure id="attachment_2150" aria-describedby="caption-attachment-2150" style="width: 823px" class="wp-caption aligncenter"><a href="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_chronyc.png"><img loading="lazy" decoding="async" class="wp-image-2150 size-full" src="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_chronyc.png" alt="Navspark-powered chrony time lock (PPS0 and GPS signal is relevant): sources and sourcestats" width="823" height="513" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_chronyc.png 823w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_chronyc-500x312.png 500w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_chronyc-768x479.png 768w" sizes="auto, (max-width: 823px) 100vw, 823px" /></a><figcaption id="caption-attachment-2150" class="wp-caption-text">Navspark-powered chrony time lock (PPS0 and GPS signal is relevant): sources and sourcestats</figcaption></figure>
<p>And this is pretty much all that is needed in general to have a Stratum-1 (atomic clock-locked) NTP server in general.</p>
<p>Some extra references:</p>
<ul>
<li><a href="http://brandon.penglase.net/index.php?title=NavSpark_GPS%2BGLONASS_Stratum-1_NTP_Time_Source_with_a_Raspberry_Pi">NavSpark GPS+GLONASS Stratum-1 NTP Time Source with a Raspberry Pi</a></li>
<li><a href="http://wiki.hackspherelabs.com/index.php?title=NTP_GPS_Time_Server">Hackspherelab: NTP GPS Time Server</a></li>
<li><a href="http://www.catb.org/gpsd/gpsd-time-service-howto.html">GPSD Time Service HOWTO</a></li>
</ul>
<h2>Experience</h2>
<p>Navspark has a GNSS Viewer program (available for download <a href="http://www.navspark.com.tw/downloads/">from their website</a>) which can also set the module&#8217;s parameters, for example forcing it to only listen to the GPS signal or only Beidou signal. There are a lot of settings, and I think most don&#8217;t need any change, but there&#8217;s still a bit to explore, and it&#8217;s definitely a handy tool.</p>
<figure id="attachment_2152" aria-describedby="caption-attachment-2152" style="width: 1012px" class="wp-caption aligncenter"><a href="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/GNSS_Viewer_GPS_BD.png"><img loading="lazy" decoding="async" class="wp-image-2152 size-full" src="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/GNSS_Viewer_GPS_BD.png" alt="GNSS Viewer (and configuration) in Windows" width="1012" height="740" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/GNSS_Viewer_GPS_BD.png 1012w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/GNSS_Viewer_GPS_BD-500x366.png 500w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/GNSS_Viewer_GPS_BD-768x562.png 768w" sizes="auto, (max-width: 1012px) 100vw, 1012px" /></a><figcaption id="caption-attachment-2152" class="wp-caption-text">GNSS Viewer (and configuration) in Windows</figcaption></figure>
<p>Running the NTP lock and looking at the tracking lock there are immediately a few lessons in the ~1 day I&#8217;ve been playing with the system:</p>
<p><strong>Environment matters a lot</strong>: having wind blowing over the system and being exposed to temperature changes (e.g. outdoor setting) is quite bad for frequency/time stability. One could say duh! but it&#8217;s good to see. Even a curtain and placing it indoors helps too, though having it in a well air conditioned space is even better. Too bad that in that case the sky visibility and thus the signal strength suffers a lot, but as long as there&#8217;s enough signal to have a lock it is worth it.</p>
<p><strong>PPS is lost when 3D fix is lost</strong>: this took a while to figure out why did I lose lock every now and then, especially because once chrony loses the PPS signal it won&#8217;t pick it up again.</p>
<p><strong>Indoor can work</strong>: indoor lock with the <a href="http://navspark.mybigcommerce.com/internal-gps-beidou-active-antenna/">default antenna</a> can work, but the building structure matters a lot.</p>
<h3>GPS vs Beidou</h3>
<p>Of course the most interesting part is comparing GPS and Beidou. What follows here is not very well qualified yet, just first impressions and need more work.</p>
<p>One of the biggest advantage of GPS is having a lot more satellites than Beidou. I wouldn&#8217;t be surprised if they are transmitting at a higher power too, or some other ways easier to receive. When locked onto GPS I could have rock-solid indoors time lock with 4-9 satellites visible at any one time. The time precision is judged by the offset frequency distribution that chrony reports (and would love to hear if there&#8217;s a better way to do that!), and that had a standard deviation of about 1µs by experience (in an air-conditioned office).</p>
<p>When I&#8217;ve enabled both GPS and Beidou then Navspark seemed to have generally locked onto the Beidou signal. When i was lucky I got 5-6 satellites, but generally it&#8217;s around 3 &#8211; just on the threshold of having a 3D fix, and the source of the PPS-unlock mentioned above. The offset stability on the other hand can be really good, I had runs that had about 5x smaller time offset standard deviation than GPS had (~0.2µs), and that&#8217;s quite a bit of improvement!</p>
<p>The issue is, that when I set the Navspark module GPS+Beidou then when there was a low Beidou satellite count (2-3), even though it still kept a (fragile) 3D fix, the time offset stability was pretty much the same as GPS on its own, though with some intervals of improved readings&#8230;.</p>
<figure id="attachment_2154" aria-describedby="caption-attachment-2154" style="width: 823px" class="wp-caption aligncenter"><a href="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_cgps.png"><img loading="lazy" decoding="async" class="wp-image-2154 size-full" src="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_cgps.png" alt="Locked onto a bunch of Beidou satellites (PRN larger than 200)" width="823" height="513" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_cgps.png 823w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_cgps-500x312.png 500w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Navspark_cgps-768x479.png 768w" sizes="auto, (max-width: 823px) 100vw, 823px" /></a><figcaption id="caption-attachment-2154" class="wp-caption-text">Locked onto a bunch of Beidou satellites (PRN larger than 200)</figcaption></figure>
<p>This below is a ~35minutes run of GPS+Beidou setup in an air-conditioned office with limited sky-view and 3 more stories above, using the default 12dB antenna. Using cpgs I could see that in general the lock was provided by 2-3 Beidou satellites, and in some intervals switched over to GPS without losing PPS signal (until it did). Thus it&#8217;s not the best performance that I&#8217;ve seen but still pretty good. Offset is plotted with the reported standard deviation as error bars. The central line is the mean value of the offset readings, and the two bars are the standard deviation calculated from the offsets.</p>
<figure id="attachment_2158" aria-describedby="caption-attachment-2158" style="width: 604px" class="wp-caption aligncenter"><a href="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Beidou_offset_log.png"><img loading="lazy" decoding="async" class="wp-image-2158 size-large" src="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Beidou_offset_log-1024x745.png" alt="Beidou time-lock offset over time (cutting the transients in the beginning, and finishing with signal being lost)" width="604" height="439" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Beidou_offset_log-1024x745.png 1024w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Beidou_offset_log-500x364.png 500w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Beidou_offset_log-768x559.png 768w, https://gergely.imreh.net/blog/wp-content/uploads/2015/11/Beidou_offset_log.png 1100w" sizes="auto, (max-width: 604px) 100vw, 604px" /></a><figcaption id="caption-attachment-2158" class="wp-caption-text">Beidou time-lock offset over time (cutting the transients in the beginning, and finishing with signal being lost)</figcaption></figure>
<h2>Future</h2>
<p>The ideal setup would be a well air-conditioned roof-top location (I think it would be possible to reliably see 6-7 satellites that way), and switching to Beidou only measurements to clearly see the difference between the two satellite network.</p>
<p>Improved reception could probably be achieved by <a href="http://navspark.mybigcommerce.com/tri-band-gps-galileo-glonass-bds-active-antenna/">a different Navspark antenna</a>, which provides 25±3dB gain (that&#8217;s an extra ~13dB above the current antenna), and should help indoor reception a lot. It&#8217;s currently on pre-sale and expected by the end of the year, so will keep an eye on it!</p>
<p>For more advanced improvements, the adapter board would be easy enough to redo on PCB (instead of surface mount soldering), add maybe some more voltage stabilization for the module to improve the noise figure, and probably have cleaner 1PPS signal too (compared to flying wires). Will definitely give it a try as it is so easy to get the boards printed these days, e.g. with <a href="http://www.seeedstudio.com/propagate/">Seeed Studio</a>.</p>
<p>Finally some more setting adjustments could improve the final result, such as tweaking the 1PPS pulse length, using the surveying profile for higher precision (though have to figure out what does it mean first, but looks promision), and other little tweaks&#8230;.</p>
<p>It looks to me that if the satellite reception issues are cleaned up, the Navspark + Beidou 1PPS signal should be interesting to try with laboratory frequency references for long term stability (such as a <a href="http://www.thinksrs.com/products/FS725.htm">Rubidium Clock</a>). And of course to run the Pi+Navspark as a local time reference and provide a NTP service, e.g. from the <a href="https://taipeihack.org">Tapei Hackerspace</a>&#8230;. Plenty to do. :)</p>
<p>The post <a href="https://gergely.imreh.net/blog/2015/11/navspark-beidou-ntp/">Dual Satellite NTP server with Navspark</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gergely.imreh.net/blog/2015/11/navspark-beidou-ntp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OSLO is a strange one</title>
		<link>https://gergely.imreh.net/blog/2013/03/oslo-is-a-strange-one/</link>
					<comments>https://gergely.imreh.net/blog/2013/03/oslo-is-a-strange-one/#respond</comments>
		
		<dc:creator><![CDATA[Gergely Imreh]]></dc:creator>
		<pubDate>Tue, 19 Mar 2013 15:03:18 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Lab]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[optics]]></category>
		<category><![CDATA[proprietary]]></category>
		<category><![CDATA[software]]></category>
		<guid isPermaLink="false">http://gergely.imreh.net/blog/?p=1357</guid>

					<description><![CDATA[<p>Had to use OSLO, an optics design program at work, and I'm surprised that I have grown to it - and to its quirks.</p>
<p>The post <a href="https://gergely.imreh.net/blog/2013/03/oslo-is-a-strange-one/">OSLO is a strange one</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Experimental physicists have to be the jack-of-all-trades, even on a good day, but building a new laboratory, on a budget (for any definition of &#8220;budget&#8221;) and with a limited team, is an exercise that would test anyone.</p>
<p>For my field, atomic physics, one needs a lot of different expertise: vacuum systems, computers, electronics, machining, optics are among the ones first to my mind. Today I&#8217;m looking at one of the tools that we are using for the last topics: optics.</p>
<p>In some ways, optics is pretty straightforward (both geometrical and diffraction optics), many of the calculations one could write in Python/Numpy just as well, as any software can do it. They are just pretty tedious, and there are a lot of them, optics is not a new profession. Some optics design software is very useful then, and there are not that many of them, lots of work goes into the ones that exist, thus they can be extremely expensive. One of the industry standard seem to be <a title="Zemax website" href="http://www.radiantzemax.com/en/zemax/">Zemax</a>, and many lens manufacturers provide the specs of their lenses in a Zemax format &#8211; though it is fortunately just a relatively simple text file. On the other hand, its cheapest edition is $2500, and goes up to $9500&#8230;</p>
<p>Another serious competitor is <a title="OSLO" href="http://www.lambdares.com/software_products/oslo/">OSLO</a> (Optics Software for Layout and Optimization) which is still very well known, and fortunately for us, has a dumbed down (limited number of surfaces, not all the functions available), <a title="OSLO EDU download page" href="http://www.lambdares.com/education/oslo_edu">EDU version</a>, for free. It even runs on Linux with <a title="Wine's homepage" href="http://www.winehq.org/">Wine</a>.</p>
<p>I instinctively resist any software in science &amp; research that is not free &amp; open source, because I feel that it closes some people out, though had to use something, and in the meantime I have grown to OSLO quite a bit.</p>
<figure id="attachment_1358" aria-describedby="caption-attachment-1358" style="width: 500px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="size-full wp-image-1358" alt="OSLO ray graph of an imaging system" src="http://gergely.imreh.net/blog/wp-content/uploads/2013/03/oslo_rays500.jpg" width="500" height="310" /><figcaption id="caption-attachment-1358" class="wp-caption-text">One of our imaging system design</figcaption></figure>
<p>Using OSLO, I have found that one big advantage of these software is their catalog: the glasses (oh-very-important for optics) and stock optics of different companies. This alone makes everything much easier.</p>
<p>What does the lens designer software do? You enter the parameters of some lenses by defining different surfaces and materials &amp; distances between those surfaces, give it some lightbeams, and see what comes out of it. Most of this happens in this window:</p>
<figure id="attachment_1361" aria-describedby="caption-attachment-1361" style="width: 500px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="size-full wp-image-1361" alt="The window to enter the system parameters" src="http://gergely.imreh.net/blog/wp-content/uploads/2013/03/lens_spreadsheet.jpg" width="500" height="215" /><figcaption id="caption-attachment-1361" class="wp-caption-text">Lens spreadsheet</figcaption></figure>
<p>After these settings, one can run a number of different analytics code, checking the performance and behaviour of the system by calculating a bunch of physics parameters, or can modify the system to optimize that performance one way or another.</p>
<p>This is where the number 1 strangeness &#8211; and big bonus &#8211; comes in: OSLO can be scripted in a language called Compiled Command Language (CCL), which is a subset of C; and not just scripted, but the whole program is written on top of the CCL compiler (as I understand)! The result of this is that:</p>
<ul>
<li>Your scripting can be just as powerful as the entire program, since both sides have the same functions accessible</li>
<li>There are a bunch of scripts included in the main version and even if CCL itself feels poorly documented, there are plenty of examples to learn from</li>
<li>Once your script is compiled for OSLO, it can be totally part of the system, your own menuitems, options, defaults, everything</li>
<li>Scripting is not just bolted on later, but the whole software feels like a result of &#8220;<a title="The origin of the term" href="http://en.wikipedia.org/wiki/Eating_your_own_dog_food">eating your own dogfood</a>&#8220;, resulting in a much better experience.</li>
</ul>
<p>Optics design is tedious, so once I figured out how to do the scripting, everything just become nicer. Haven&#8217;t had time to do a lot of things, but the script I have so far is <a title="OSLOhack repository" href="https://github.com/imrehg/oslohack">open source</a>, and hope to add other things later.</p>
<p>From the programming point of view, there&#8217;s one more strangeness. Starts with that the output of numerical calculations looks like this:</p>
<figure id="attachment_1359" aria-describedby="caption-attachment-1359" style="width: 500px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="size-full wp-image-1359" alt="Window showing numerical results of a lens' calculation" src="http://gergely.imreh.net/blog/wp-content/uploads/2013/03/oslo_table.jpg" width="500" height="274" /><figcaption id="caption-attachment-1359" class="wp-caption-text">Looking at some numerical results</figcaption></figure>
<p>Those are all results from different functions, calculating spot sizes and wavefront distortions and what not, and those can be run from your own script &#8211; but the return variables are just printed. And they are a table. Those are table values that have to be accessed, so for example if I want to have the Strehl Ratio there, I would have to assign the value of something like &#8220;c1&#8221; to my internal variable &#8211; c for 3rd column, 1 for first row. Though to be this simple my code would have to clear the existing table before running the wavefront function correctly. This results in a lot of counting on the screen to see what row/column output of a function I want to actually use.</p>
<p>Internally, I think most of the calculations are following a finite number of rays. Finite but very high (~1000). The big problem, that could get the unsuspecting people (like I was), that what looks like a continuous calculation, is actually digital. For example if I set an aperture within the system that cuts into the incoming rays, and keep changing the aperture size (which is just a real number), the output results don&#8217;t really change unless I exclude or include some of the beams that OSLO is using for calculation &#8211; thus the result is changing in steps, and hard to trust. I guess there should be a setting somewhere to change the number of rays used, but still trying to find it.</p>
<p>It is one clever program though. The input and output parameters of a lightbeam are really connected by the system, since practically speaking, the optics are just <a title="Fourier optics" href="http://en.wikipedia.org/wiki/Fourier_optics">transforming</a> some parameters of the beam into other values, thus if I set the input parameters, the output is given. With OSLO they do this in a way, that the code just follows what parameters you have changed last time (input beam size? output image angles?&#8230;) and that will be a fixed variable, while everything else is adjusted. Some parameters disappear when others take certain values (set your object very far away? then we don&#8217;t have to let you set your object size, since it&#8217;s not important, instead give you a viewfield angle). It&#8217;s funky when I figured it out, but took a while&#8230;</p>
<p>I don&#8217;t know how much longer I&#8217;ll have to use it at work, but this looks something that really tickled my interest learning optical design much more, and once I have the hang of the quirks, it&#8217;s pretty neat. If anyone&#8217;s interested, there&#8217;s a pretty useful <a title="OSLO-talk mailing list" href="https://groups.google.com/forum/?fromgroups#!forum/oslo-talk">mailing list</a>.</p>
<p>Now if only there was an open source solution&#8230; : )  (please drop me a line if there&#8217;s a good one)</p>
<p>The post <a href="https://gergely.imreh.net/blog/2013/03/oslo-is-a-strange-one/">OSLO is a strange one</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gergely.imreh.net/blog/2013/03/oslo-is-a-strange-one/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Laboratory 2.0 &#8211; a monitoring system</title>
		<link>https://gergely.imreh.net/blog/2012/10/laboratory-2-0-a-monitoring-system/</link>
					<comments>https://gergely.imreh.net/blog/2012/10/laboratory-2-0-a-monitoring-system/#comments</comments>
		
		<dc:creator><![CDATA[Gergely Imreh]]></dc:creator>
		<pubDate>Sun, 28 Oct 2012 14:03:15 +0000</pubDate>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[Lab]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">http://gergely.imreh.net/blog/?p=1150</guid>

					<description><![CDATA[<p>Being lazy physicist programmer, I grab on every opportunity to automate things in our lab. Recently I had my first large scale chance to try out the technologies I was playing with in my spare time, and amaze my coworkers. And of course create something useful.</p>
<p>The post <a href="https://gergely.imreh.net/blog/2012/10/laboratory-2-0-a-monitoring-system/">Laboratory 2.0 &#8211; a monitoring system</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Looks like that one of my specialty as a physicist, and contribution to the labs where I have worked so far, is bringing different kinds of programming techniques, and technologies to the table. I&#8217;m not saying I&#8217;m any better than many of the professors, post-docs, and students I&#8217;ve met so far (there are plenty of ingenious ones), it&#8217;s more like I experiment with different tools, have tried more of the cutting edge or recent technologies, did some web programming and could whip up something quick &#8211; that might not work very well at first, but does broaden the horizon for the rest of the people.</p>
<p>Also, I&#8217;m a lazy person, so want to automate as much as possible. That was on my mind recently when we have been preparing to do a vacuum-system <a title="Bake-out explanation on Wikipedia" href="http://en.wikipedia.org/wiki/Bake-out" target="_blank">bake-out</a>. It&#8217;s essentially a procedure to have a delicate experimental system, mostly made up of steel, glass, and stuff like that, closed up from the atmosphere, all the air pumped out, then heated up to high temperature (~150-300°C). One has to be careful, because things can break, there are temperature limitations for some materials, also on how quickly that temperature can change, requiring careful monitoring of the status of the system. And the whole thing takes something like two weeks or more. Perfect setting for automation.</p>
<h2>Set up the electronics</h2>
<p>The pressure measurements are done by some expensive other equipment so didn&#8217;t have to bother with that one yet, so set to work first on the temperature monitoring. Before it was a bunch of <a title="Thermocouple on Wikipedia" href="http://en.wikipedia.org/wiki/Thermocouple" target="_blank">thermocouples</a> and <a title="Multimeter on Wikipedia" href="http://en.wikipedia.org/wiki/Multimeter" target="_blank">multimeters</a>, requiring manual intervention and lots of labour. Instead, got some inspiration from <a title="Thermocouple Amplifier MAX31855 breakout board (MAX6675 upgrade) - v1.0" href="http://www.adafruit.com/products/269" target="_blank">Adafruit&#8217;s Thermocouple Breakout Board</a>, using the <a title="MAX31855 Cold-Junction Compensated Thermocouple-to-Digital Converter" href="http://www.maximintegrated.com/datasheet/index.mvp/id/7273" target="_blank">MAX31855</a> chip, and also from the <a title="Ocean Controls K Thermocouple Multiplexer Shield" href="http://www.oceancontrols.com.au/KTA-259.html" target="_blank">Thermocouple Multiplexer Shield</a>. It can handle only one channel, but can use some other chip together with it to switch between the different thermocouples, and so we can read it out one-by-one. The Adafruit board could only handle 1 channel, and the multiplexer shield was using an older chip for the measurement that I could not buy anymore. In the end, found a good analog multiplexer that one that is sold in the computer market here in Taipei, the <a title="CD4067B CMOS Single 16-Channel Analog Multiplexer/Demultiplexer" href="http://www.ti.com/product/cd4067b" target="_blank">CD4067B</a>, and it works pretty well.</p>
<figure id="attachment_1167" aria-describedby="caption-attachment-1167" style="width: 550px" class="wp-caption aligncenter"><a href="http://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack2.jpg"><img loading="lazy" decoding="async" class="size-large wp-image-1167" title="Breadboard setup for temperature monitoring" src="http://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack2-1024x768.jpg" alt="Breadboard setup for temperature monitoring Arduino" width="550" height="412" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack2-1024x768.jpg 1024w, https://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack2-500x375.jpg 500w, https://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack2-768x576.jpg 768w, https://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack2.jpg 2048w" sizes="auto, (max-width: 550px) 100vw, 550px" /></a><figcaption id="caption-attachment-1167" class="wp-caption-text">Breadboard setup for temperature monitoring with Arduino</figcaption></figure>
<p>Of course, setting it all up was quite a bit of fun times, as there were way too many gotchas along the way.</p>
<ul>
<li>MAX31855 is a <a title="Surface Mount Technology on Wikipedia" href="http://en.wikipedia.org/wiki/Surface-mount_technology" target="_blank">surface-mount</a> component, and haven&#8217;t worked with it before. Not too bad, and can be much neater, just takes some plactice</li>
<li>MAX31855 is a 3.3V circuit, so the CMOS voltage levels used by my <a title="Arduino Mega ADK on Arduino Wiki" href="http://www.arduino.cc/en/Main/ArduinoBoardADK" target="_blank">Arduino Mega ADK</a> had to be level shifted</li>
<li>Unlike the older chip, MAX31855 really needs differential input, and it&#8217;s much more sensitive to the environment. This required different kind of analog multiplexer than that board had</li>
<li>The Arduino Mega is a new model for me, and had some strange behaviour in terms of the serial communication</li>
<li>Surprisingly there are not too many options for 3.3V voltage regulators over here, just the LM1117, which is different from what others are using elsewhere</li>
<li>Lots of noise and stability issues until figured out what should be how. For example under no circumstance should touch the thermocouple to conducting surfaces, and avoid ground loops</li>
<li>While MAX31855 says it&#8217;s &#8220;cold-point compensated&#8221;, meaning that it accounts for the chip-s local temperature when measuring the thermocouple, it doesn&#8217;t appear completely compensated, meaning that we can have unexpected measurement change because the chip is heating up for example by being in a closed box.</li>
<li>Figuring out the right amount of time to wait between switching channels (375ms seems to be good enough, 500ms is totally fine)</li>
</ul>
<div>In the end, though, we did have a nice 16 channel thermocouple multiplexer, sending off the measurements onto an LCD screen and to the computer over an USB cable.</div>
<figure id="attachment_1166" aria-describedby="caption-attachment-1166" style="width: 550px" class="wp-caption aligncenter"><a href="http://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack.jpg"><img loading="lazy" decoding="async" class="size-large wp-image-1166" title="Temperature monitoring board" src="http://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack-1024x768.jpg" alt="Temperature monitoring board soldered" width="550" height="412" srcset="https://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack-1024x768.jpg 1024w, https://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack-500x375.jpg 500w, https://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack-768x576.jpg 768w, https://gergely.imreh.net/blog/wp-content/uploads/2012/10/temphack.jpg 2048w" sizes="auto, (max-width: 550px) 100vw, 550px" /></a><figcaption id="caption-attachment-1166" class="wp-caption-text">Temperature monitoring board in it&#8217;s lab setting with 16 thermocouple channels</figcaption></figure>
<p>This is then saved in a database, and can be accessed from elsewhere.</p>
<h2>Visualize!</h2>
<p>The thing that my co-workers were most amazed by wasn&#8217;t the electronics. Sure, they haven&#8217;t worked with Arduinos, but did do similar stuff. Instead they liked the monitoring interface much more, this is the one on the picture right here (can click to enlarge)</p>
<figure id="attachment_1151" aria-describedby="caption-attachment-1151" style="width: 550px" class="wp-caption aligncenter"><a href="http://gergely.imreh.net/blog/wp-content/uploads/2012/10/BOMon.png" target="_blank"><img loading="lazy" decoding="async" class="size-large wp-image-1151  " title="Bakeout Monitor" src="http://gergely.imreh.net/blog/wp-content/uploads/2012/10/BOMon-1024x586.png" alt="Bakeout Monitor  interface showing the vacuum system, temperatures, pressures and long term graphs" width="550" height="314" /></a><figcaption id="caption-attachment-1151" class="wp-caption-text">Bakeout Monitor interface (click image for full view)</figcaption></figure>
<p>It&#8217;s the schematic layout of our equipment, with the temperatures positioned where the actual sensors are. Also, the change of the measured values in time are also displayed with live scrolling.</p>
<p>I&#8217;m not saying it&#8217;s great. Thinking about it, the major insight that made it good for the rest of the people is that I realized how much more people understand visual data: the placement of the values to the corresponding locations on the schematics. That&#8217;s the only thing.</p>
<p>So inside it&#8217;s a <a title="MongoDB" href="http://www.mongodb.org/" target="_blank">MongoDB</a> database (learned from previous mistakes, using a replica-set at least), with <a title="Python homepage" href="http://www.python.org/" target="_blank">Python</a> scripts talking to the sensors and saving the data, <a title="NodeJS home page" href="http://nodejs.org/" target="_blank">NodeJS</a> /<a title="Smoothie Charts homepage" href="http://smoothiecharts.org/" target="_blank"> Smoothie Charts</a> for visualization (and plain old CSS positioning of <a title="&lt;input&gt; tag explanation" href="http://www.w3schools.com/tags/tag_input.asp">&lt;input&gt; tags</a> for the reading display), <a title="NGINX homepage" href="http://nginx.org/" target="_blank">nginx</a>&#8216;s upstream module for running two monitoring servers just in case. It&#8217;s mostly in the <a title="Bakeout code on Github" href="https://github.com/imrehg/bakeout" target="_blank">Github repo of the monitoring code</a>, as well as the <a title="Arduino temperature monitoring" href="https://github.com/imrehg/sketchbook/tree/master/Thermocouple5" target="_blank">Arduino sketch for talking to the electronics</a>.</p>
<p>It was actually quite fun to write it all, and the gradual improvements, trying the new tech, trying not to lose to much data, amazed how well it works. Especially had a good time learning about the database, scaling, fault tolerance, performance&#8230;</p>
<p>Of course there could be room for a lot more improvements.</p>
<ul>
<li>My failover-restart bash scripts are awful, though they do seem to work more or less and counteract the USB unreliablilities</li>
<li>There were some changes to Smoothie Charts that I could improve on: logarithmic plotting, some display enhancements, wonder if it can be more optimized for performance</li>
<li>More efficient data loading. 12h data is about 30Mb in JSON format, that I send compressed, apparently it gets down to ~5% in size, but it still takes quite a bit of time to process on the frontend</li>
<li>The layout now can be changed from config files if the sensors change, so co-workers can do that without programming knowledge. I wonder if that can be simplified even more</li>
</ul>
<p>Of course, I&#8217;m a person who generally overengineers stuff, so maybe it&#8217;s good to stop somewhere. And the somewhere might be when I got to the point to use my Kindle for monitoring (craps out on 1h data already, but some real time things are good enough).</p>
<figure id="attachment_1161" aria-describedby="caption-attachment-1161" style="width: 500px" class="wp-caption aligncenter"><a href="http://gergely.imreh.net/blog/wp-content/uploads/2012/10/bomon_kindle_opt1.jpg"><img loading="lazy" decoding="async" class="size-full wp-image-1161" title="Bakeout Monitor on Kindle" src="http://gergely.imreh.net/blog/wp-content/uploads/2012/10/bomon_kindle_opt1.jpg" alt="Bakeout Monitor interface running on Kindle" width="500" height="416" /></a><figcaption id="caption-attachment-1161" class="wp-caption-text">Bakeout Monitor on running on Kindle 3, not perfect but does work</figcaption></figure>
<h2>Get on with it</h2>
<p>I did learn a lot along the way, and I&#8217;m sure that with this experience I will be let to do a little bit more in the lab in terms of programming ideas. I don&#8217;t like that the rest of the system is currently forced to be LabView, but that&#8217;s for another post, and there are so many things that can be improved in general as well. Let&#8217;s just go and do that.</p>
<p>The post <a href="https://gergely.imreh.net/blog/2012/10/laboratory-2-0-a-monitoring-system/">Laboratory 2.0 &#8211; a monitoring system</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gergely.imreh.net/blog/2012/10/laboratory-2-0-a-monitoring-system/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>The Two Things about Physics</title>
		<link>https://gergely.imreh.net/blog/2012/02/the-two-things-about-physics/</link>
					<comments>https://gergely.imreh.net/blog/2012/02/the-two-things-about-physics/#comments</comments>
		
		<dc:creator><![CDATA[Gergely Imreh]]></dc:creator>
		<pubDate>Wed, 01 Feb 2012 10:49:34 +0000</pubDate>
				<category><![CDATA[Physics]]></category>
		<category><![CDATA[Thinking]]></category>
		<category><![CDATA[philosophy]]></category>
		<guid isPermaLink="false">http://gergely.imreh.net/blog/?p=656</guid>

					<description><![CDATA[<p>Yesterday I&#8217;ve read an article that  about every topic, one has to know only Two Things. For every subject, there are really only two things you really need to know. Everything else is the application of those two things, or just not important. Of course it is a fascinating idea, and I started to think [&#8230;]</p>
<p>The post <a href="https://gergely.imreh.net/blog/2012/02/the-two-things-about-physics/">The Two Things about Physics</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Yesterday I&#8217;ve read an <a title="The Two Things" href="http://www.csun.edu/~dgw61315/thetwothings.html" target="_blank">article</a> that  about every topic, one has to know only Two Things.</p>
<blockquote><p>For every subject, there are really only two things you really need to know. Everything else is the application of those two things, or just not important.</p></blockquote>
<p>Of course it is a fascinating idea, and I started to think about my profession, physics. If I simplify my experience and knowledge down to this minimal level, what would be the two things I get to? I do think it is not a straightforward stuff, and one can only get to the bottom of this, can find the hidden truth below, if one spends a lot of time with the subject, gets to know it inside and out. I feel that I&#8217;m still just scratching the surface of the wast knowledge of the universe (even after being a physicist for about 12 years now). Still this doesn&#8217;t stop me from trying.</p>
<figure id="attachment_662" aria-describedby="caption-attachment-662" style="width: 400px" class="wp-caption aligncenter"><a href="http://gergely.imreh.net/blog/2012/02/the-two-things-about-physics/o83/" rel="attachment wp-att-662"><img loading="lazy" decoding="async" class="size-medium wp-image-662 " title="Relativity in my Wreck This Journal" src="http://gergely.imreh.net/blog/wp-content/uploads/2012/02/o83-400x300.jpg" alt="Drawing in my Wreck This Journal" width="400" height="300" /></a><figcaption id="caption-attachment-662" class="wp-caption-text">At Geek Dinner Taipei someone contributed this drawing of the Einstein Field Equations to my Wreck This Journal. Of course, this is ignoring a possible non-zero cosmological constant.</figcaption></figure>
<p>I&#8217;m an experimental physicist, worked in Solid State Physics first, now mostly in Atomic &amp; Laser Physics &#8211; all kind of fun stuff. I had very good professors, great inspiration and I have learnt a lot from them. If I think back all the things I&#8217;ve learned there are still things that come to me as my first thoughts, and usually those are the right guesses, for whatever intuition I have.</p>
<h3>My Two Things about Physics:</h3>
<ol>
<li>Pure math can take you very far along the way, though in the end still need experiment to see whether the results describe something real.</li>
<li>Everything is an approximation, but that&#8217;s fine. Just pick your approximations carefully.</li>
</ol>
<p>Maybe it is worth expanding a little bit on that these:</p>
<p>Pure math can be used to describe things extremely well. It&#8217;s maybe even too good at that, which got other, much cleverer people to think as well, like a fellow Hungarian physicist, <a title="Wigner Jeno on Wikipedia" href="http://en.wikipedia.org/wiki/Eugene_Wigner" target="_blank">Wigner Jenő (or Eugen Wigner)</a>, writing about <a title="The Unreasonable Effectiveness of Mathematics in the Natural Sciences" href="http://www.dartmouth.edu/~matc/MathDrama/reading/Wigner.html" target="_blank">The Unreasonable Effectiveness of Mathematics in the Natural Sciences</a>. I frequently got myself really excited when after doing some complicated calculation to predict the behaviour of a physical system, the experiment matches up to all of its nuances. Let it be atomic spectroscopy, polarization of light reflected from metallic mirrors, magnetic field of a Zeeman-slower, I had a lot of fun figuring out the physical theories of different phenomena then matching it up with what happens in the lab. Of course, there were loads of times when they didn&#8217;t match, but it turns out my math was off. Really, if I want to understand the world, math is one of the most useful and versatile tool to have.</p>
<p>Having that tool is of course not enough. When people come up with new and interesting math trick, it often turns out (to many people&#8217;s amusement) that those tricks have some physical meaning, they often also give some insight into the world around us. It&#8217;s often, but not always. Mathematics can really easy take one to very strange places and give a result, which is completely aphysical. To complicate things even further, those aphysical results sometimes turn out to be actually correct and predicting real but insofar unobserved things. An example of this is the Dirac equation which gives two solution, one for electron, and one particle with negative mass that first people dismissed, but later it was understood as the representation of <a title="Positron on Wikipedia" href="http://en.wikipedia.org/wiki/Positron" target="_blank">positron</a>. How to distinguish between really wrong solution and &#8220;wrong as current understanding&#8221;, that&#8217;s a whole different level of problems.</p>
<p>The second point was really a revelation for me. Whatever equations we have, they all just describe things to a certain level. If we can look closer, we often find differences from the theory, that are harder and harder to explain as we get closer. On the other hand, using intuition and physical understanding, people often choose to ignore certain parts of the situation, or certain features of the problem since it cannot affect the results to a level that would be observed in the given experiment. This makes everything solvable, and once solved, one can advance on top of the new understanding even deeper into the problem. Finding the good approximations is almost as valuable as finding the right theory, that&#8217;s why often these approximations are named after the people who came up with them, or given other shorthand names so everyone can quickly recall and use them.</p>
<p>There&#8217;s a whole methodology built to help come up with approximations and handle them, called <a title="Perturbation Theory on Wikipedia" href="http://en.wikipedia.org/wiki/Perturbation_theory" target="_blank">perturbation theory</a>: if the given problem is very similar to a simpler, already solved problem, then treat it as the simple one plus some small effect that changes relatively little on the behaviour of the system. Not everything can be handled like this, but surprisingly many problems fit very well.</p>
<h3>Others&#8217; Two Things about Physics</h3>
<p>On the original site there were <a title="Natural Sciences section of The Two Things collection" href="http://www.csun.edu/~dgw61315/thetwothings.html#Natural Sciences" target="_blank">other people&#8217;s Two Things</a> as well:</p>
<blockquote><p>1. Energy is conserved.<br />
2. Photons (and everything else) behave like both waves and particles.<br />
-Tim Lee</p>
<p>1.  Draw a diagram.<br />
2.  Get the dimensions straight.<br />
-Eric Schafer</p></blockquote>
<p>I personally don&#8217;t like these that much. The first one is just stating two theories that can be superseded in the future, and right now they kind of limit instead of enable. The second one is good advice, but can&#8217;t say that&#8217;s the only thing there about physics. Having said that, I have more adventures with incorrect dimensions and units than I&#8217;d prefer to have.</p>
<p>What other Two Things choices one can make, in physics or in other sciences, other topics?</p>
<p>The post <a href="https://gergely.imreh.net/blog/2012/02/the-two-things-about-physics/">The Two Things about Physics</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gergely.imreh.net/blog/2012/02/the-two-things-about-physics/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Rules of the garage, I mean, lab</title>
		<link>https://gergely.imreh.net/blog/2011/02/rules-of-the-garage-i-mean-lab/</link>
					<comments>https://gergely.imreh.net/blog/2011/02/rules-of-the-garage-i-mean-lab/#comments</comments>
		
		<dc:creator><![CDATA[Gergely Imreh]]></dc:creator>
		<pubDate>Mon, 21 Feb 2011 12:28:00 +0000</pubDate>
				<category><![CDATA[Lab]]></category>
		<category><![CDATA[gtd]]></category>
		<category><![CDATA[philosophy]]></category>
		<category><![CDATA[work]]></category>
		<guid isPermaLink="false">http://gergely.imreh.net/blog/?p=210</guid>

					<description><![CDATA[<p>I was catching up on StartupBus, an awesome (crazy? probably both) project that I really wish I could take part in. One part was watching the videos they shared in Youtube, especially one series by Phil McKinney (Chief Technology Officer at HP), where among other things he talks about the Rules of the Garage (the [&#8230;]</p>
<p>The post <a href="https://gergely.imreh.net/blog/2011/02/rules-of-the-garage-i-mean-lab/">Rules of the garage, I mean, lab</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I was catching up on <a title="StartupBus home page" href="http://www.startupbus.com/" target="_blank">StartupBus</a>, an awesome (crazy? probably both) project that I really wish I could take part in. One part was watching the videos they shared in <a title="StartapBus on Youtube" href="http://youtube.com/user/startupbus" target="_blank">Youtube</a>, especially one series by <a title="Phil McKinney's blog" href="http://philmckinney.com/" target="_blank">Phil McKinney</a> (Chief Technology Officer at HP), where among other things <a title="Phil McKinney of HP on Bus Based Innovation - Part 2: The Rules of the Bus" href="http://www.youtube.com/user/startupbus#p/c/C3D0EB5665205748/1/sqbgLeD5Y40" target="_blank">he talks about the Rules of the Garage</a> (the <a title="The Garage" href="http://www.hp.com/hpinfo/abouthp/histnfacts/garage/" target="_blank">garage</a> where HP was started). It is very inspiring I think those rules should apply not just in business but many other creative team effort. Such creative team effort is, for example, a physics lab, just like the one I&#8217;m working now. And indeed this group would need some philosophy infusion like this.</p>
<ol>
<li>Believe you can change the world.</li>
<li>Work quickly, keep the tools unlocked, work whenever.</li>
<li>Know when to work alone and when to work together.</li>
<li>Share tools, ideas. Trust your colleagues.</li>
<li>No Politics. No bureaucracy. (These are ridiculous in a [lab]).</li>
<li>The customer defines a job well done. [?]</li>
<li>Radical ideas are not bad ideas.</li>
<li>Invent different ways of working.</li>
<li>Make a contribution every day.</li>
<li>If it doesn’t contribute, it doesn’t leave the [lab].</li>
<li>Believe that together we can do anything.</li>
<li>Invent.</li>
</ol>
<p>These are so well formulated that they give more of an &#8220;aha!&#8221; feeling instead of a question that &#8220;yeah? why&#8217;s that?&#8221;. Researchers should have all of this drilled in. Or rather everyone should have.</p>
<p>The only one that I&#8217;m not satisfied by is #6: what constitutes a &#8220;job well done&#8221; in academia? No customers so no direct measurable response to the effort. The commonly used metrics are amount of grants won, number of members who won tenures, number of publications and/or citation, conference invitations, and so on, none of which really captures what science is about and why people should be doing it. But then what is the metric? Maybe this is a problem in general, no clear aim makes unfocused effort. Or is it a strength as people can define their own measures of success? I don&#8217;t think that&#8217;s the right way either. I usually go by the &#8220;amount of curiosity satisfied and new things learned&#8221;. But since I feel I have learned an awful lot lately but still barely going forward, maybe I&#8217;m not the example of someone who should be followed on this.</p>
<p>Anyway, I wanted to post this, because it needs a bit more thinking and have to start somewhere. And indeed there&#8217;s a lot to do&#8230;</p>
<figure id="attachment_213" aria-describedby="caption-attachment-213" style="width: 300px" class="wp-caption aligncenter"><a href="http://gergely.imreh.net/blog/wp-content/uploads/2011/02/IMG_6390.jpg"><img loading="lazy" decoding="async" class="size-medium wp-image-213" title="Lab" src="http://gergely.imreh.net/blog/wp-content/uploads/2011/02/IMG_6390-300x225.jpg" alt="Optical table" width="300" height="225" /></a><figcaption id="caption-attachment-213" class="wp-caption-text">Just a random landscape on the optical table</figcaption></figure>
<p>Now back to work. But better this time, there&#8217;s a world to change.</p>
<p>The post <a href="https://gergely.imreh.net/blog/2011/02/rules-of-the-garage-i-mean-lab/">Rules of the garage, I mean, lab</a> appeared first on <a href="https://gergely.imreh.net/blog">ClickedyClick</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gergely.imreh.net/blog/2011/02/rules-of-the-garage-i-mean-lab/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Object Caching 19/26 objects using APC
Page Caching using Disk: Enhanced 
Lazy Loading (feed)

Served from: gergely.imreh.net @ 2026-04-16 01:07:22 by W3 Total Cache
-->