Repeated iPad Activation Requests

July 30, 2017 at 2:54 pm (computers) (, , , , )

I had a recent problem with an iPad.  It was asking to be activated, yet when you walk through the menus, it wouldn’t connect to the Apple servers and activate, it would only get kicked back into action when connected to a PC running iTunes.

Once activated, all was fine – Internet fine, browsing and apps, fine – apart from iTunes itself.  For some reason it was never able to get in touch with the App Store from the iPad itself.  After a while, it would then get stuck back in the ‘your iPad requires activation’ loop.  This could take a few hours or it might be after a day.

Typical error messages included: “activation error”, “ipad could not contact activation server”, “ipad could not connect to iTunes”.

The one that usually came up once trying to activate the device manually was “Your iPad could not be activated because the activation server is temporarily unavailable. Try connecting your iPad to iTunes to activate it, or try again in a couple of minutes”.

The Internet has various reasons for this – the server really is unavailable, your Internet connection isn’t working, and in some cases there was a report of activation problems after an iOS update.  There are various suggested solutions too – reboot, connect using a PC (which solves it in my case but only temporarily), remove the account from your iPad and add it back in, or even factory reset and restore from backup.  Nothing worked for me.

As I was contemplating a factory reset, I noticed that the clock on the iPad was out.  For some reason automatic updating of the clock from the Internet was turned off and the iPad was a hour out compared to the actual time.  Once the time synchronisation was turned back on and the clock updated, it all worked again.

I know that many cryptographic protocols can be time sensitive – if the clocks are out by too much between the two devices trying to communicate securely then the connection can not be established.  This is a problem I had with a Windows machine once – when the clock out of sync it wouldn’t ever update.  Looks like the same was probably happening here.

So if you are having odd activation errors on your i-device that keep reoccurring, check your clock settings and make sure it is telling the right time and in the right time zone.  This isn’t something I’ve seen mentioned anywhere in response to activation problems.

Kevin.

 

Advertisements

Permalink 2 Comments

Creating a wireless Pi-LITE from a XinoRF and LoLShield

January 2, 2017 at 11:22 pm (computers) (, , , , )

I have a few of the neat 868MHz radio modules from, what I still think of as, Nottingham based Ciseco (who became WirelessThings, who got acquired and then unfortunately ceased to be).  These are really simple serial-to-sub GHz radio modules that were available in a range of form factors based around their SRF module.  I particularly liked the RasWIK kit, which made a wireless link between a Raspberry Pi and their Arduino-based XinoRF board absolutely trivial using their Slice of Radio daughter card for the original RPi.  It came with components and tutorials to get you started with simple wireless I/O.  I also supported their kickstarter for the very easy to use SRF Shield for the Arduino and before that for the Pi-LITE.

You can still find some documentation for their modules on GitHub, under Ciseco and later WirelessThings, but most of the information about their modules seems to have disappeared with the company.  It isn’t even in Google’s cache anymore and archive.org didn’t mirror the site due to their robots.txt configuration.

If you are interesting in sharing what you do know about the modules, then there is an OpenPI Google Group where people have come together to share what information they have about the Open PI product aimed at simple wireless sensor applications.  I’ve also managed to track down as much as I can myself from the far-flung corners of the Internet, so I’m still able to tinker with their modules.

One product that was fun to use was the Pi-LITE, a Raspberry Pi GPIO board (for the original Pi) that had an on-board Arduino controlling a matrix of 126 LEDs.  It even made TheRegister.  It is basically an implementation of Jimmie P Rogers LoLShield for Raspberry Pi.  They also provided a LoLShield themselves for the Arduino alongside a version of the original LolShield library.

The Pi-LITE has a simple serial-port interface that displays anything you type as scrolling text on the LEDs. You can also send commands to set pixels as required.  You can run the Pi-LITE code on an Arduino with a LoLShield and poke it via the serial port, so I wanted to see if I could combine it with a XinoRF and get a wireless link running to it.

2017-01-02 18.40.54.jpg

The XinoRF is basically Ciseco’s Arduino Uno clone with a built-in SRF radio module.  This means that if you enable the radio (by setting D8 HIGH) then anything sent over the serial port automatically gets sent over the SRF radio too.  So if you have another SRF radio at the other end, e.g. the Slice of Radio module for the Raspberry Pi, or the SRF Stick USB for a PC, then you should be able to send commands to the Pi-LITE too.  But there are a few problems getting to this point, due mainly to the unavailability of the Ciseco documentation now, and due to the fact that the original LoLShield, on which the Ciseco board is based, is hosted on a site that Google tells you is hosting malware.  So information was a little hard to come by!

Issues:

  • The USB SRF Stick apparently has a driver, yet any site still selling them links back to the original Ciseco site, which is no more.  Solution: turns out Windows 10 is quite happy with recognising the CC1110 USB interface supported by the SRF Stick as a serial port.  If this had failed, I was going to try to find a copy of usb_cdc_driver_cc1111.inf, which seems to be all the actual “driver” really consists of.  I betting on this being a generic TI CC1110 device driver or something and google does return a few of them kicking around … your mileage may vary on this one – as I say, I didn’t need it!
  • A key tool for talking to and configuring the SRF Stick, or in fact any SRF based radio, is the XRF Configuration Manager tool from Ciseco.  Again, their site is no more, and whilst the XCM source is available on GitHub, the tool itself is not.  S0lution: As luck would have it, at the time of writing, there is still a live download link on the original ciseco site for this, see: http://www.ciseco.co.uk/downloads/XCM/install.htm
  • The XinoRF uses the UART and D8 to control the radio.  What is the LoLShield using and will they clash?  It is hard to find out as all implementations of this shield from Ciseco, Adafruit and others all refer to the original apparently-malware-ridden site.  Solution: using a web2pdf converter, I was able to read the original design documentation and schematic and found that yes, the LoLShield using Charlieplexing for the LEDs, does use all digital pins apart from 0 and 1 (the UART) so there is a clash with D8.

