Subscribe via RSS
26Jun/180

VC Redist (x86 or x64) 2015 vs 2017

I've got a brand new laptop at work and I didn't bother installing archaic versions of Visual Studio. Instead, VS Community 2017 was installed and, as part of it's due dilligence, it installs the prior VC Redistributibles to allow older applications to run. Think of these as dll-hell packages that provide the supporting libraries (glue) that VC++ compiled programs need to interface with the current Windows OS.

Anyway, when trying to install MySQL Workbench I was presented with the following pane:

install-mysql

Sure, I'll install VC 2015 redist, I'm obviously missing it! Oh wait.. I'm not..

install-redist

0x80070666 - Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel. Nice. Another version is actually NOT installed... another 'newer' version is, but it's an entire major version apart! Anyway, let's go see what we have installed...

installed-redist

VC Redist 2017, of course... thanks to VS 12017 itself. What happens if I remove it? Good question... regardless you can re-download the 2017 redistributibles here. I therefore removed the 2017 and then successfully installed 2015!

installed-2015

And the world was a happier place... then again, with MySQL Workbench installed I still couldn't see the database I was expecting... but that's another story.

10Jun/180

China, 2018 – Shanghai and Guangzhou

China Southern had a great deal on return flights to Amsterdam, but the return leg included an inconveniently-timed 10-hour stopover in Guangzhou. Instead of this, I re-routed via Shanghai and decided that an overnight bullet train trip was in order. It's really the only thing that China has done over Japan, the building of high-speed beds! Well.. I lie. I wrote that last sentence prior to going and now that I'm back I'm seriously impressed with the culture, technology and overall livability of China. It was very different to when I was there 15 years ago!

Getting a Tourist Visa

So, Australia ain't on the cool-list. As an Australian, you'll have to fill out the application form and either post it to the consulate or deliver it in person to the application center. I chose the latter and, expecting that I had all the correct information, rocked up without an appointment on a Thursday lunch-time. After a 2.5hr wait, I was told that I needed print-outs of my hotel reservations. I'd totally neglected to read the requirements.

I returned to work and decided to choose some hotels later that night. Once done, I made the smart move and actually booked an appointment. DO THIS! DO NOT VISIT THE CENTER WITHOUT AN APPOINTMENT! With everything on me, I rocked up the following Monday and still had to wait for around 40 minutes. Once called up, all information was accepted and I was handed a receipt with an expected completion date. This was the following Thursday and, upon arrival, I waited in line to receive my passport with its pretty new Visa installed. AUD$109.95 later and I was set!

So, the basic idea is: Book EVERYTHING before you go and apply for a Chinese Visa. The form actually requires you to record where you are each night of your trip, so make sure you have the appropriate evidence per day.

Shanghai

This city is crazy... I stayed right in town at the Raddisson 'Tru Blu' and enjoyed it. The location was great for walking Nanjing Road to the Bund and also for getting a train to the computer area. Unfortunately the markets were really only full of new stuff. The area was pretty cool though with the overhead metro lines and grotty markets/streets. Check this link at Wikia for more information.

DSC 0495 DSC 0497 DSC 0498

I had a friend help me work out cool places to check out trains. We were advised that the station platform at Lianhua Road Station on Subway Line 1.

The line parallels the actual main railway and there are two flat concrete platforms out from the station roof that you can use as viewpoints. Either gives a clear view in one direction and not the other. I was really happy though, there was a good mix of loco-hauled and high-speed trains through in the 30 minutes we hung around.

DSC03611 DSC03613 DSC03625

DSC03612

DSC03615 DSC03627 DSC03640

DSC03630 DSC03634 DSC03636

DSC03642 DSC03644 DSC03657

After this is was shopping, shopping and more shopping. Oh, and eating! Go to Da Dong for the most amazing Peking Duck.

The Overnight Bullet Train

After travelling on the Twilight Express, Kitaguni and Hokutosei... even the XPT in Australia and the Bangkok - Chiangmai Sleeper Train, it was time to ride the 'Deluxe Sleeper' from Shanghai to Guangzhou. This was going to be a 1400km coastal trip (not unlike the Twilight Express) with very convenient departure and arrival times.

