Wednesday, October 12, 2016

Scratch 2.0 using Chromium on Raspberry Pi 3


Playing with Scratch and thought now that Chromium is the default browser in Raspbian Pixel whether the web based Scratch would work.

So, I went to http://scratch.mit.edu and picked a project to load. Up came the usual jigsaw piece saying a plug in was missing.  Right clicked to enable the plug in and nothing happened.  Oh, well nothing has changed.  We still have NuScratch installed on the Pi.

Before shutting down I did an update/upgrade, just to keep the machine up to date.
A whole bunch of updates for LibreOffice and NuScratch were downloaded as well as an update to Chromium.  Nothing looked too interested.

Then a strange thing happened.  Half way through the upgrade a screen appears asking me to confirm installing the Flash plugin.  I accepted and let the upgrade take it's course.

Intrigued by this I went back to the Scratch website and selected the project again.
Again, the jigsaw piece appeared.
Again, I selected to enable the plugin.
Except this time the outcome was different.  The panel went white and the familiar Scratch loading bar appeared.  It was working and working well.

See the video below.



Mike Horne did a post on his website  this and Simon Long who does Raspbian and specifically Pixel 



Looks like Chromium had an update on the 11th and by chance I did an update to my machine soon after the release.  From Simon's post this needs ARMv7 so  only works on Raspberry Pi 2 and 3. Not an option for older Raspberry Pi or the PiZero.


Wednesday, October 5, 2016

NexDock thoughts on using with Raspberry Pi


Earlier this year I backed the NexDock Indiegogo.  The NexDock was primarily being promoted as a Windows Phone accessory as it supports Continuum, but since it has a miniHDMI some of us thought it might be a great partner for the Raspberry Pi.

It took them 2 attempts to get funded but made it in the end.
Then they had a fire at the factory which set the project back even further.






All respect to the NexDock team, instead of throwing in the towel they rallied and with their ODM partner picked up the pieces, had new NexDock manufactured and in the end I took delivery on the 9th of September and have been using the NexDock a fair bit since.




Power, we have power. Oh!, maybe not

My life with a NexDock didn't start too well when I noticed it wasn't charging.
The charger did look a bit ropey but thought since it passed QA at the factory it must have been OK.

Not the cleanest. Should still be OK, right

A bit of dirt never hurt anyone

I'm sure it's fine

Checked the power supply with a multimeter and it was dead.
I submitted a Help Desk request on the support site and NexDock replied quickly that this shouldn't have happened and they were very sorry.  Advising it would take a while to send me a replacement power supply so as an alternative if I was OK with it they would refund me $15 as that is the equivalent cost of a PSU on Amazon.  Les Pounder who has blogged his experience here (http://bigl.es/nexdock-initial-impressions/) decided the US power supply with an adapter was not for him and he bought a suitable supply with 3.2A from CPC (http://cpc.farnell.com/stontronics/t5004st/ac-dc-power-supply-5v-3-2a-universal/dp/PW03046)

I still have to get a replacement power supply so in the short term I used a microUSB adapter board with the original cable to make a solution that would allow me to use any of the many microUSB chargers I have due to my Raspberry Pi addiction.

Functional, but maybe not a long term solution

This is what I have been using with the NexDock and it's served me well.  The green light you can see is the power LED.  Orange when charging and Green when fully charged.

Teething problems out of the way. What is the NexDock like to use.

Keyboard and Trackpad

The keyboard is a decent size.  The travel on the keys is comfortable.
One irritation for me is the power button is where the [delete] key should be and the [delete] key has been placed below the [backspace] . So, when I make a mistake and blindly stab at [delete] I'm pressing [power] and no delete happens.  Luckily the power button has to be held down for the usual 5 seconds to turn off the NexDock.  What it did mean is for a while I kept thinking the keyboard unpaired from the Pi and so I went into the menu, disconnected and reconnect the NexDock. 
Once I figured out it was user error all was good.  Still, funky placement of keys is becoming an ongoing annoyance on laptops as manufacturers pick different places for keys.
Oh, and the keyboard layout is US.  I'm in the UK.  I can live with it as I am comfortable using different keyboard layouts, just something to be aware of.

You can see the keyboard layout here


The trackpad works well once you up the speed of the  'mouse' on the Raspberry Pi.  No idea why this is needed but it does work.

It's important to note the keyboard and trackpad are Bluetooth and not USB.  So, for Pi users this works well for the Pi3, but not the Pi2 or PiZero as they do not have Bluetooth.  More on this later.

Screen