lol_shield_schematic.png

  • Is there an alternative to using D8 to control the radio on the XinoRF?  Well there is very little that I’ve been able to find about the SRF configuration and XinoRF, but there was an obscure reference in an index file of an archive site that captured snippets of a bit of discussion about this from the original openmicros.org forums:

“Pin 8 conflict – OpenMicros.org
Hi It s possible to move the radio enable pin from pin 8 to another pin youll need a soldering iron Looking at mine I think it s the RF EN pad I cant find mention of it in the docs and I m not familiar with how Matt do you know what the procedure is Hi On our shop advert is the link to the schematic hope this helps.  Hi Does that imply that the XinoRF won t work with your LED Matrix Shield I went through the docs for the shield before ordering one today and there it said Arduino R3 and Xino but looking at the rest of the docs it seems pin 8 would be required for it as well Does the documentation refer to an older Xino model then.  The LED Matrix docs will be talking about the Xino Basic not the XinoRF You can modify the XinoRF s radio enable pin to use something other that pin 8 Just to the left of the ATMega chip are two gold pads under the RF EN label Between the pads is a very small trace cut this with a Stanley blade use a continuity meter to check that there is no connection between the pads Solder a length of wire to the”

I doesn’t complete the sentence however.  The XinoRF schematic shows this RF-EN tag, which connects D8 from the Atmega328 to the SRF module via a resistor:

io8_iso-io8

And this can clearly be seen on the board:

2017-01-02 18.41.50.jpg

Solution: break the link between the tag as hinted in the forum post and solder a link wire to the left hand side (SRF-side) to connect to a stray +5v source on the board somewhere else (e.g. the IOREF pin or +5v from the ICSP header).  This will enable the radio by default.  Even though the SRF is a 3.3v module, the tags are on the 5v logic Atmega side (and from what I’ve read, the CC1110 has “5v tolerant” I/O pins even though it uses 3v power?  Not totally sure about that and haven’t dug out the data sheet to check, as it doesn’t seem necessary in this case anyway as in use, the tags can be measured as +5v regardless).

2017-01-02 21.18.15.jpg

At this point, downloading the Pi-LITE Arduino sketch to the XinoRF and plugging in the LoLShield is all that is required to get a wireless Pi-LITE.  To test, I used the serial monitor from the Arduino IDE to show what the XinoRF is doing directly using serial-over-USB, and I used the XCM serial monitor via the SRF Stick to show the same is happening over the wireless serial link.

Attached is a copy of the Pi-LITE users guide (B040 PiLite User Guide.pdf).  I’ve collected a number of documents about the Ciseco radio products, from cached or archived versions of their pages or from old ‘saved webpages’.  Hopefully some of this information will resurface over time.  It would be a shame to lose it.

Kevin

 

Permalink Leave a Comment

Updating Windows Update when Windows Update Won’t Update

December 21, 2016 at 9:39 pm (computers) (, , , , )

I’ve recently picked up a reconditioned Acer Iconia W510 Windows 8 Tablet PC with a docking keyboard, and to be honest, I actually quite like it.  But it is proving a bit of a trial to get going.

First, I found that it wouldn’t activate or start updating at all.  No matter what I did, it wasn’t happy.  Reading that Windows 8 is no longer supported, and I’d have to update to Windows 8.1, I looked for it in the Windows store.  But it won’t install from there without a pile of recent updates being installed first, but updates were having problems too.  Worried that I might have to reinstall from installation media, I set about looking for the Windows Product Code, but it was nowhere to be found.  Nothing on the box, nothing on the device, nothing with the installation and recovery media.

It turns out that many modern devices just come with a Windows Product Key in the BIOS itself.  There isn’t an obvious way through the standard Windows interface to find out what it is either. It might be in the BIOS, I don’t know I didn’t get that far.  This simple utility from nirsoft will dig out any product keys on a running system and tell you what they are.

Before all the pain of a reinstall though, I wondered if Windows Update might kick the activation off, so tried that a last time.  But that was still failing consistently with error 80072F8F.  Apparently you might get this if your PC clock is too far out of sync with Microsoft’s update servers.  Sure enough, even though the time and date were correct, the year was 2012 not 2016.  Fixing that kicked off both activation and updates, so all was looking good.

Sure enough, post first bought of updates I could now install Windows 8.1 from the Windows Store, which went through successfully.  I did wonder about skipping ahead to Windows 10, but Microsoft now want around £90 for the upgrade, which is a bit mad on a device like this.

At this point though, I soon hit another problem.  Windows Updates kept stalling permanently “checking for updates”.  There isn’t a clear “this is how you fix this” on the Internet, but the general Wisdom seems to be that there is an issue with high CPU usage and hangs of the Windows Update service on Windows 8.1 that needs the Windows Update service components themselves to be updated.

