A good day

Today has been a good day. After a great Saturday down at Castril (waterfalls etc – fantastic weather) Aidan and I sat down with some wine to test his new movement sensor/smoke detector board. As is often the case the first iteration has some issues but I’m sure it won’t be long before I do a write-up  in here. We have a 3d printed box and it is now sitting on my wall. In the process we found some bugs in the home control 2016 code – to do with reading the state of inputs and sending relevant MQTT messages – all sorted now so that I have Node-Red waiting for input from the movement sensor and turning lights on, on timers. All the code and the OTA (which works wonderfully) is now updated. See the relevant blog items.

In the process I’ve realised (and you’ll note I’ve recently been upgrading even ESP-01s to 4Mbytes of FLASH) that OTA is a FAR better way than flashing boards – as you don’t even have to dismantle installations – or worry about turning off the serial terminal before programming boards  - just issue an OTA command and you’re off.  We’ve been making ourselves a little Python code to copy the OTA files across to the web server so that as soon as the code is updated in ECLIPSE – a single button-press makes the ROMS available to others.  Lots of updates tonight and the manual is being kept updated also.

CHIP[1]Meanwhile in the process of doing this I had a need to send information from one page to another in Node-Red and the new LINK modes work just superbly for that (you need to update Node-Red if it is more than a few weeks old). I’ve now updated several Node-Red installations without a hitch.

Meanwhile as Aidan was coming over from the UK he’s brought me some supplies here in Spain – a super new keyboard – a “Tecknet” which glows blue, red or purple as needed and which has sprung keys and laser engraving. It’s like a breath of fresh air.

I’m expecting BananaPi M2 as well as FriendlyArm new boards in the near future… right now I still have a problem with the FriendlyArm NanoPC T3 – it’s a wonderful board but for the life of me I can’t get the Android installation to work other than in the 8GB image – which leaves almost nothing to work with. I plan to put a 32GB USB drive in there and want a full 32GB installation.

ChipAidan has also brought me a CHIP board (seen above) – and I’ll be looking at that in a future article – it is really neat, quite small and the setup is ridiculously simple. Ok it isn’t the fastest processor in the world but  we’ve had Mosquitto running on it and in the process I even learned how to use the venerable VI editor! Like many boards it claims to show itself up by name on the network – and like most of them this just does NOT happen on Windows 10 at least – but again like most, the line I added to the install script:

sudo apt-get install samba samba-common samba-common-bin winbind

works every time and now I can just access it in VNC as chip:1

Chip has some smile-producing features one of which is a battery connector – so to test – just plug in a cheap battery using a standard connector. Now imagine you are communicating with it via VNC – and the power to the unit fails – makes no difference at all, just keeps on ticking with its wireless connection. Of course you can do this with loads of board but most of them need a complete battery backup system which we’ve discussed successfully in this blog recently – in the case of the Chip – nothing more than a battery is required.

No issues with the updated ESP8266s with the new ROMS discussed a couple of days ago – they work perfectly as you might hope. I’ve run out of the FLASH chips now now and sent off for some more to China (2-3 weeks). I’ve been thinking about how to use the extra 2MB RAM – I looked a SPIFFS but it is WAY too complicated and at least the original code would fail for me as I’m running short of IRAM so I’m thinking how I may create a simple system.  You have to write in 4K blocks as I understand – which could prove an issue as I’m not sure I have 4K of RAM left to form a write-buffer. More on that next week as I start experimenting.

Facebooktwittergoogle_pluspinterestlinkedin

