heyrick1973 -at- yahoo -dot- co -dot uk

First, this...

Apparently banned for being, and I quote "too political", this Christmas advert by Iceland (a frozen food chain in the UK) tells the story of the destruction of the forests in the process of cultivating palm oil. Over here in France, it's a hot topic too, with more and more products advertising that they are free from palm oil.
I'm not sure what exactly the political aspect is here, other than very likely to be big business that uses palm oil in many products leaning on politicians to lean on the independent advertising reviewer (it was a company called "Clearview", not the official advertising watchdog).
While I don't think there are many (any?) companies with an ethically clean record when it comes to environmental issues (for instance, think of the environmental impact of all those freezers that Iceland operate, not to mention the energy keeping food frozen), the destruction of natural habitats is a real thing and some products are horrific offenders in this respect. We might grumble at the amount of maize being grown in Europe for bio-fuel additives, but we should probably start thinking about the impact that other food additives are having on the environment. Because we can't see it doesn't mean it isn't happening, and because it is happening on the other side of the planet doesn't mean it does not matter. We have to start somewhere. And the place to begin is awareness.

They might have banned it from being shown on TV. That doesn't mean we can't share it online. It's the 21st century, "banning" a message isn't going to make it magically go away. Enjoy Rang-tan's story:

 

Koi-Koi

Since the last release here, I have enhanced the program quite a bit more - specifically the computer player is more complex and has three levels of difficulty:
  • Simple will compare the points value of every card in the computer's hand with those on the table and play the cards that result in the highest points value.
  • Intermediate expands from Simple by adding a weighting to certain cards. For instance, the plain red ribbons are worth 'less' than the blue or poetry ribbons.
  • Advanced expands from Intermediate by fudging the weighting after analysing the cards on the computer's capture area and also the player's capture area. For instance, if the player has two poetry ribbons, then it is imperative that the computer try to claim the third (prevents the player getting a yaku for collecting all three).

The game look and feel has been tidied up too. Gone is the fugly VDU text, replaced by the Desktop font. Also the cards in the capture area are now arranged by type rather than all jumbled together. The player can optionally have their hand auto-sorted after the cards are dealt (highest value cards to the right).

Get your copy:

koikoi20181110.zip (~434KiB)
This software is for RISC OS!

 

Advent calendar

Well, the calendars this year were something like "Santa on the farm" (had that one in 2016), "Horses and stuff" (had that one last year), and "bank robbers" (not interested). So what to do?

Easy. Look on Amazon.

Here's the official NHL licenced product for Playmobil in Canada and Northern America:

As if it wasn't obvious from the picture, "NHL" means "National Hockey League" ("Ligue nationale de hockey" dans le zone francophone) for ice hockey, comprising of 24 teams in the US and 7 in Canada. Despite the greater number of American teams, the NHL was born in Canada; though the American influence is perhaps why the NHL is headquartered in New York, having left Montréal in 1989.

Sent to me from Canada, Amazon outdid themselves in crazy. Do you see the box looks a little tatty, and there is some colouring missing from the upper left (by the NHL badge)? And maybe the eagle-eyed can spot similar on the upper right? That's because Amazon stuck address and tracking labels on the box and sent it like that! You know, this being the company that puts a small calendar into an enormous box. Well, okay, so now postal employees on two continents know I'm going to be enjoying an NHL Playmobil calendar this year! Coucou, salut!

So, this will be the Playmo advent calendar for 2018.

 

ESP8266

I purchased an ESP8266 serial to WiFi module ages ago. I think it cost about a fiver. More recently, I got myself a set of 20 (or so, not counted) female-to-female jumpers. Being sent from China for a price something silly like €0,79 including postage, it accordingly took forever to arrive. But eventually it did.

What I have is a USB to serial interface based upon a (clone) PL2302. The serial port provides Tx, Rx, Gnd, and +5V.
The +5V rom the USB cable is connected to a YuRobot power board to drop the 5V to 3.3V for the ESP8266. This power board is fairly dangerous as it has tiny voltage regulators with no heatsinks that have a tendency to fail unsafe (providing the source voltage to the output). However the ESP8266 is not that power hungry so I decided to risk it.