This service only runs on Fridays, Saturdays, Sundays and Mondays, so make sure to plan your trip around the timetable. It seems that there's no demand mid-week and therefore does not run. Here's a recent Friday timetable.

DSC 0500

DSC 0501 DSC 0502 DSC 0503

The trains and stations were enormous and astonishing (that first photo above is from the mezzanine in the waiting area of Shanghai Hongqiao.) Just the sheer scale made them impressive. I must admit that the passengers were also very well behaved, when compared with normal public interactions. Everything felt a lot more like an airport than a train station. Most stations also had 16-or-more platforms with trains heading in numerous directions. Unfortunately, the waiting area was above the platforms and you only got to see the trains when you were called to board.

DSC 0507 DSC 0506 DSC 0509

The consists were clean and tidy. It was funny looking at each of the models and thinking like I'd seen them before. Some were kawasaki-styled, others siemens-styled. Either way they all (well, except the very latest with its red livery) had the same white/black/blue colour schemes. Train after train departed and arrived at Shanghai and it was amazing to watch.

DSC 0505 DSC 0520 DSC 0518

The cabins themselves were very similar to those of both Thailand and Japan. Everything was very shiny and new, but the tech wasn't overly 'premium'. The beds were already down and made, although it was already 2030.

DSC 0534 DSC 0526 DSC 0535 DSC 0537 DSC 0538

Each bed had a TV, reading light, control panel and ample bedding. It was all looking very comfortable, except for the couch, which was a little hard and facing backwards... but that was luck of the draw as even-numbered cabins would've had the couch facing the other way. Anyway, it was dinner time...

DSC 0515

DSC 0512 DSC 0513 DSC 0514

DSC 0516

The buffet car was next door and felt comfortable enough. It actually reminded me of my KTMB trip from Butterworth to KL. Nice and clean, boxes of stock piled high, very spartan outfit but functional and a simple menu. All items were 'bento' style and re-heated in the industrial-strength microwave. I chose the fish and suffered through a lot of tiny bones; still delicious!

DSC 0529 DSC 0531 DSC 0532 DSC 0527 DSC 0522

Back to the cabin via the cute decor... there's a temperature control next to the door to make sure you have a comfortable sleep... although the upper berth may receive the majority of the aircon. Note that cabin number one (and the other end, I think 10? or 12?) are right next to the toilet. They're airplane toilets as well... so thanks to thin walls you can feel when people flush next to you.

The trip was fantastically timed and really easy. There was only one really major fault that I believe I may still be suffering from. The pressurisation of the carriages wasn't working. You could tell as soon as we were entering a tunnel as your ears would start to pop. And I don't mean just once... I mean about 5 times on entry and twice on exit of each tunnel. Worse when there was an opposing train! Even when lying down and sleeping I was awoken to aching eardrums once or twice.

Guangzhou

We arrived into Guangzhou at 7am on a Tuesday and dumped my bags at the hotel. I ended up staying at the Royal Mediterranean Hotel in the Gang Ding area of Guangzhou... nice and close to all of the IT markets! It was too early to go shopping, so we ventured for the Canton Tower. This had an awesome observatory with a freakin' ferris wheel on the top!

Anyway... the days were mainly spent scouring through IT markets... but, of course, the effort was put in to ask the community where a good photography point would be. Turns out this one was a bit dicey. My friend was a local and declared that we could enter the area... but I was a little wary. We ended up taking Didi (Chinese Uber) and then riding the rental bikes to a rural area.

This area was known as the Xinshi Residential Area, or so I think? The maps are a little hard to work out. Either way, it was a side-road to a depot for track machines.

DSC03659

DSC03660 DSC03662 DSC03663

DSC03831 DSC03832 DSC03834

So.. yeah... after checking out the wagons, we *ahem* 'navigated' a fence and were presented with a fantastic line-side opportunity. Here's the northern view...

DSC03667

And then the southern view...

DSC03669

From here it was train-after-train-after-train. Seeing the signals helped a lot too. And this time there was freight! No high-speed though.