So, in short I tried all the following to no avail:

  1. Just leaving it running.  Some people suggest it might perk up after 20 hours.  Some say leave it 24 hours.  I left it running for around 30 hours (after realising I needed to change the power settings to stop the device auto sleeping after 10 minutes) and still nothing.
  2. Resetting Windows updates by stopping bits, wuauserv, cruptsvr; renaming the c:\windows\SoftwareDistribution directory; running the Troubleshooter to Troubleshoot issues with Windows Updates; then rebooting.  No effect.
  3. Tried booting into safe mode to see if that helps.  Note to self: Before trying Safe Mode for a Windows tablet, check that the docked keyboard and touch screen will still function when in Safe Mode.  For the Acer, they only way to interact with it was via an external USB keyboard (using the micro-USB socket too)!! Doh!
  4. I found that KB3102812 claims to fix it, but this relies on installing KB2919355 which itself seems to rely on KB2919442.  Downloading and running these separately invokes the wusa.exe executable, but this too hangs on the “searching the PC for updates” stage.  I left one of these going for around 6 hours.
  5. During the course of my travels I also stumbled across KB2950153, which describes a problem with wusa.exe freezing, but once again trying to install this isn’t trivial without wusa.exe which itself still hangs.  At this point I was running the Performance Monitor to spot disk activity and sure enough you can see the svchost hosting the Windows Update service trawl through the SoftwareDistribution area, updating logs, caches, db files and so on – but eventually all disk activity just stops and the check is still not complete.
  6. Next on the hitlist was finding a way to install an update manually without relying on the Windows Update GUI or wusa.exe.  One promising avenue is the PSWindowsUpdate module for PowerShell.  This gives  fairly comprehensive access to Windows Update from PowerShell.  Following the instructions here, but using the Get-WUInstall -Verbose command to see what is actually going on, this never seemed to get past the “Trying to connect to Windows Update Server” stage (I tried with both -WindowsUpdate and -MicrosoftUpdate options).

Finally, before seriously considering a reinstall, I looked up any other way possible to install a Windows update without needing wusa.exe.  Eventually I found this site which shows how you can expand a .msu file and use Pkgmgr to install the .cab file directly.  Now this is not without its risks – this is bypassing all the good configuration and dependency management that the Windows Update service does behind the scenes, but things were getting desperate.

To be sure, I started looking at the versions of some of the files on the system, so I could which updates might already be installed.  I was looking at the version of wusa.exe and wups2.dll files in c:\windows\system32.  From what I could see, I think I must have already included the two dependent installs from KB2919422 and KB2919355, so I figured I might be able to get away with installing KB3102812 directly, which is supposed to fix the performance issues.  As I say, this is not without risk, but the chances were looking good that if I could just force the update of the Windows Update Service, I might be on to something.  So the steps eventually were:

  1. Check versions of the files to give some assurance that older, dependent service updates where probably already included in my Windows 8.1 installation.
  2. Download the (in my case) x86 version of KB3102812.
  3. Open a command line (using the “Run as Administrator” option).
  4. run the following commands:
cd \Users\me\Downloads
mkdir temp
expand -f:* “Windows8.1-KB3102812-x86.msu” temp
cd temp
start /w Pkgmgr /ip /m:Windows8.1-KB3102812-x86.cab

This took a few minutes, but eventually looked like it had done something and told me I had to reboot to finish the installation (after also telling me that use of pkgmgr was deprecated).  Sure enough, on rebooting I got the familiar “Configuring Windows” display and once running again, I could see from the dates in the c:\windows\system32 that quite a few Windows Updates related files had been updated.  Curiously not wusa.exe though …

At this point, I ran Windows Update as normal, whilst watching disk activity again using the Performance Monitor, and yes, after quite a few minutes, it finally declared I had 213 updates to install and proceeded to download and install them.

Phew!

Fingers crossed, this has now got me up and running and past the irritating, Microsoft-acknowledged bug, that exists in Windows Update for Win 8.1 that, infuriatingly, they only seem to provide a fix that requires installing via said problematic Windows Update.  Talk about chicken-and-egg!

Update on the updates: once all 213 were installed successfully, there were 7 additional updates and 10 optional updates. Thought I’d get it fully up to date so selected all 17. Turns out that one of the optional updates causes a perpetual shutdown-reboot cycle.  Also turns out that it is nigh on impossible to use F8 on a Windows 8 PC to enter safe mode – hence I guess why you set it using msconfig.  Thankfully I was able to use the Acer boot menu to start the troubleshooter and restore from a system restore point. Unfortunately it was the restore point prior to the 213 and the manual fix … Off we go one more time then … But really, an update that shuts down before you can even type CTRL-R msconfig?  Really Microsoft??  Moral of the tale-once it’s running ok, create a manual restore point and create a system image backup pretty quickly!

Update on the update on the updates: Of course Microsoft removed the backup and restore options from Windows 8 that let you create a system image so you have to use the command line wbadmin tool …

Kevin

 

Permalink 1 Comment

Long playing for 1000 years

December 10, 2016 at 6:29 pm (computers, music) (, )

I first stumbled across the Longplayer project when I saw a mention of their Longplayer for Voices on Kickstarter.  Then I completely forgot about it until Christian Payne (Documentally) mentioned that he’d caught up with the originator of the project on his long-form, email newsletter, ‘Backchannel’ at which point I looked it up again.