21 thoughts on “A good day

    1. Hi - sensors - just the cheap Chinese analog types - I think they're around £3.

      PubSubClient is for the Arduino=ESP environment - I don't use that - I use the unofficial C development environment - and TuanPm's MQTT which has proven bulletproof. Not sure what that has to do with OTA however which is simply the process of downloading and programming a replacement FLASH program - the buffers on MQTT would generally be far too small for this.

        1. Thanks for that - I don't use the Arduino environment other than to play with. PubSubClient is fine - but whereas I've used TuanPMs code now for well over a year 24-7 with complete success I've only played with the PubSubClient code so I can't comment much either way. Clearly it is streaming the info in smaller buffers. For those not using that environment the standard Espressif API pretty much covers this and of course the source for the code I use is on Bitbucket. Updated last night as it happens.

  1. I have just received the CHIP board myself recently so I am looking forward to your review, but I am not sure it will be an Arduino killer to be honest. The price is good though

    1. None of these devices is meant to be "Arduino-killer" I suggest. They are completely different. An Arduino is a relatively fast, real time controller, these things are computers with BT4 and WIFI built in. Not the same thing really. I won't get into the differences - but just for example - try running an MQTT broker, a SQLITE server or Node-Red on an Arduino - you might find it a little more difficult than on the Chip. As for the price - these are so cheap the big issue I'll guess is postage. You can get Arduinos post-free from China for a few pounds at most. So the two have different costs and different capabilities.

      One thing I did notice is that though the Chip is cheap at $9 - if you add HDMI you are up to $24 - for that money you can get FriendlyArm products which are faster, with more memory and all on one board.

      1. Apologies, my bad - I meant Raspberry Pi. Obviously, CHIP has to be compared to the RPi rather than a microcontroller. Raspberry Pi Zero for £4 does have HDMI and more expensive RPi3 has got BT4 and Wifi, but much more expensive. Well worth money in my view.

        1. Ok, so personally I use Raspberry Pi 3 for everything - I can't be bothered with the Zero as by the time you add all the extras on it hardly seems worth the effort. I am however warming up to the FriendlyArm NanoPi 1 with a cheap WIFI dongle in the side. I guess where the CHIP scores over the Pi is that it is smaller and has the battery connector on - for those of us with a hardware bent, you can easily provide battery backup for Pi but in the case of the chip - any old portable phone battery just plugs in without any messing. It is however one HELL of a lot slower than a Pi.

          1. Do not discard the Zero yet - I have supported the following kickstarter IoT HAT , which adds a Wi-Fi 802.11n + Bluetooth 4.1 - https://www.kickstarter.com/projects/1991736672/iot-hat-for-raspberry-pi-a-must-have-for-pi-zero?ref=user_menu
            The smallest form factor is the biggest advantage here. I am eagerly waiting for the HAT to test. Somehow, I think this would be my favourite one.

            I have many Li-on batteries and most if not all would not fit the CHIP connector. However, having such ability is definitely a plus. On another hand, I have a UPS HAT on my RPi3 - http://www.modmypi.com/raspberry-pi/breakout-boards/pi-modules/ups-pico I utilised a 26650 5000mA battery - it lasts for a day or so. This means my RPi3 is portable.

          2. OK, this is a good find! The only downside of such an UPS is that it requires a nice 3D case. I do not have a 3D printer, which means I'll have to folk out about £20-30 on the case alone.

            UPS plco comes as a HAT and goes on top of my RPi3. I am using a modular case like this http://www.modmypi.com/raspberry-pi/cases/modmypi-single-colour/modmypi-modular-rpi-b-plus-case-black

            This means that I have only one case with the RPi3 and several HATs. And it eliminates extra wires or extra 3D printed case.
            Needless to say that the UPS plco is programmable and have got a fan (comes separately though) to cool the RPi3 down - this is very handy as I have a full control from Domoticz (voltage, temperature, fan etc)

            Anyway, just my two cents...

      2. can the battery be recharged if the microusb is powered on? So to use the Chip on power supply when there's power and switch to battery when not, using it as an UPS...

          1. one of its downside seems to be the id**ot name they choose: it's quite hard to refine searches to ONLY the board, if you not restrict searches to THEIR domain...

  2. Regarding OTA I know you don't use the arduino ide for this but suspect you have same same problem in that it's not possible to monitor the serial output when using OTA say to monitor and tweet your code, one really cool solution is to use https://github.com/tzapu/WebSocketSerialMonitor .. basically you load this sketch to a spare esp8266 ( I use a wemos d1 mini) connect 5v , 0v and ( tx to rx ) between the esp & wemos then log on to its web.page and view the serial output, simple, in reality the wemos I use is powered by a lipo and all of my esp's now have a plug in connection 0v & txt I just plug in my battery powered wemos into any of my esp's to monitor there serial output, I find this invaluable.

    1. Hi there Toshi - I certainly do both monitor the serial output - AND control the board via serial. The line parser I built to handle incoming MQTT payloads also takes input from the serial line so that you can interactively experiment with the board from the serial terminal at 115Kbaud, say while developing, testing or setting up.

      I can therefore talk to the boards via the web (MQTT) or via serial. Of course we also have a web setup page - and that is how some folks set them up - I find it just as easy to use the serial terminal - in fact I program on a PC using Eclipse editor and the unofficial development environment in C. I've just realised I've been developing that code for exactly a year now.

      If I want to check a board live, I have serial terminals on my phone and tablet - but more often than not I simply use MQTT to talk to the boards, using MQTT-SPY.

      I could of course simply implement an MQTT topic called say, debug, that would feature all the output that would normally go to serial but that's a little overkill. However, your solution looks fine.

      Here is a typical output from one of my boards on serial - from scratch and then including an OTA command being fired at it (minus the 78k gobbdegook at the start).

      ESP Starting...
      Initialised software serial to 57600 baud.
      Current web programming pin: 0
      GPIO13 is an indicator.
      Software version 1.4.6

      Use the {debug} command for more information.
      STATION mode
      Web page control enabled
      Connected as 192:168:1:28
      MQTT connecting
      MQTT Broker connected
      Device ID is newboard
      -->
      Time is 09:13:01 11/07/2016
      Ok
      Ok
      Attempting update
      newboard/fromesp/otaupdate=Attempting OTA
      OTA succeeded to ROM 0
      ets Jan 8 2013,rst cause:2, boot mode:(3,6)

      load 0x40100000, len 1344, room 16
      tail 0
      chksum 0x9c
      load 0x3ffe8000, len 660, room 8
      tail 12
      chksum 0xb8
      csum 0xb8

      rBoot v1.3.0 - richardaburton@gmail.com
      Flash Size: 32 Mbit
      Flash Mode: QIO
      Flash Speed: 80 MHz
      rBoot Option: Big flash

      Booting rom 0.

      ESP Starting...
      Initialised software serial to 57600 baud.
      Current web programming pin: 0
      GPIO13 is an indicator.
      Software version 1.4.8

      Use the {debug} command for more information.
      STATION mode
      Web page control enabled
      Waiting for Access Point wififorus
      Connected as 192:168:1:28
      MQTT connecting
      MQTT Broker connected
      Device ID is newboard
      -->
      Time is 09:13:01 11/07/2016
      Ok
      Ok
      Tick

  3. Another one here looking forward to your thoughts on the CHIP. I recently took receipt of 3 of them and I'm exploring what's possible. Still figuring out the SPI stuff but have got Plex server running on one that the kids can connect from their tablets in the car. It's amazing for the price.

      1. Hi Pete,

        I basically followed the instructions on this page: https://bbs.nextthing.co/t/plexmediaserver-on-a-headless-chip/5182.

        I run it from a powerbank and have it set up as an access point to connect to when in the car. You need to enter the local IP range in to Plex Server settings to make it work offline (Settings -> Server -> Network (Show Advanced) -> List of networks that are allowed without auth) otherwise it will prompt you to login to Plex.

        It streams 1080p and DVD rips from a USB stick just fine. I've not tried multiple concurrent streams but it's possible it would do this too.

        There are two rather significant issues I need to overcome. One is that scanning for media and updating the library is hideously slow, and the other (might be related to my choice of USB stick which gets really hot - 128Gb Sandisk UltraFit) is that the board shuts off after 30 mins or so. Presumably it overheats using the USB stick so I intend to put some media on the local storage to test.

        My ultimate aim is to write a sync script that copies music from a set of playlists over to the USB stick when it's connected to my home NAS. I'll also create modified versions of the Plex Sqlite3 databases and save thumbnails etc. to copy over to the CHIP when the USB is inserted. This way I can avoid all the pointless library scanning at least, and use my main Plex server UI to choose media in an easy way.

        I have a similar script running on a Pi 2 that parses the XML interface of my main Plex server to recreate libraries on the Pi, and using rsync copy the media over. I think the library method and local USB copying is the way forward though.

        If I get something working properly I'll post something about it. I'm loving the CHIP though. It's a really well thought out board in terms of how many features it offers for the price. To my mind it's best use is to be tucked away inside an 'appliance' rather than being a computer in its own right (which is strangely how it's being marketed).

Leave a Reply

Your email address will not be published. Required fields are marked *