DSC03673

DSC03671 DSC03674 DSC03678

Lots of passenger consists... going to (or coming from) some very far reaching places!

DSC03682

Ahhhh... diesel freight... nothing better...

DSC03684

The passenger consists were actually seriously long. Turns out there was a bit of congestion too.

DSC03694

DSC03689 DSC03698 DSC03699

DSC03712 DSC03701 DSC03702

DSC03713

DSC03721

DSC03727

DSC03731 DSC03740 DSC03744

DSC03750

DSC03759 DSC03763 DSC03768

DSC03770

And then a final freight...

DSC03804

DSC03811 DSC03814 DSC03816

DSC03820

And finally... a puppy in a box...

DSC03828

...he wasn't a happy camper.

China Southern

One final note.. China Southern is a fantastic airline. Three of the four legs of the trip to Amsterdam were on seemingly-brand-new Airbus A330s and the staff and food were fantastic. The leg from Amsterdam to Shanghai was actually operated by KLM, so that was also a nice surprise.

DSC 0566

The final surprise was having the pilot draw a ring around the word 'Guangzhou' on the map as we departed for Melbourne. Things were amiss when we started heading west... I nearly thought I was in for another European holiday. We then veered south and I assumed we were to loop back and land in Guangzhou. But then as we swung around, out to the east was the most amazing storm-cell, smashing lighting in every direction. Fortunately this was well away from us and was exactly what the pilot was trying to avoid!

8Jun/180

Arduino – How to save power (and control 5v+)

For the first time ever, I get to play with Arduino at work! We're doing a little bit of work on tracking and the goal is to acquire as much data as possible and report it to a webserver. Therefore I've got sensors, GPS and GSM. As one can imagine, this consumes a lot of power, and as one can also imagine: the goal will be to obtain as long of battery life as possible.

Each of the modules requires either 3.3v or 5v and these are usually hardwired into the power supply. They also require anywhere from 50mA to 2A (GSM when sending data or searching for signals) and therefore can't be controlled directly from pins on the Arduino. Due to this I'll explain a proper mechanism to switch their power supplies on and off. Also, we'll then want to dig into power saving on the Arduino itself, so stick around.

Controlling modules from Arduino digital pins

Digital pins on the Arduino are only good for 30mA maximum. In fact, you shouldn't even be going anywhere near this. Hence, using one to provide +5v or GND to a module will cause that module's current needs to flow through the pin. For example, the GPS module I bought from Jaycar needs anywhere from 0-70mA. Although low, this is still too high for a digital pin.

The goal therefore is to use an electronic switch. You might be thinking 'relay', but you'll also need to note that they require current which can peak above the digital pin tolerance! You'll find that relay modules don't connect the relay actuator to the input.

arduino-5v-control

The answer here is to use a transistor to allow current to flow to your modules. Depending on your current requirement, I can either recommend a 2N2222 (for anything up to 600mA) or a TIP31 (good for 3A.) I also want to switch my GSM module, and that needs 2A, so I bought a handful of TIP31s.

Using them is very straight-forward. Connect your VCCs up to whatever power source is needed and embed the transistors in the ground path. From here, switching the digital pin high will let current flow and complete the circuit for the module. Make sure you set your digital pinMode to OUTPUT.

Ideas for saving power via code

The basic idea is to put the Arduino to sleep whenever there's nothing to do. My device only needed to report every 15 minutes, so in the meantime I tried to make it snooze. It turns out that, based on internal timers and interrupts, you can only get a maximum of 8 seconds power down out-of-the-box. This wasn't quite the 15 minutes I was looking for, but numerous sources online said to just keep putting the unit to sleep for 8 seconds over-and-over.

There's some great reading here by Nick Gammon on power saving. Anything from lower frequencies to shutting down certain parts of your project. You'll also find a blog post here at the Arduino Playground describing other options. Just make sure you read that entire second article as other contributors have made corrections or other important points. Tis great to see the community involved.

...I'll come back to power saving once the project gets started up again. The proof-of-concept worked and now we need to convince the powers-that-be to let us continue.