The screen, even though LCD and not IPS is sharp and works well for extended use.  The resolution is the classic 1366x768.  Fairly standard for laptops, but not a mode the Pi has automatically. (http://elinux.org/RPiconfig#Video_mode_options).  Not a problem if auto selected from HDMI, but as noted below can cause some fun when working with realVNC.

First boot with Pi3 powered from NexDock

Bluetooth and power 

As mentioned above the keyboard and trackpad are Bluetooth.  They are not available over USB.
With the Pi3 the NexDock is found when scanning and once paired works well.

You can't back power the Pi3 through USB so it has to be powered from the microUSB power connection.  This means when powering the Pi3 from the NexDock the USB devices built-in (webcam, microphone, microSD slot and USB port on the right) to the NexDock are not available.  The USB port on the left that provides  power is also the hub connection port.
On the Pimoroni Bilge Tank they had a a frankin-cable that does power the Pi3 and connect USB so all devices are available.


Also, Mike Redrobe did the diagram below showing the connections. 

Connections on NexDock

Personally, I haven't needed the webcam or other devices so it hasn't been a problem for me so far.
I just use the USB ports on the Pi3 to connect my devices.

We know that the PiZero can be back powered through  USB so this looked like it could be ideal, except the keyboard and trackpad are Bluetooth.
I connected a PiZero and powered it from the NexDock. Then connected a Bluetooth dongle bought on eBay to the port on the right.


All booted, Bluetooth dongle seen, paired with NexDock. Working great, then Bluetooth device disappears. Icon in top bar grayed out.  As an eBay purchase I suspected it might be faulty so used on a couple of PCs and plugged directly into a USB port on a Pi2 with the NexDock and all worked well.

My conclusion is that even though there is a nice big battery inside the NexDock the USB port on the right is not a powered port and so doesn't have enough power to support the Bluetooth Dongle.  It works great for an external mouse and other lower power devices, but this Bluetooth dongle seems to need more power than the port can handle.

Continuing my adventure with the PiZero I used a Zero4U USB hub bought at Cambridge Raspberry Jam from Ryanteck.



This attaches directly to the PiZero taking it's power from the 5V line directly to give a powered hub.
With this and again back powering the PiZero from the NexDock the Bluetooth dongle worked great.
Now I have a PiZero computer with keyboard/trackpad, webcam, microphone, speakers, 3.5MM headphone jack, another USB port and a microSD slot.

One thing to note on Bluetooth with the Raspberry Pi is that in Raspbian Bluetooth is not set up to auto pair with devices on boot up, so for first set up you need an external mouse to pair the NexDock and the Pi.
NexDock address this on their support page and give instruction on how to set up a cronjob to enable the pairing each time your Raspberry Pi starts up.
The support page also explains how to get the internal speakers working and a couple of other things.

The longest time the NexDock was running was at the Cambridge Jam in September which runs from 10:30am to 4:30pm.   The NexDock was set up with a Pi3 powered externally so the USB from the Pi3 was connected to the NexDock to enable the webcam.  It was running Scratch Pac Man and a simple webcam viewer python program showing the person using the computer their image. Code on GitHub


Battery test

The last thing is the battery in the NexDock.  It's a 10,000mA battery, so a decent size.

Powering a Pi3 idle it lasted ~6 hours and powering a Pi3 under load it lasted 3 1/2 hours..

These were the times I expected using back of an envelope calculations.

To run these tests I ran sysbench in one terminal window and in a second window ran a small python script that recorded to start time and every 60 seconds recorded the time.
The Pi3/NexDock ran until it shut down. Then starting the Pi3 again it was just a matter of subtracting one time from the other.


Other findings

I mentioned above about connecting over realVNC.  Using the Pi3 on a NexDock as the client and then realVNC running on a PiZero as the server. realVNC by default sets the screen resolution to 640x480 and this function, but as you'd expect a bit painful to do anything constructive.
You can change the Pi resolution by modifying the config.txt file in /boot.
Problem is there is no 1366x768 resolution option, meaning full native NexDock resolution wasn't possible. I could do 1360x768(mode 39) and this worked but it did leave a few unused pixels either side of the screen. Not a massive thing, just worth noting.

I also tried to enable the experimental OpenGL drivers and this failed completely.  Black screen.  No flashing cursor, no scrolling of the messages at start up (pre Raspbian PIXEL)
To be fair to the NexDock I have the same problem with the pi-topCEED, so it might be something to do with the default non-standard (to the Pi) resolution.

So, it looks like the experimental OpenGL drivers are not compatible with the NexDock display.  Pity as this could have been fun for Minetest, the Minecraft-a-like open source game that is in the repo so can be installed with apt-get install minetest.
It's not the latest version, but it plays great on a Pi3 with OpenGL enabled and 256MB set aside for the GPU.  NOTE: Minetest makes the SOC run hot. If you are going to play Minetest on the Pi2/3 then you will need a fan. I have a heatsink on a Pi3 and that's not enough. Previous blog post about Minetest on the Pi3

Also on Minetest, if you are walking/flying around and you use the trackpad to change direction you stop moving. I don't know if this is a Bluetooth keyboard/trackpad combo thing or if this is NexDock specific.  Either way it means on the NexDock you can play Minecraft, but if you want to change direction while moving you have to release the forward/backward key and press it again

Conclusions and wish list

With everything above I do like the NexDock.  It feels nice to use. The keyboard and trackpad work well.  For it's intended use with Windows Phone I expect it is a perfect match.  With the Raspberry Pi the needs are a bit different but it does provide what I need to use it regularly.

With that said for me it would go from being great to amazing as a Raspberry Pi device if:

  • Left side had 2 USB ports. One capable of providing power and USB connection, second one USB connection at standard power rating.
  • Keyboard/trackpad with the option to connect as Bluetooth or USB
  • 2 USB ports on the right.
  • Powered internal USB hub meaning the 2 (wish list) USB ports on the right would be able to handle devices that need power like the Bluetooth dongle and external hard drives.
  • UK Power supply instead of US with adapter
  • UK keyboard layout option

I see myself using the NexDock as my primary Pi device and will over time be doing the expected nerd/geek activity of covering it in stickers which to me is a real sign of a keeper that you expect to have part of your life for a good while to come.