The ESP8266 module is a tiny device that provides a serial interface and talks to WiFi networks. It supports 802.11 b/g/n with a built-in TCP/IP protocol stack, with low power behaviour (the rated maximum consumption is 215mA). It doesn't offer a socket level stack, it is connection based (connect to this IP address on this port).

It's pretty simple to use the device by typing commands directly into HyperTerm (I was using Windows) or any other terminal that can talk to the USB serial port, however there are some caveats to be aware of:

  • Check your voltages, and check again. The ESP8266 is known to fail with voltages in excess of +3.6V.
  • You'll need to tie the chip enable pin to +3.3V otherwise the module will simply not respond.
  • You'll need to configure your comms program to send CRLF upon pressing the Enter key (this is not the default in HyperTerminal).
  • Serial parameters should be 115200bps, 8N1, no flow control.
When everything is hooked up, turned on, and such, enter the command:
AT
You should see the reply:
OK
If you do not, then enter some random gibberish while looking at the ESP board. Does the little blue LED flash briefly as you press keys? If it does not then your wiring is not correct. You are pulling the chip select pin high? Is the red LED on? It should be...
If the blue LED is blinking, then there's something wrong with your configuration. Verify that the comms program is sending CRLF and not just LF when you press Enter. You may see a blank line after everything you type. If this is correct, then try connecting at 57600bps, and at 9600bps. You can alter the serial speed, and if you got yours second hand or aimed at Arduino boards, the serial rate might have been slowed so as not to swamp the microcontroller (there's no flow control, remember).

From now on, bold white will be things you type, and grey will be the response. The first step is to reset the device:

AT+RST

OK

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : DIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

OK

Now check the firmware version:

AT+GMR

AT version:1.2.0.0(Jul  1 2016 20:04:45)
SDK version:1.5.4.1(39cb9a32)
Ai-Thinker Technology Co. Ltd.
Dec  2 2016 14:21:16
OK

We should probably see if there's a firmware update, but first we need to get it onto a network, so let's do that. The first command switches to AP & client mode. You need to have client mode active in order to scan for other access points.

AT+CWMODE=3

OK
AT+CWLAP
+CWLAP:(3,"Livebox-XXXX",-70,"d0:ae:00:00:00:00",6,-9,0)

OK

Here, the parameters returned are 3 for WPA2_PSK, the SSID of the Access Point, -70 for signal strength, the MAC address. There appears to be other information (in this case, "6,-9,0") that doesn't appear to be documented. I am guessing 6 is the WiFi channel. No idea about the others.

Now let's try to connect. We'll set up the AP's password and we can see the device try to join the AP.

AT+CWJAP="Livebox-XXXX","12345678901234567890123456"
WIFI CONNECTED
WIFI GOT IP

OK
Now let's verify this:
AT+CWJAP?
+CWJAP:"Livebox-XXXX","d0:ae:00:00:00:00",6,-85

OK
This shows us we're connected to the AP, its MAC address, channel, and signal strength.

So now disconnect from the access point, and reconnect again this time writing the configuration to onboard Flash.

AT+CWQAP

OK
WIFI DISCONNECT

AT+CWJAP_DEF="Livebox-XXXX","12345678901234567890123456"
WIFI CONNECTED
WIFI GOT IP

OK

Did you spot the difference? The CWJAP command was followed by "_DEF" to mean "use this as the default from now on". What this means is that when the device is set into client mode (with or without its own AP), it will automatically try to connect to that access point.

So now we're online, let's see if there's an update... There are four stages to the update (1 - connect to server, 2 - request update, 3 - get update, 4 - flash update), it will take a short time so be patient, and the device will likely reset afterwards. You can then enquire the firmware versions to see what's changed.

AT+CIUPDATE
+CIPUPDATE:1
+CIPUPDATE:2
+CIPUPDATE:3
+CIPUPDATE:4

2nd boot version : 1.5
  SPI Speed      : 40MHz
  SPI Mode       : DIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user2 @ 81000


Ai-Thinker Technology Co. Ltd.