Filed under: Arduino No Comments
7Jun/180

Arduino – Don’t buy the SIM900A for Australia!

tl;dr = This is a 2G-only device. There's only one network left, which shuts down on the 30th of June, 2018!

...but I needed a connection for work and I bought this unit from a seller on eBay without researching... so... compounding the error, I then also bought a SIM card for the network that'll still work: Vodafone. Thanks to Happymacer on Instructables who posted an article discussing how to use this device in Oz!

Note that I'd previously tried to use both Optus and Telstra SIM cards and got the following output when running the COPS command.

AT+COPS=?
+COPS: (3,"VODAFONE","voda AU","50503"),,(0-4),(0-2)
OK

Yey! Vodafone! But I'm on Telstra/Optus? So I can see a Vodafone tower, but it's prepended with 3 which actually means I'm not allowed to use it. Sorta makes sense as Optus and Telstra switched off their 2G networks ages ago and Vodafone must have decided that lingering devices on other companies' plans aren't allowed to use their towers.

I bought a Vodafone SIM and ran the commands again...

AT+COPS=?
+COPS: (2,"VODAFONE","voda AU","50503"),,(0-4),(0-2)
OK

Woweee! It's there. 2 means Roaming... which is a little weird, but it must be trying to hint to my device that 2G isn't the best method and that there should be a 3G tower around somewhere. Of course, even if there was, we couldn't connect to it. So I forced the connection with the following command...

AT+COPS=1,2,"50503"
+CREG: 2
+CREG: 1
OK

Those CREGs afterwards were output because I had previously run AT+CREG=1. This command tells the device to report any changes to the carrier connection. What you can see is it connecting to the tower in roaming mode (aka 2) and then connecting correctly in local mode (aka 1.) We're on!

Testing SMS

If you wanna test an SMS, then you can do so pretty easily. Rig up a SoftwareSerial example in Arduino and make sure you can send commands to the SIM900A via the Serial Monitor. From here, you can use the following script to send an SMS.

AT+CMGF=1
OK
AT+CMGS="+61xxxxxxxxx"
>

Note above ... you'll get the > prompt to enter the message. Once you're done, the unit requires a CTRL-Z control character to realise it's the end of the message. To do this, you'll need to open your favourite text editor, type ALT+026 (hold down ALT and type 0 then 2 then 6) and then copy the resulting character. It will be a black SUB if you use Notepad++. Now paste this into the text entry field in the Serial Monitor and hit enter.

Sending Data

From here, Jens Christoffersen at All About Circuits has helped us greatly with his article: Using a SIM900A to Send Sensor Data to a Website. Scroll down far enough and you'll find his code to send data to a server. He uses printf statements, as he's using a PIC and talking direct to the serial port... we'll have to use SoftwareSerial and print(ln).

AT+CGATT=1
OK
AT+SAPBR=1,1
OK
AT+SAPBR=2,1
+SAPBR: 1,1,"100.84.75.204"
OK
AT+HTTPINIT
OK
AT+HTTPPARA="URL","http://www.website.com/index.php?data1=1&data2=4"
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPACTION=0
OK
+HTTPACTION: 0,200,0
AT+HTTPTERM
OK

Above is an example chat with the unit to send data. Paste each AT line into the Serial Monitor first to make sure you get the expected responses. The URL above is rubbish, so put one in that'll work properly instead. The 200 in the HTTPACTION response is the happy HTTP code.

Filed under: Arduino No Comments
1Jun/180

Germany, 2018 – Kassel and Leer

Thanks to hiring a car and touring Germany, I was able to visit some cool places like Miniatur Wunderland! Smashing the rental Jaguar XF on the autobahn was also fun... I was actually a little disappointed that the diesel didn't want to push much faster than 220km/h. The tour also took us on some back-roads as there were bridgeworks east of Bochum.

DSC02994

I can't even tell you where the above photo was taken as I was too busy negotiating bumper-to-bumper traffic on tiny country roads... but a freight passed a few seconds before and I was hoping to catch another.

Kassel