The project is great – a very long-term musical project (a bit like As Slow as Possible) conceived and composed by Jem Finer.  The one line summary is that he has recorded a sequence of music for some ‘singing bowls’ and the project combines various processed versions of this 20 minute piece in a range of different ways, resulting in a piece of music that will play continuously for 1000 years without repeat.  The long version can be found on the about page for the project (its worth a read).

To listen along, there is a live stream available from the website or listening stations in a couple of locations in London and San Francisco.  There are a series of live performances too where players play extracts of the piece.

And more recently there is now an iOS app that uses the same 20 minute piece, the same time-driven algorithm and a sense of shared time via the Internet to make the app play exactly the same part of the music available in the physical spaces and via the web.

The ‘score’ is a simple representation, with six concentric rings showing the sounds in six variations of the 20 minute piece.  But the algorithm behind Longplayer will play each ring at different speeds – with one of the rings taking 1000 years to complete.

There is a visual representation of the score with an indication of which part of each ring is currently playing.  This is available via the web and the iOS app.  The following show four stages of the app over a 24 hour or so period.

Notice how the second ring progresses the quickest, but some of the others hardly at all.  The third ring is the 1000 year ring, so over 24 hours there is no movement at all

2016-05-06 21.00.352016-05-06 23.15.362016-05-07 06.15.482016-05-07 13.13.332016-05-07 17.27.24

A great app, a great project and fascinating music!

Kevin

 

Permalink Leave a Comment

Custom Blockly Block “does not know how to generate code”

March 8, 2016 at 10:56 pm (computers, kids) (, )

I’m playing around with my Espruino board (embedded board, programmed with JavaScript) as part of my quest to find a kid-friendly embedded controller.  One of the nice things about Esruino is that it comes with a Web-based IDE that provides a terminal console that allows you to write JavaScript directly onto the board or allows you to programme it using Blockly.

I want to write some custom blocks, so downloaded the source for the EspruinoWebIDE and did the following:

  • Created a new file “EspruinoWebIDE\blockly\blockly_myfile.js”
  • Included this file in a SCRIPT tag in the top of “EspruinoWebIDE\blockly\blockly.html”
  • Proceeded to create my blocks – initially as defined using the Google BlockFactory and then added to blockly.html to present them in the UI

There are already a few files defining extra blocks – blockly_espruino.js is the main one and blockly_robots.js is a simpler one, that actually makes quite a good example to follow if you are doing your own.

The basic idea is that there is a ‘toolbox’ definition for your block in the blockly.html file (which makes it appear in the menu of blocks in the user interface), supported with a block-definition file detailing the physical appearance of the block and what it needs to connect to within the user interface (Blockly.Blocks.mycategory_myblock) with an accompanying code-generation block.  In this case, generating JavaScript via Blockly.JavaScript.mycategory_myblock that uses the Blockly API to get what it needs from the user interface and returns a string that contains the corresponding generated code.

There is a setting in the EspruinoWebIDE – Settings->General->Overwrite JavaScript with Graphical Editor – which is quite handy at this point, as it means that every time you hit ‘Send to Espruino’ in the graphical editor, the JavaScript window is updated with the generated code.

Except when it isn’t.  There were no obvious errors, and the ‘Send to Espruino’ always said ‘Sent’ but there was no outward sign that anything had happened.

If you use the Inspect option of the Chrome browser then it was apparent that there was a JavaScript error:

Language “JavaScript” does not know how to generate code for block type “mycategory_myblock”

This hidden message indicates that there is a miss-match between the Blockly.Blocks.mycategory_myblock function and the Blockly.JavaScript.mycategory_myblock function and even though the block is available through the user interface, Blockly doesn’t know how to generate code for it.

Except in my case, no matter how it was written, generated, typed or checked, it was ignoring my code and I just could not spot what the error was.  Eventually, I changed the order of the SCRIPT statements in blockly.html, wondering if there was some kind of load-order issue and it suddenly started working.  Once I changed the order back again, it kept on working – so unfortunately I have no idea what was causing the problem, but just guessing some weird local caching issue or something not picking up my changes.

But if you are finding things aren’t working but there are no visible errors, definitely try Inspect and look for JavaScript errors and see if you can somehow force the application to re-load all files from scratch to make sure you aren’t working with an old version or something similar.  I still don’t know why it started working, but at least it works now.

The only reason I’ve written this is that Googling for various hints as to what might cause the issue was failing me – even once I knew what the error was.  So thought I’d write it down myself in case others have a similar issue – this might give someone else a clue.

Despite this rather irritating issue, I actually quite like Blockly.

In a future post, I’ll talk a bit more about what I’m actually doing with all this.

Kevin

 

 

 

Permalink Leave a Comment

Codebugs, Glowbugs and DIY Tails

February 20, 2016 at 11:21 pm (computers, kids) (, , , , )

We got a couple of Codebugs just before Christmas and have been having quite a good time playing with them so far.  You write code for them using an online IDE based on Google Blockly and the device itself has two buttons, a 5×5 grid of LEDs and 4 GPIO ports with nice croc-clip friendly contacts on it so you can straight away start playing with linking code to the physical world.   It also has an expansion connector (the ‘Tail’) and when you connect it to a PC via USB it comes up as a mass storage device and you drag code across to it to run it.

We’ve done the obligatory “scroll your name” across the LEDs, hooked up fruit to create a fruit ‘touch’ keyboard and have started exploring some of the projects available via the online community.