ready
WIFI CONNECTED
WIFI GOT IP
AT+GMR
AT version:1.2.0.0(Jul  1 2016 20:04:45)
SDK version:1.5.4.1(39cb9a32)
Ai-Thinker Technology Co. Ltd.
v1.5.4.1-a Nov 30 2017 15:54:51
OK

As you can see, the AT and SDK are the same, but the Ai-Thinker part has been updated.

Now to fetch something. You cannot use domain names as there is no onboard DNS, so you must pass IP addresses. I'm going to connect to my Pi as it will likely be a more forgiving server...

AT+CIPSTART="TCP","192.168.1.10",80
CONNECT

OK
AT+CIPSEND=18

OK
>
At this point, you will type in GET / HTTP/1.0 and press Enter. What you type is not echoed.

Recv 18 bytes

SEND OK

+IPD,17:HTTP/1.0 200 OK

+IPD,1460:Content-Length: 6059
Content-Type: text/html
Date: Sat, 10 Nov 2018 18:49:52
X-Server-Info: WebJames on RISC OS on a RaspberryPi.
Server: WebJames/0.48
There will follow a number of lines beginning with +IPD,xxx: where xxx is the number of bytes that follow. This will continue until there is no more data, and you'll see CLOSED instead of the +IPD message.

There is a way to enter 'interactive' mode where what you type is sent directly to the remote machine, and its replies come back directly (not via +IPD prefixed lines). This may be useful for interactive protocols such as telnet, however I couldn't get the breakout command ('+++') to work. I ended up power-cycling the device. If you want to try it, the command is AT+CIPSEND (with no size specified).

Clearly this device is best talked to by software, not a ham fisted human beating on the keyboard like a chimpanzee. However, for a few minutes playing with the device, it looks like an interesting way of adding basic WiFi capabilities to a device that doesn't have them. The ESP8266 also has modes to handle multiple concurrent connections, and also some sort of server mode. It can also act as an access point by itself.

 

 

Your comments:

Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺
 
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.

David Pilling, 24th November 2018, 02:09
Best way to use the ESP8266 is the NodeMCU board, which has built in serial port and hardware to program the ESP, then use it with the Arduino IDE. Essentially it will work just like an Arduino board. By now there is a 32 bit twin code version of the ESP. 
The 8266 is very nice, but the company behind it has let the "community" work it out for themselves. There is not the nice documentation that comes with things like the ATMel AVR chips. By now it is quite reasonable but it was harder going a few years back (came out around 4 years ago). 
David Pilling, 24th November 2018, 02:12
Prob 50% from China comes in a couple of weeks, and nothing that does not come in 90 days ever arrives. Trouble is there is no way of knowing. Over at AliExpress there are serious companies that charge for carriage and that can be a lot quicker and reliable. 
(and in the first comment I meant to say "twin core") 
Jonathan Harston, 2nd December 2018, 09:51
I was visiting a friend in Japan last month (god is it December already?) and pointed out her rock solid butter mentioned I usually used margarine. 
Oh you can't use margarine, that's full of evil trans fats! 
Ok, just use non-trans-fat margarine. 
Oh, you can't do that, it's full of evil palm oil! 
 
Dilemma dilemma....

Add a comment (v0.09) [help?] . . . try the comment feed!
Your name
Your email (optional)
Validation Are you real? Please type 09818 backwards.
Your comment
Calendar
«   November 2018   »
MonTueWedThuFriSatSun
   123
56789
12131415161718
192021222324
2627282930  

Advent Calendar 2018
(YouTube playlist)

Japan - can you help?
Japanese Red Cross
日本 赤十字社

Earthquake relief donations have closed.

Read about the JRC
Make a general donation

Last 5 entries

List all b.log entries

Return to the site index

Search

Search Rick's b.log!

PS: Don't try to be clever.
It's a simple substring match.

Etc...

Thank you:
  • Fred
  • Bernard
  • Michael
  • David

Last read at 03:22 on 2018/12/13.

QR code


Valid HTML 4.01 Transitional
Valid CSS
Valid RSS 2.0

 

© 2018 Rick Murray
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted.
RIPA notice: No consent is given for interception of page transmission.

 

Have you noticed the watermarks on pictures?
Next entry - 2018/11/11
Return to top of page