The first night of the roadtrip was spent in Kassel. We hadn't booked in advance, so I chose the hotel closest to the station. This turned out to be a Best Western housed in a beautifully historical building. I assume it was actually once just the Hotel Kurfurst Wilhelm I?

DSC03007

It didn't have a railway view, but the station was right next door. We also didn't get much sunlight, but I managed to snap a military train the night we arrived!?

DSC03000

The next morning saw one freighter.. I got up and had breakfast as early as I could to then spend time down on the platform. The station is huge and has a tram interchange in the forecourt. The trams also take you right down into town. For some reason I didn't even take a photo of them!?

DSC03010

DSC03011 DSC03015 DSC03016

Leer

This was a very happy and random fluke. Turns out Leer (Ostfriesl) is on the mainline between a car plant and Emden Port and so there is a constant stream of traffic. Once again, we stayed in the hotel right next to the station, known as Hotel Frisia, which seemed to be very popular with the military.

DSC03147

The station itself probably has a lot of stories to tell. One of them might be that it's sick of looking at that weird yellow rocket on the round-a-bout out front.

DSC03146

So, where was I? Oh yes... the trains. As mentioned, there's a lot of freight traffic involving the transportation of new automobiles to the port in Emden. This comes from both directions, with the northbound trains turning on a siding just north of the station. You also get a lot of passenger trains. There's the Westfalen Bahn and the standard Deutsche Bahn. The former runs off to regional areas and the main company runs everything from long expresses to a Norddeich Mole which actually uses Leer as a turn-around station.

DSC03017 DSC03018 DSC03019

DSC03044 DSC03046 DSC03051

The Westfalen Bahn runs very regularly with 3-car EMUs. They're quite recent and in great condition. The colour scheme is also a nice change from the standard red of DB.

DSC03101

DSC03149 DSC03020 DSC03035

The Norddeich Mole runs from Norddeich via Emden through Leer to Hanover. It usually pulls into the third platform to keep the mainline free for all the other ICEs and freighters.

DSC03106 DSC03110 DSC03156

But then, sometimes another passenger train is on three and the Norddeich was on 2. Slightly confusing, but nobody seemed to miss their trains.

DSC03339 DSC03344 DSC03353

There's also an hourly ICE through to Stuttgart. But enough with the people carriers...

DSC03113 DSC03115 DSC03117

DSC03120

Turns out DB has their own Doctor Yellow and it, at this point in time, was diesel-powered and went for an excursion. It had actually been stored in a siding just north-west of the platforms.

DSC03053 DSC03060 DSC03066

DSC03063

From here, we'll talk freight. There were a lot of light engine moves and the drivers were in no mood to hang around. The engines happily went track-speed when they could. There were also a few loco shuffles.

DSC03141

Yeah... I know... you can hardly see there are two locos... you'll just have to trust me. Anyway, back to the actual freighters... from Platform one, if you look left (north), you'll see a branch that heads off right (east). the line heads off to Oldenburg and a lot of freight use Leer to get onto it.

DSC03086 DSC03089 DSC03092

DSC03096

For example, the above tanker consist had to snake its way across to the southbound rails, but proceeded south. The next snake didn't.

DSC03158 DSC03162 DSC03165

DSC03169

This train made it south of the station and into the yard. It then ran around and crossed back onto the northern line before continuing.

DSC03184 DSC03186 DSC03196

DSC03192

Finally, the fun part: the auto-carriers...

DSC03323 DSC03325 DSC03329

DSC03214 DSC03225 DSC03228

Both Volkswagen and Audi passed through the station... I still haven't quite worked out where their factories are. Numerous cargo companies were used to pull the services.

DSC03207

DSC03318

DSC03075

Meanwhile, the station has an amazing restaurant/cafe in it. Great pastries and breads... and coffee!

DSC03277

And here's a video of the view whilst I was sipping coffee.

And here's another freighter.

DSC03122 DSC03124 DSC03131

DSC03135

Oh! And a little diesel came through with parts of a wind turbine?

DSC03247 DSC03254 DSC03263

DSC03262

Finally... don't forget your snacks...

DSC03335

It's amazing seeing this much action in one place.

Filed under: INTL No Comments