My only slight gripe is that the mechanism for getting code on it isn’t quite as intuitive as it might be.  We’ve largely got the hang of holding buttons down whilst powering it up.  although, when trying out code, it tends to stay plugged in, so we use the ‘reset’ then ‘hold’ technique designed for when it is powered by battery most of the time.  However sometimes the buttons aren’t held quite long enough for it to register.  Also, every time it comes up in mass storage mode, the previous programme is erased.  If you are not careful you end up with lots of “compiled” Codebug programmes lying around your browser’s download directory.  Seeing as all projects are managed by the online IDE it would be nice if there was a neater way to send the code straight to the Codebug without copying between directories.

That aside, its a great device and has generated lots of interest with the kids and I’ve recently purchased a set of Glowbugs.  These are WS2812 based RGB LEDs with simple croc-friendly (of course) contacts that you connect to the Codebug using the GPIO, configure and off you go.

For our next project however, we quite wanted to use all 4 GPIO as inputs and I know that the Glowbugs can be driven directly via the expansion header, so I set about seeing if I could create a DIY ‘tail’ connector to breakout the CS, +5v and GND connectors, as used by the Colourtail, to something that would accept croc clips.

I also have a cheap, purchased from China, 24-LED WS2812 pixel ring with the same +5, GND, DIN, DOUT interface as Neopixels and the Glowbugs that I wanted to use.  I’ve already connected this up via the Codebug Tail, but again wanted something croc-clip friendly that the kids could use.

So armed with a 20x80cm prototyping board and some right-angled headers, I set about making a simple DIY tail adaptor and connector for the LED ring.  Warning – massively dodgy soldering coming up.

fig1.png

As a major goal was to make this easy for the kids to use, I wanted the connectors to break out in the same order as the Glowbugs – so (with all boards face down) this means from left to right, GND, DIN, +5v.  However the tail connectors are CS, GND, three not required for this application, and VCC, so I needed a wire link to get CS (for the data) from the left-most pin to a central spot.

fig2.png

With a small portion of board cut and smoothed ready for headers, I decided to use crude solder blobs as a simple way to create croc-friendly pads and connections, as can be seen via the very dodgy soldering going on in the following!  In case you can’t quite make it out, the ‘circuit’ is highlighted in the last pic.

fig3.png

So after adding another three ‘pads’ on the other side, the final thing looks like this.

fig4.png

In order to be able to easily use the LED pixel ring, I decided on a similar approach to add some ‘pads’ to the ring.  Once again I wanted the pads in the same order as a Glowbug.  I could have added both an ‘in’ and ‘out’ connector, but decided for simplicity only to create an ‘in’ – so the ring will always be the last thing in the chain.  In the following, the wires are coloured as follows: green is GND, blue is DIN and red is VCC.

fig5.png

The biggest problem with just connecting the pixel ring directly to the Tail connector was the poor physical connection of the wires to the ring itself, so this time to give it a degree of kid-robustness, I used a hot-glue gun to stick the pads to the ring and protect the solder links.

fig6.png

With a final blob of glue over the top of the solder connections to the ring, everything is ready to go.

fig7.png

So to use the Glowbugs connected via the DIY tail, you have to use the configuration blog to enable the ‘Colourtail’ rather than ‘Glowbug’, but otherwise, everything else is just the same.  And of course, the ring is just treated as a set of additional 24 Glowbugs added on the end of the chain.

So crude, and soldering that will definitely not be winning any prizes, but it works, and passes first contact with the kids.

fig8.png

Kevin

 

Permalink Leave a Comment

Severe consequences of losing your data?

February 5, 2016 at 5:09 pm (internet, kids, moan, security) (, , , , , )

I read this article from TheRegister with mild interest:

“Medical Data Experiment goes horribly wrong: 950,000 records lost” – http://www.theregister.co.uk/2016/01/27/centene_loses_95000_medical_records_on_six_hard_disks/

Ok, so yet another ‘company loses personal data, warns as a precaution’ story.  In this case, six hard disks apparently containing personal health information of around 950,000 people.

So my initial thought was something along the lines of “are people really misplacing whole hard disks still in 2016”?

Personally, I suspect it is more likely an accounting problem rather than a physical loss – they are probably labelled up wrong, or left in a drawer somewhere, or have been re-used and nobody noticed, that kind of thing.  But it is interesting to look at the phraseology of two consecutive press releases from the company involved (no, I’m not quite why I looked them up either – but I did!).

On the data loss:

Centene Announces Internal Search of Information Technology Assets

“Centene has determined the hard drives contained the personal health information of certain individuals who received laboratory services from 2009-2015 including name, address, date of birth, social security number, member ID number and health information. The hard drives do not include any financial or payment information.  The total number of affected individuals is approximately 950,000.”

Fair play – they are admitting their mistake and attempting to do the right thing:

“Notification to affected individuals will include an offer of free credit and healthcare monitoring. Centene is in the process of reinforcing and reviewing its procedures related to managing its IT assets.”

Otherwise, without openness and honesty around such issues, how can lessons be learned?

But the following day, the next press release announces their financial results for the year:

Centene Announces Preliminary 2015 Financial Results

“On January 25, 2016, the Company announced an ongoing comprehensive internal search for six hard drives that are unaccounted for in its inventory of approximately 26,000 information technology (IT) devices.  This incident resulted from an employee not following established procedures on storing IT hardware.  While we cannot estimate the impact with certainty at this time, the Company does not expect the impact of the incident to have a material effect on its future growth opportunities, financial position, cash flow or results of operations.”

