Tag Archives: guide

Arduino GPS – Ublox NEO-M8N Flight Controller GPS w/Protective Shell for PIX PX4 Pixhawk

Hey everyone,

I recently purchased this GPS unit on ebay: http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItemVersion&item=272492032614&view=all&tid=1865626885017

Unfortunately, I didn’t do a lot of research before getting it and had a bit of trouble finding any spec sheets or documentation. Just in case anyone else has the same problem I’ve listed out everything I needed to get it running below.

This is the wiring info you’ll need:
– VCC: red
– GND: black
– TXD: yellow
– RXD: white
– SCL: green
– SDA: blue

The default baud rate was 38400.

This is the example I ended up using to get a quick test up and running. Ensure that you map the rx and tx pins correctly (arduino tx to gps rx, arduino rx to gps tx).


v#include
#include
/*
This sample sketch demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
static const int RXPin = 11, TXPin = 10;
static const uint32_t GPSBaud = 38400;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
Serial.begin(115200);
ss.begin(GPSBaud);

Serial.println(F("DeviceExample.ino"));
Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
Serial.println(F("by Mikal Hart"));
Serial.println();
}

void loop()
{
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0)
if (gps.encode(ss.read()))
displayInfo();

if (millis() > 5000 && gps.charsProcessed() < 10) { Serial.println(F("No GPS detected: check wiring.")); while(true); } } void displayInfo() { Serial.print(F("Location: ")); if (gps.location.isValid()) { Serial.print(gps.location.lat(), 6); Serial.print(F(",")); Serial.print(gps.location.lng(), 6); } else { Serial.print(F("INVALID")); } Serial.print(F(" Date/Time: ")); if (gps.date.isValid()) { Serial.print(gps.date.month()); Serial.print(F("/")); Serial.print(gps.date.day()); Serial.print(F("/")); Serial.print(gps.date.year()); } else { Serial.print(F("INVALID")); } Serial.print(F(" ")); if (gps.time.isValid()) { if (gps.time.hour() < 10) Serial.print(F("0")); Serial.print(gps.time.hour()); Serial.print(F(":")); if (gps.time.minute() < 10) Serial.print(F("0")); Serial.print(gps.time.minute()); Serial.print(F(":")); if (gps.time.second() < 10) Serial.print(F("0")); Serial.print(gps.time.second()); Serial.print(F(".")); if (gps.time.centisecond() < 10) Serial.print(F("0")); Serial.print(gps.time.centisecond()); } else { Serial.print(F("INVALID")); } Serial.println(); }

Output should be something like this:

DeviceExample.ino
A simple demonstration of TinyGPS++ with an attached GPS module
Testing TinyGPS++ library v. 0.92
by Mikal Hart

Location: -27.427371,153.028945 Date/Time: 9/10/2017 06:04:21.40
Location: -27.427371,153.028945 Date/Time: 9/10/2017 06:04:21.40
LocatiaonfTGS+wh atahdSmlesiTiGS+bay .2b a at
ain Da/ie/ ai .Da/Te 1tion: -27.427371,153.028945 Date/Time: 9/10/2017 06:04:21.60
Location: -27.427371,153.028945 Date/Time: 9/10/2017 06:04:21.60
LocaS+bay .2b a at
ain Da/ie/ ai .Da/Te 1tion: -.aeTm1.
ti:.atTm:7cation: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:21.80
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:21.80
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.00
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.00
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.20
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.20
Location: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.40
Locat/Te:/ an:3aTi: /1ain.atTm:7atn 3Dtie 1.cto.3teim 1.
ti: .aTim1aton: -27.427370,153.028945 Date/Time: 9/10/2017 06:04:22.40
Location: -27.427368,153.028945 Date/Time: 9/10/2017 06:04:22.60
Location: -27.427368,153.028945 Datn 3Dtie 1.cto.3teim 1.

One final thing to note is that the blue light will start to flash once the GPS has a lock. You'll need a pretty open space, mine didn't work inside but got a lock within 60 seconds outside.

Let me know if you have any questions or links to better doco!

Start a Script on Startup – Raspberry Pi

Hey guys,

Just thought I’d leave a couple of links to some guides I came across for setting up boot scripts on a raspberry pi.

Quick guide on how to get them running: http://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/

How to delay the boot process until the network is available: https://raspberrypi.stackexchange.com/a/45774

Running ReadTheDocs on Windows

Hey everyone,

This is a quick guide on how to setup your own readthedocs server on Windows.

Install Python 2.7: https://www.python.org/downloads/

Install virtual env using pip via command prompt (run as administrator):
c:\Python27>python.exe scripts\pip.exe install virtualenv

Create a virtual environment:
c:\Python27>scripts\virtualenv.exe c:\readthedocs
c:\readthedocs\Scripts>activate.bat
(readthedocs) c:\readthedocs\Scripts>

Create a folder and clone the repository:
(readthedocs) c:\readthedocs\Scripts>md checkouts
(readthedocs) c:\readthedocs\Scripts>cd checkouts
(readthedocs) c:\readthedocs\Scripts\checkouts>git clone http://github.com/rtfd/readthedocs.org.git
Cloning into 'readthedocs.org'...
remote: Counting objects: 47896, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 47896 (delta 19), reused 0 (delta 0), pack-reused 47843
Receiving objects: 100% (47896/47896), 37.91 MiB | 8.76 MiB/s, done.
Resolving deltas: 100% (31783/31783), done.
Checking connectivity... done.

Get and install dependencies using pip:
(readthedocs) c:\readthedocs\Scripts\checkouts>cd readthedocs.org
(readthedocs) c:\readthedocs\Scripts\checkouts\readthedocs.org>git clone http://github.com/rtfd/readthedocs.org.git

Ran into the following error: no module named django.core.management (probably caused by having two version of python installed)
(readthedocs) c:\readthedocs\Scripts\checkouts\readthedocs.org>c:\Python27\python.exe c:\readthedocs\Scripts\pip.exe install django --upgrade
Collecting django
Using cached Django-1.10.2-py2.py3-none-any.whl
Installing collected packages: django
Successfully installed django-1.10.2
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

Build the database:
(readthedocs) c:\readthedocs\Scripts\checkouts\readthedocs.org>c:\Python27\pytho
n.exe C:\readthedocs\Scripts\checkouts\readthedocs.org\manage.py syncdb
Operations to perform:
Synchronize unmigrated apps: allauth, messages, django_extensions, django_grav
atar, rest_framework, annoying, textclassifier, corsheaders, copyright, privacy,
django_countries, humanize, rtd_tests, haystack, doc_builder, staticfiles, rest
api, bitbucket_oauth2, bitbucket, notifications, djangosecure, pagination, githu
b, djcelery, payments
Apply all migrations: core, account, builds, gold, sessions, admin, guardian,
tastypie, messages_extends, comments, sites, contenttypes, redirects, auth, tagg
it, oauth, bookmarks, donate, projects, socialaccount
Synchronizing apps without migrations:
Creating tables...
Creating table corsheaders_corsmodel
Creating table celery_taskmeta
Creating table celery_tasksetmeta
Creating table djcelery_intervalschedule
Creating table djcelery_crontabschedule
Creating table djcelery_periodictasks
Creating table djcelery_periodictask
Creating table djcelery_workerstate
Creating table djcelery_taskstate
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying account.0001_initial... OK
Applying account.0002_email_max_length... OK
Applying admin.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying taggit.0001_initial... OK
Applying projects.0001_initial... OK
Applying builds.0001_initial... OK
Applying projects.0002_add_importedfile_model... OK
Applying bookmarks.0001_initial... OK
Applying builds.0002_build_command_initial... OK
Applying comments.0001_initial... OK
Applying core.0001_initial... OK
Applying core.0002_make_userprofile_user_a_onetoonefield... OK
Applying core.0003_add_banned_status... OK
Applying donate.0001_initial... OK
Applying donate.0002_dollar-drop-choices... OK
Applying donate.0003_add-impressions... OK
Applying donate.0004_rebase-impressions-on-base... OK
Applying donate.0005_add-geo-filters... OK
Applying donate.0006_add-geo-data... OK
Applying donate.0007_add-impression-totals... OK
Applying gold.0001_initial... OK
Applying guardian.0001_initial... OK
Applying messages_extends.0001_initial... OK
Applying sites.0001_initial... OK
Applying socialaccount.0001_initial... OK
Applying socialaccount.0002_token_max_lengths... OK
Applying oauth.0001_initial... OK
Applying oauth.0002_combine_services... OK
Applying oauth.0003_move_github... OK
Applying oauth.0004_drop_github_and_bitbucket_models... OK
Applying oauth.0005_add_account_relation... OK
Applying oauth.0006_move_oauth_source... OK
Applying oauth.0007_org_slug_nonunique... OK
Applying projects.0003_project_cdn_enabled... OK
Applying projects.0004_add_project_container_image... OK
Applying projects.0005_sync_project_model... OK
Applying projects.0006_add_domain_models... OK
Applying projects.0007_migrate_canonical_data... OK
Applying projects.0008_add_subproject_alias_prefix... OK
Applying projects.0009_add_domain_field... OK
Applying projects.0010_migrate_domain_data... OK
Applying projects.0011_delete-url... OK
Applying projects.0012_proper-name-for-install-project... OK
Applying projects.0013_add-container-limits... OK
Applying projects.0014_add-state-tracking... OK
Applying projects.0015_add_project_allow_promos... OK
Applying projects.0016_build-queue-name... OK
Applying projects.0017_add_domain_https... OK
Applying redirects.0001_initial... OK
Applying sessions.0001_initial... OK
Applying taggit.0002_auto_20150616_2121... OK
Applying tastypie.0001_initial... OK

Starting the readthedocs server:
D:\Users\ChrisO>C:\readthedocs\Scripts\activate.bat

(readthedocs) D:\Users\ChrisO>c:\Python27\python.exe C:\readthedocs\Scripts\chec
kouts\readthedocs.org\manage.py runserver
Performing system checks…

System check identified no issues (1 silenced).
October 21, 2016 – 11:16:17
Django version 1.8.3, using settings ‘readthedocs.settings.dev’
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

Create a new readthedocsproject:
I followed this guide: http://read-the-docs.readthedocs.io/en/latest/getting_started.html#in-rst

Creating the new project:
C:\readthedocs>md whatibroke
C:\readthedocs>cd whatibroke
C:\readthedocs\whatibroke>C:\readthedocs\Scripts\sphinx-quickstart.exe
Welcome to the Sphinx 1.3.5 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Installing a theme – sphinx_rtd_theme (optional step):
c:\readthedocs\Scripts>activate.bat
(readthedocs) c:\readthedocs\Scripts>cd c:\readthedocs\whatibroke
(readthedocs) c:\readthedocs\whatibroke>pip install sphinx_rtd_theme

In your conf.py file (C:\readthedocs\whatibroke\conf.py):
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

Building your output:
c:\readthedocs\Scripts>activate.bat
(readthedocs) c:\readthedocs\Scripts>cd c:\readthedocs\whatibroke
(readthedocs) c:\readthedocs\whatibroke>make html
Running Sphinx v1.3.5
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
no targets are out of date.
build succeeded.

Build finished. The HTML pages are in _build/html.

Thanks to the following stackoverflow post for a lot of the information here: http://stackoverflow.com/a/19892345/522859

How to Add a FontAwesome Icon using :after

Hey everyone,

Just a quick post on how to add a fontawesome icon using :after:


.fl-cart-product-price:after{
content: '\f00d';
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
margin: 0px 0px 0px 10px;
color: #555;
font-size: 85%;
text-decoration: none;
}

See this stackoverflow post for more info: http://stackoverflow.com/a/18793584/522859

Culture Info Codes

Hey everyone,

Just posting a link to this list of culture info codes etc. I was looking for the en-AU one but had a bit of trouble tracking it down.

Language Culture Name Display Name Culture Code ISO 639x Value
af-ZA Afrikaans – South Africa 0x0436 AFK
sq-AL Albanian – Albania 0x041C SQI
ar-DZ Arabic – Algeria 0x1401 ARG
ar-BH Arabic – Bahrain 0x3C01 ARH
ar-EG Arabic – Egypt 0x0C01 ARE
ar-IQ Arabic – Iraq 0x0801 ARI
ar-JO Arabic – Jordan 0x2C01 ARJ
ar-KW Arabic – Kuwait 0x3401 ARK
ar-LB Arabic – Lebanon 0x3001 ARB
ar-LY Arabic – Libya 0x1001 ARL
ar-MA Arabic – Morocco 0x1801 ARM
ar-OM Arabic – Oman 0x2001 ARO
ar-QA Arabic – Qatar 0x4001 ARQ
ar-SA Arabic – Saudi Arabia 0x0401 ARA
ar-SY Arabic – Syria 0x2801 ARS
ar-TN Arabic – Tunisia 0x1C01 ART
ar-AE Arabic – United Arab Emirates 0x3801 ARU
ar-YE Arabic – Yemen 0x2401 ARY
hy-AM Armenian – Armenia 0x042B  
Cy-az-AZ Azeri (Cyrillic) – Azerbaijan 0x082C  
Lt-az-AZ Azeri (Latin) – Azerbaijan 0x042C  
eu-ES Basque – Basque 0x042D EUQ
be-BY Belarusian – Belarus 0x0423 BEL
bg-BG Bulgarian – Bulgaria 0x0402 BGR
ca-ES Catalan – Catalan 0x0403 CAT
zh-CN Chinese – China 0x0804 CHS
zh-HK Chinese – Hong Kong SAR 0x0C04 ZHH
zh-MO Chinese – Macau SAR 0x1404  
zh-SG Chinese – Singapore 0x1004 ZHI
zh-TW Chinese – Taiwan 0x0404 CHT
zh-CHS Chinese (Simplified) 0x0004  
zh-CHT Chinese (Traditional) 0x7C04  
hr-HR Croatian – Croatia 0x041A HRV
cs-CZ Czech – Czech Republic 0x0405 CSY
da-DK Danish – Denmark 0x0406 DAN
div-MV Dhivehi – Maldives 0x0465  
nl-BE Dutch – Belgium 0x0813 NLB
nl-NL Dutch – The Netherlands 0x0413  
en-AU English – Australia 0x0C09 ENA
en-BZ English – Belize 0x2809 ENL
en-CA English – Canada 0x1009 ENC
en-CB English – Caribbean 0x2409  
en-IE English – Ireland 0x1809 ENI
en-JM English – Jamaica 0x2009 ENJ
en-NZ English – New Zealand 0x1409 ENZ
en-PH English – Philippines 0x3409  
en-ZA English – South Africa 0x1C09 ENS
en-TT English – Trinidad and Tobago 0x2C09 ENT
en-GB English – United Kingdom 0x0809 ENG
en-US English – United States 0x0409 ENU
en-ZW English – Zimbabwe 0x3009  
et-EE Estonian – Estonia 0x0425 ETI
fo-FO Faroese – Faroe Islands 0x0438 FOS
fa-IR Farsi – Iran 0x0429 FAR
fi-FI Finnish – Finland 0x040B FIN
fr-BE French – Belgium 0x080C FRB
fr-CA French – Canada 0x0C0C FRC
fr-FR French – France 0x040C  
fr-LU French – Luxembourg 0x140C FRL
fr-MC French – Monaco 0x180C  
fr-CH French – Switzerland 0x100C FRS
gl-ES Galician – Galician 0x0456  
ka-GE Georgian – Georgia 0x0437  
de-AT German – Austria 0x0C07 DEA
de-DE German – Germany 0x0407  
de-LI German – Liechtenstein 0x1407 DEC
de-LU German – Luxembourg 0x1007 DEL
de-CH German – Switzerland 0x0807 DES
el-GR Greek – Greece 0x0408 ELL
gu-IN Gujarati – India 0x0447  
he-IL Hebrew – Israel 0x040D HEB
hi-IN Hindi – India 0x0439 HIN
hu-HU Hungarian – Hungary 0x040E HUN
is-IS Icelandic – Iceland 0x040F ISL
id-ID Indonesian – Indonesia 0x0421  
it-IT Italian – Italy 0x0410  
it-CH Italian – Switzerland 0x0810 ITS
ja-JP Japanese – Japan 0x0411 JPN
kn-IN Kannada – India 0x044B  
kk-KZ Kazakh – Kazakhstan 0x043F  
kok-IN Konkani – India 0x0457  
ko-KR Korean – Korea 0x0412 KOR
ky-KZ Kyrgyz – Kazakhstan 0x0440  
lv-LV Latvian – Latvia 0x0426 LVI
lt-LT Lithuanian – Lithuania 0x0427 LTH
mk-MK Macedonian (FYROM) 0x042F MKD
ms-BN Malay – Brunei 0x083E  
ms-MY Malay – Malaysia 0x043E  
mr-IN Marathi – India 0x044E  
mn-MN Mongolian – Mongolia 0x0450  
nb-NO Norwegian (Bokmål) – Norway 0x0414  
nn-NO Norwegian (Nynorsk) – Norway 0x0814  
pl-PL Polish – Poland 0x0415 PLK
pt-BR Portuguese – Brazil 0x0416 PTB
pt-PT Portuguese – Portugal 0x0816  
pa-IN Punjabi – India 0x0446  
ro-RO Romanian – Romania 0x0418 ROM
ru-RU Russian – Russia 0x0419 RUS
sa-IN Sanskrit – India 0x044F  
Cy-sr-SP Serbian (Cyrillic) – Serbia 0x0C1A  
Lt-sr-SP Serbian (Latin) – Serbia 0x081A  
sk-SK Slovak – Slovakia 0x041B SKY
sl-SI Slovenian – Slovenia 0x0424 SLV
es-AR Spanish – Argentina 0x2C0A ESS
es-BO Spanish – Bolivia 0x400A ESB
es-CL Spanish – Chile 0x340A ESL
es-CO Spanish – Colombia 0x240A ESO
es-CR Spanish – Costa Rica 0x140A ESC
es-DO Spanish – Dominican Republic 0x1C0A ESD
es-EC Spanish – Ecuador 0x300A ESF
es-SV Spanish – El Salvador 0x440A ESE
es-GT Spanish – Guatemala 0x100A ESG
es-HN Spanish – Honduras 0x480A ESH
es-MX Spanish – Mexico 0x080A ESM
es-NI Spanish – Nicaragua 0x4C0A ESI
es-PA Spanish – Panama 0x180A ESA
es-PY Spanish – Paraguay 0x3C0A ESZ
es-PE Spanish – Peru 0x280A ESR
es-PR Spanish – Puerto Rico 0x500A ES
es-ES Spanish – Spain 0x0C0A  
es-UY Spanish – Uruguay 0x380A ESY
es-VE Spanish – Venezuela 0x200A ESV
sw-KE Swahili – Kenya 0x0441  
sv-FI Swedish – Finland 0x081D SVF
sv-SE Swedish – Sweden 0x041D  
syr-SY Syriac – Syria 0x045A  
ta-IN Tamil – India 0x0449  
tt-RU Tatar – Russia 0x0444  
te-IN Telugu – India 0x044A  
th-TH Thai – Thailand 0x041E THA
tr-TR Turkish – Turkey 0x041F TRK
uk-UA Ukrainian – Ukraine 0x0422 UKR
ur-PK Urdu – Pakistan 0x0420 URD
Cy-uz-UZ Uzbek (Cyrillic) – Uzbekistan 0x0843  
Lt-uz-UZ Uzbek (Latin) – Uzbekistan 0x0443  
vi-VN Vietnamese – Vietnam 0x042A VIT

Source: https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(vs.71).aspx

Windows 10 – Search Not Working

Hey everyone,

I’ve just upgraded to windows 10, however the start menu search has been randomly breaking. It just seems to load indefinitely. Thankfully there’s an easy fix:

- Start task manager (ctrl + shift + esc)
- Click more details
- Under the processes heading look for Search (green icon under background processes)
- Click on Search and hit end task

The Search process should now restart and start working. If not you can restart it manually using file > run.

Windows 10 search not working

Windows 10 search not working

Repeat a character x times with c#

Hey everyone,

Just a neat little trick I came across on Stackoverflow, repeating a character x times without using a loop:

string result = new String(‘x’, 5); //xxxxx
string result = new String(‘a’, 3); //aaa

Check out the original post for more info: http://stackoverflow.com/a/3754700/522859

Resources for Mocking WCF

Hey everyone,

Just a few links I came across for mocking WCF in case anyone else needs them.

This tutorial was great: http://weblogs.asp.net/cibrax/unit-tests-for-wcf

The only issue being that it was missing a few class definitions (IIncomingWebRequestContext and IOutgoingResponseContext). I got lucky and was able to find full code samples at the following links:

https://code.google.com/p/netfx/source/browse/trunk/Source/ServiceModel/Web/IIncomingWebRequestContext.cs?r=18

http://netfx.googlecode.com/svn-history/r28/trunk/Source/ServiceModel/Web/Wrappers.cs

Just in case these links ever go down:

http://pastebin.com/CjUMwhsG
http://pastebin.com/F1Fj9eRC

How to stop text taking up more than one line – CSS

Hey everyone,

Just a quick post on how to stop text taking up more than one line using only CSS:

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

You can check it out using this fiddle: http://jsfiddle.net/wb5m7/
There’s also a great StackOverflow post: http://stackoverflow.com/a/572302/522859

Refresh a Page with JavaScript

Hey everyone,

Just a quick post on how to force a page refresh with JavaScript (no jQuery required):

location.reload();

Note that the reload function accepts a boolean parameter that can be used for force a server refresh. Alternatively, it just defaults to the cache.

Checkout this Stackoverflow post for more info: http://stackoverflow.com/a/5404869/522859