Yes – they don’t expect the fact that 950,000 people’s personal health details going missing will affect their financial position now or in the future.

I guess that answers the question of why it is 2016 and companies still lose whole hard disks of personal information.  If there is minimal financial impact, it is good business sense for them to keep their procedures at the minimum deemed necessary – that is just sensible business risk-management.   In fact the whole ‘free credit and healthcare’ monitoring could be seen as a cost effective insurance policy against possible loss should it occur, compared to the costs of labour intensive, fault-free asset management to prevent any chance of loss up front.

These things will only change when the impact of the issue impacts the companies involved much more significantly, rather than just ending up a problem for the people whose data is lost.

In the UK, I guess we have the Information Commissioner’s Office guidelines for handling data and ability to set fines, but even this misses the point for me.  A fine is after the fact and with so many charities and volunteer organisations (cough, Scout National database) storing personal details, a significant fine would end up burying an organisation and an insignificant fine is largely pointless.  But either way the data will still be lost.  So the answer to this one is really education – so to that end, the ICO Guide to Data Protection is great – but unless someone is actually auditing and proactively educating organisations, or perhaps more appropriately companies now selling online services to organisations, on these principles, I suspect we’ll keep seeing problems occurring.

As we see massive growth in companies providing online payment services (ParentPay, SchoolMoney, PaySchool and so on) information and content management (dbPrimary, Google for Education, etc), communications and mailing services (ParentMail, etc), biometric authentication (40% of secondary schools apparently), online learning, and so on to education and charities, more of our data ends up online regardless of the fact it might not be us putting it there!  For a cash-strapped organisation, managing an offline and online database isn’t going to happen.  You might not use their online system, but your data will be there as they’ll be using it themselves.

The school use of biometrics is particularly  worrisome – many kids may have their biometrics compromised before they are even old enough to decide for themselves if they want to hand over their biometric signatures to any company.

Fundamentally, at present, all the risk from a company storing your data is on you, not them.  Until that risk balance is addressed, I guess we will stay at the mercy of “bottom line (non-)impact” reporting.  And whilst it is convenient and cost-saving for organisations to use more of these online services, our data will keep being stored who knows where and there is very little we can do to stop the tide of information uploading.

Kevin

 

 

Permalink Leave a Comment

How much? I could buy a computer for that!

January 18, 2016 at 9:17 pm (computers, internet) (, , )

First there was the C.H.I.P. – the $9 computer with built-in Wifi.  Then soon after that appeared on Kickstarter, the Raspberry Pi Zero came out – a $5 Raspberry Pi.  Ok, so strictly speaking you need a few accessories to really get them going as fully fledged computers as most people would recognise the term, but in these days of cheap computers, it made me think, just how does this compare with other ‘everyday’ items?

So, taking the “list price” for the Pi Zero, as £4 … that is:

Of course, these days, $5 will get you  a whole range of goods and services, including, according to Dave Gormon, 5000 Twitter followers!

And of course, as per the tweet that started the thinking behind this ramble … just slightly more than a 10 minute bus trip in Cambridge!

Kevin

 

Permalink Leave a Comment

ArduBlockly and the Arduino Nano

January 2, 2016 at 4:33 pm (computers) (, , )

I’ve been wanting to find a scratch style interface for Arduino to see if I could do something simple Arduino and Lego wise for the kids.  We have a CodeBug (which is pretty good for learning basics of programming for LEDs and I/O – maybe the topic of another block post, but see http://codebug.org.uk/ if you are interested) which is programmed using a web-based environment based on Google Blockly.  We’ve also used Scratch, so these were my two starting points.

After some googling, I found ArduBlockly, ArduBlock BlocklyDuinoS4A (Scratch for Arduino) and Snap.  As far as I can see, ArduBlock doesn’t seem to be maintained at the moment, Snap looks like an enhancement on S4A and ArduBlockly looks inspired by BlocklyDuino.

Snap looks particularly interesting and I’ll take a look at that at some point, but I went with ArduBlockly as it has a ‘download and just run all-in-one’ installation.  As far as it goes, this largely worked quite well – the only problem is that at present, it doesn’t support the Arduino Nano, which is what I was hoping to use.

However, seeing as this is basically using a Python web server to serve the Blockly interface to a browser, and then using the Arduino IDE (at least v1.6) directly to interface with the hardware, I had a poke around to see if the Nano could be slotted in.  The answer is yes and no.

The ‘all in one’ nature of the beast means that the Python is compiled into something that just runs, so isn’t editable anymore.  However, if I was happy to install Python and use a browser directly, I could hack it about.

Note: the following will hopefully become redundant at some point as support for the Nano I’m sure will be forthcoming, but it is documented here for my own reference right now.

In order to add the Nano enough for me to start playing, from some googling and searching around on github, there are three files that appear to require editing:

ardublockly/classic/settings.html

In the ‘Arduino Board’ selection form, a new <option> is required whose value is ‘nano’.

ardublocklyserver/compilersettings.py

There is a __Arduino_type array which needs to include

'Nano': 'arduino:avr:nano'

as an option.

blockly/generators/arduino/boards.js

This defines the properties for the different support boards, so an entry for the Nano is required.  This is largely the same as the ‘uno’ entry, but the Nano has two additional analogue pins.  This is unverified, as I’m not an Arduino expert (to use at your own risk), but I believe all that is required is to create an entry as follows:

Blockly.Arduino.Boards.nano = {
  name: 'Arduino Nano',
  description: 'Arduino Nano with ATmega328p board',
  analogPins: Blockly.Arduino.Boards.generateAnalogIo(0, 7),
  digitalPins: Blockly.Arduino.Boards.generateDigitalIo(0, 13).concat(
                   Blockly.Arduino.Boards.generateAnalogIo(0, 7)),
  pwmPins: Blockly.Arduino.Boards.uno.pwmPins,
  serial: Blockly.Arduino.Boards.uno.serial,
  serialPins: Blockly.Arduino.Boards.uno.serialPins,
  serialSpeed: Blockly.Arduino.Boards.uno.serialSpeed,
  spi: Blockly.Arduino.Boards.uno.spi,
  spiPins: Blockly.Arduino.Boards.uno.spiPins,
  spiClockDivide: Blockly.Arduino.Boards.uno.spiClockDivide,
  i2c: Blockly.Arduino.Boards.uno.i2c,
  i2cPins: Blockly.Arduino.Boards.uno.i2cPins,
  i2cSpeed: Blockly.Arduino.Boards.uno.i2cSpeed,
  builtinLed: Blockly.Arduino.Boards.uno.builtinLed,
  interrupt: Blockly.Arduino.Boards.uno.interrupt
};

Then running the ArduBlockly application using the ‘start.py’ script rather than the stand-alone ‘ardublockly_run’ batch file seems to allow me to use it with my Nano.

I was getting ‘Arduino Exit Code: 259’ as an error though, and something somewhere online suggested that the arduino_debug.exe should be used for the diagnostics from the command line, rather than your arduino.exe, so I updated the ArduBlockly preferences to use arduino_debug.exe and now I get a successful build and download.

Aside – I couldn’t get ArduBlockly to work in MS new browser (Edge), so I use it with Chrome, connecting to the local URL generated by the running Python script of http://localhost:8000/ardublockly/

(If I ever get around to getting GitHub going properly and assuming this is verified as the right way to add the board, I’ll submit it back).

I look forward to see how ArduBlockly develops, and do wish to try Snap at some point too (especially as at present, with the above hack for the Nano, it is no longer the simple ‘all in one’ application for installing on a PC that the kids could use).  However, it is early days for ArduBlockly development, and so far the signs are looking pretty good to me!

Kevin

 

Permalink Leave a Comment

MIDI Arp

December 1, 2015 at 11:17 pm (computers, internet, music) (, , , , )

I wanted to do something with MIDI and Arduino.  I’ve just picked up some cheap Arduino Nano Ethernet shields, based on the Microchip ENC28J60, so thought I’d combine the two.  The ENC28J60 and a cheap Arduino Nano makes for a very compact and economical Ethernet ready microcontroller and I have a nice Roland MT-32 Synth module gathering dust that I wanted to try again.

2015-12-01 21.16.05

My initial idea was to use MIDI to trigger sounds based on arp requests received by the Arduino, (hence the name MIDI Arp), but then decided that on my home network arp requests wouldn’t give a lot of variation, so I decided to see if I could trigger on the destination IP address of any packet received.

First I needed the MIDI interface.  I followed the simple circuit and example provided on the Arduino website, but wanted it all self-contained inside a MIDI plug rather than on a breadboard, so I soldered up the 220 resistor inside a 5 pin MIDI DIN plug as follows (MIDI pins are number 1, 4, 2, 5, 3 for some reason):

  • Arduino GND – Brown – MIDI Plug pin 2
  • Arduino 5v – Red – 220 Ohm resistor – MIDI Plug pin 4
  • Arduino TX (Pin 1) – Orange – MIDI Plug pin 5

This was then connected to the Arduino and the MIDI test programme showed that all works fine.

2015-12-01 21.16.212015-12-01 21.19.13

So, to the Ethernet side of things.  The following is an excellent starting place for the ENC28J60 based nano shield:

After reading this, I decided to use the UIPEthernet library as my starting point as I liked the idea of a plug-in replacement to the standard Arduino Ethernet library.  There was two major things to work out – first, how to set the device into some kind of promiscuous mode, assuming it supports it at all; second how to grab the destination IP address from any received packets.

From the ENC28J60 data sheet, the key register that controls the receiver filtering is the Ethernet Receive Filter Control Register – ERXFCON (see section 8 ‘Receive Filters’).  There are a number of modes for filtering and the UIPEthernet library is set up to filter for the unicast address associated with the MAC address configured for the module, for broadcasts, and to use the pattern matching filter to spot arp packets.  It turns out that to set the receiver into promiscuous mode, this register just has to be set to zero.

Now this is where things got lazy.  I just dived into the UIPEthernet library sitting in my Arduino library folder and hacked about. I might tidy this up one day and do it properly.

The low-level driver code can be found in utility/Enc38j60Network.cpp.  In the Enc28J60Network::init function, there is a line that sets up the ERXFCON register:

writeReg(ERXFCON, ERXFCON_UCEN|ERXFCON_CRCEN|ERXFCON_PMEN|ERXFCON_BCEN);

This needs to simply be changed to clear the register:

writeReg(ERXFCON, 0);

Next, how to store the destination IP address.  Again, simplicity ruled this one too.

The high-level interface to the library can be found in UIPEthernet.cpp and UIPEthernet.h.  I added two public functions and two private variables to the UIPEthernetClass class in UIPEthernet.h:

public:
  IPAddress lastSrcIP();
  IPAddress lastDestIP();
private:
  static uip_ipaddr_t uip_lastipsrc;
  static uip_ipaddr_t uip_lastipdest;

Then in the UIPEthernet.Cpp file, added the code to store the last source and destination IP addresses from received packets.

First, define a structure to dig into to the IP header (a bit of a layer violation, but I wasn’t after neat designs really).  Add the following after the definition of ETH_HDR near the top of the file.

#define IPBUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])

Then add two (static) global variables to the file:

uip_ipaddr_t UIPEthernetClass::uip_lastipsrc;
uip_ipaddr_t UIPEthernetClass::uip_lastipdest;

Add two accessor methods to retrieve the last source and destination IP addresses (with appropriate conversion to the Arduino Ethernet friendly IPAddress format):

IPAddress UIPEthernetClass::lastSrcIP()
{
  return ip_addr_uip(uip_lastipsrc);
}
IPAddress UIPEthernetClass::lastDestIP()
{
  return ip_addr_uip(uip_lastipdest);
}

Finally add the code to save the addresses to the UIPEthernetClass::tick() function, on reception of a packet.

          Enc28J60Network::readPacket(in_packet,0,(uint8_t*)uip_buf,UIP_BUFSIZE);
          if (ETH_HDR ->type == HTONS(UIP_ETHTYPE_IP))
            {
              uip_packet = in_packet; //required for upper_layer_checksum of in_packet!
#ifdef UIPETHERNET_DEBUG
              Serial.print(F("readPacket type IP, uip_len: "));
              Serial.println(uip_len);
#endif
              uip_arp_ipin();
              uip_input();
              if (uip_len > 0)
                {
                  uip_arp_out();
                  network_send();
                }
                // Extra code added here
                uip_ipaddr_copy(uip_lastipsrc, IPBUF->srcipaddr);
                uip_ipaddr_copy(uip_lastipdest, IPBUF->destipaddr);
                // Extra code ends
            }

That should be all that is required to expose the destination IP address of any received packet via the UIPEthernet class (ok, breaking compatibility now with the standard Arduino Ethernet library).

The arduino sketch file now consists of the following:

/*
MIDI based on 
 http://www.arduino.cc/en/Tutorial/Midi

UIPEthernet Examples used for rest
NB: Requires hacked UIPEthernet Library!
 */
#include <SPI.h>
#include <UIPEthernet.h>
#include "IPAddress.h"

int lastIP;
int thisIP;

// Initialise note array with whole tone scales in octaves 3 through to 6
// C3 = 36
// C4 = 48
// C5 = 60
// C6 = 72
// C7 = 84
#define NOTES 24
int notes[NOTES] = {
  // C3  D3  E3  F#3 G#3 A#3
     36, 38, 40, 42, 44, 46,
  // C4
     48, 50, 52, 54, 56, 58,
  // C5
     60, 62, 64, 66, 68, 70,
  // C6
     72, 74, 76, 78, 80, 82
};

void setup() {
  //  Set MIDI baud rate:
  Serial.begin(31250);

  // Initialise the uIP and UIPEtherent stacks
  uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
  IPAddress myIP(192,168,0,6);
  
  lastIP = 0;
  thisIP = 0;

  Ethernet.begin(mac,myIP);
  
  // Initialise patch using program change
  // 32 = Synth 1, Fantasy
  midiCmd (0xC0, 32);
}

void loop() {
  Ethernet.maintain();
  IPAddress sip = Ethernet.lastSrcIP();
  IPAddress dip = Ethernet.lastDestIP();
  thisIP = 256*dip[2] + dip[3];
  
  if (thisIP != lastIP)
  {
    lastIP = thisIP;
  
    int note = (thisIP & 0xff) % NOTES;  // Scale to number of notes
    int vel  = ((thisIP & 0xff00) >> 8)/4;        // Scale to val between 0 and 64

    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, notes[note], 16+vel);
  }
}

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}

void midiCmd(int cmd, int val) {
  Serial.write(cmd);
  Serial.write(val);
}

The final byte of the IP address determines which note from the array of notes to play (modulo the number of notes) and the third byte determines the volume to be used, scaled and with a minimum specified.

There is a control message to set the voice on the MT-32 to Synth1-Fantasy as this sounds suitably ambient. There are no note-off messages, so notes are allowed to keep ringing. As the note array defines four octaves of whole tone scales, the running-on notes create quite an interesting effect.

2015-12-01 21.40.12

There seems to be a regular drone set up, which I think is due to the IP address of my PC and router. These two addresses provide a sort of default back-drop of sound to anything else going on.

In order to get anything useful though, it would be no good just using a port on the router, as even the dumbest, cheap modern router will tend to do some MAC level filtering on ports. I had a laptop and the Arduino plugged into an old Netgear En104 4-port Ethernet hub, which has no intelligence (as far as I know) built in – so the Arduino could see everything coming out of the laptop.

The results were quite pleasing. Google has a nice enhanced drone to it. You can really hear the clutter of a site that is pulling in ads from all over the Internet – such as Amazon or YouTube or a news site.

Edited to add:  Here is a short video below showing them being opened.  It’s a bit crude but you get the general idea.

 Maybe next, I’ll see if I can do the same with a Wi-Fi link for the Arduino instead of wired Ethernet.  It might also be worth trying different scales and alternative mappings of notes to addresses.

Kevin

Permalink Leave a Comment

Next page »