Deceitful Advertising

Sometimes I wonder what has happened to trading standards in the Internet age. Today it is apparently perfectly ok to lie through your teeth when advertising, particularly when you can later hide behind the language barrier.

See particularly bollocks advert here at AliExpress. They don’t do themselves or  us any favours allowing rubbish like this…

  5v 6amp means 30w, not 40w as claimed and how can the output be fixed at 5v when the unit also claims to support Quickcharge 3?  Utter waste of time.

Facebooktwittergoogle_pluspinterestlinkedin

EleksMaker Pro Laser Engraver

After much delay and I have to say patience from Banggood, I am now putting together this A3 laser engraving machine. Nearly done but still waiting for the actual laser module itself to arrive (the laser is not included in the basic kit) but meanwhile, assembling the kit is a day’s work so I figured I’d better get on with it.

Essentially the unit comes as a well-packed set of 3 motors, various aluminium tubes, a host of pre-cut Perspex pieces and an unfeasible number of nuts, bolts, retainers, wheels and various spacers. I opened the box maybe 9am Friday morning and spent the rest of the day constructing. At first it all looks a little daunting but that apprehension soon goes away, It did not take long to reach the stage where a whole table was needed to hold all the parts but by mid-day I’d cracked the back of this. I also broke one of the Perspex fastener/tensioners however.  Thank heavens for Gorilla glue. I hope it is strong enough.

Two of the three motors move the laser assembly forward and backward (left and right sides). The third motor is mounted with the laser and moves the latter left and right.

No documentation came with the unit but the Banggood site has construction info, software and drivers. What you see here are my own photos, in the link below, you’ll see the construction photos available, which I used to help me assemble the unit. The images in their docs are good but I was left in doubt as to where to mount the small electronic control box on the front aluminium support beam because other suppliers showed the box mounted vertically whereas in the Banggood-supplied revision, the box mounts horizontally. This box needs some trivial assembly which only takes a few minutes. I do not have detailed wiring information but it looks fairly simple. A power supply is provided. No info as to whether to mount this somewhere or leave lying on the bench (unless I’ve missed something).

http://wiki.eleksmaker.com/doku.php?id=elekslaser_a3_pro

Continue reading EleksMaker Pro Laser Engraver

Facebooktwittergoogle_pluspinterestlinkedin

The Script

Regular reader will know about the script that Aidan Ruff and I originally developed to put Node-Red and several other packages onto the Raspberry Pi for our own home control purposes. This has been developed with help from several people and in particular my friend Antonio.

Home Control 2017

Incidentally the image above is slightly dated, the Nano peripheral can now soft-fade two complete RGB setups (ie six pwm outputs).

WELL - there is a new version of the script which is intended to help set up certain Raspbian, Debian or similarly-based SBCs. The script includes logging and handling Raspbian Stretch (tested on Raspberry Pi  2 and 3, 3B+). As well as it's original purpose of setting up a Raspberry Pi, the script also runs well with several other boards running Debian, Ubuntu and more.  See right hand side of the above image for what it does. Read on…

Continue reading The Script

Facebooktwittergoogle_pluspinterestlinkedin

FY6800 Signal Generator

In today’s postbag, the new Feeltech FY6800 dual channel Signal Generator, complete with UK power lead, two bnc test leads, USB lead and bnc-bnc lead. However the unit came with no instructions or other paperwork. I assume a manual will follow later. The unit arrived well-packed via FedEx.

FY6800

Lovely to look at and extremely comprehensive in operation, the FY6800 is a compact unit that belies the vast range of functions it handles.

Continue reading FY6800 Signal Generator

Facebooktwittergoogle_pluspinterestlinkedin

Home Control 2018

Introduction (Latest update May 20, 2018)

HomeSick of reading about other people’s home control? Want to make your own? Got some electronics and software experience? You’re going to LOVE THIS! Rock-solid home control, flexible, low cost, DIY.

 

Home Control

Continue reading Home Control 2018

Facebooktwittergoogle_pluspinterestlinkedin

More Home Control 2018 Updates

As of version 1.5.61 (now on 2.3.18 – May 2018) of the Home Control 2018 code,  I’ve  expanded the {debug} command considerably, added new Hitachi display commands and introduced a new MQTT topic called “otacomplete”. Here incidentally is the Bitbucket repository for all of this.

The Hitachi commands are documented in the manual.  As for the new MQTT topic, this is so that, should you choose to OTA update a unit remotely, you have some means to know asap that it is working.  In the event of an OTA update, the unit will send out the following MQTT message:

topic : otacomplete
payload: [the ID of the unit]

Typical serial on-demand debug output at the time of writing – for a test unit with ID “freddy” - with passwords changed to protect the innocent:

Time: 09:07:05 11/05/2018
Time Code: 1470906425
Dusk: 21:08 Dawn: 07:22
On1: 08:00 Off1: 12:00 On2: 15:00 Off2: 23:00 Peak: 23c Off-peak: 19c Frost: 14c
IP: 192:168:1:25
Internal ID: ARPS_00A68508
ID: freddy
DESC: empty
FLAGS:
SSID: wififorus (Active)  Pass: xxxxxxxx
SSID2: wififorus  Pass2: xxxxxxxxx
MQTT Host: 192.168.1.19 Port: 1883 User: admin
OTA Host: www.scargill.net  Port: 80
Code Version: 1.5.61
SDK Version: 2.0.0(656edbf)
RSSI: -48
Out0: 0
Out4: 0
Out5: 1
Out12: 0
Out15: 0
Out16: 0
Sensor Type: DHT22
Temperature Port: GPIO2
GPIO13 available for general use: No
GPIO2 is an input
Sonoff setting=0
WiFi button=2
Invert settings=HEX( 1)
Serial2 settings=0
RGB Indicator=1
Electrodragon=0
No LED clock
CPU frequency: 80Mhz
Free Heap: 16680 bytes
Up Time: 0:05:04

Facebooktwittergoogle_pluspinterestlinkedin

The Nano Peripheral Update

I mentioned recently in an entry aimed at beginners, that I’ve been installing “the script” and my ESP8266 code on various devices. I now have a backed-up Raspberry Pi 3B+ board set up for testing, with the latest Raspbian and fully up to date Node-Red nodes including my own and running “the script”, talking to (in this case) a pair of Wemos D1 Mini boards, one of which has my Nano-based peripheral added.

Nano peripheral

Continue reading The Nano Peripheral Update

Facebooktwittergoogle_pluspinterestlinkedin

Amazon AWS Polly

Boy, did I just have trouble putting AWS Polly (text to speech) on a new Raspberry Pi 3… I copied the config from an older machine – big mistake. So then I erased the config files and used “aws configure” to set the default region, AWS key etc. This time it didn’t like my “region” – and that’s because the description on the AWS site is rubbish.. “EU (London)” is not a valid region. I checked what some Americans had done “us-west-1” for example. Amazon gives such examples consistently do the US but then refers to “EU (London)” which is not valid.

Finally I just put in one of the USA regions and all is well. This REALLY needs all putting on one page with EXACT examples for all regions.

See earlier blog entry for POLLY setup. This replaces IVONA text to speech for (in my case) Node-Red. https://tech.scargill.net/amazon-polly-speech/

Facebooktwittergoogle_pluspinterestlinkedin

Arduino Peripheral for HC2018

As many of you know, I don’t have a great deal of time for Arduino for WIFI/Ethernet – I cannot tell you how many months I wasted on those daft cheap Ethernet boards for them which never really worked reliably no matter what I did – so I probably have a mental block by now.

However, there can be no arguing that a board costing £1.28 inc. postage has to be worth using as a peripheral. The picture below shows where this all fits into the scheme of things…

Home Control 2016

(graphic reference to 2016 is out of date) And so it was today, I’d just finished putting some polishing touches on the I2c code, fresh from having gotten the BMP280 working – and I was looking at A/D boards to add to the arsenal when I remembered that Arduinos have A/D in… not stunningly high definition but good enough for checking batteries and light levels etc.

Nano[6]At that point, mid-coffee I remembered I’d bought one of these little critters from AliExpress. Be careful – not all of these bring A4 and A5 out, some have micro-usb connectors, others don’t. Some have 3v3 regulators, some don’t.  I find the most useful ones just have the FTDI connector on them and no USB – but then I have FTDI connectors coming out of my ears.

For the purposes of this item – a 3v3 regulator is not needed as presumably if you’re fastening I2c devices to the ESP8266, you’ll feed 3v3 to the whole lot. Anyway, use whichever suits you best. I’m also assuming pullups are in place – the Arduino has pullups but I doubt they are strong enough.

SO – the point of this is – it is quite easy to make an Arduino into an I2c slave – so for £1.28 you can make a port extender, more inputs, some analog inputs, PWM outputs – just about anything really as long as whatever it is doing doesn’t take up any time as the board needs to respond to I2c commands quickly. I have a MUCH more powerful device on the way from China with lots more pins etc. but for now, the humble Chinese Nano gets the job.

The simple WIRE library with a little code turns the Nano or similar into a device – I’ve chosen to make it DEVICE 9 by default  – don’t REALLY want to use up ports making that programmable but then because the board has EEPROM I’ve made a hopefully reliable method to store the device number in EEPROM!

In the simplest example, sending I2c commands to this device from the home control software discussed elsewhere in this blog – let’s say to turn output 13 on…

{nano:9,1,13,1}

And indeed that was the very first command I made it respond to as an I2c slave – mainly because on these boards, port 13 has a LED attached to it!!!

Clearly turning it off would be:

{nano:9,1,13,0}

Or how about reading the state of input 10?

{nano:9,2,10}

So here I’ve chosen to create the command nano – command 1 is set ports (2 is read ports)… port is 13, last parameter is 1 or 0 for on or off.  Immediately we have a port expander with several useful ports. For ease, the software I put into the Nano checks to see if the port has already been setup correctly and does that if not – hence avoiding annoying setup code at the ESP end.

With the simplest code and assuming A4 is used as the SCL and A5 is used as SDA, you end up with a “nano i2c peripheral” able to offer (if you get the right board offering A0-A7):

  • 6 8-bit PWM channels
  • 6 8-bit ANALOG inputs
  • 6 DIGITAL INPUTS or OUTPUTS

i.e. ALL of that. You could instead choose to have 18 general purpose I/O lines etc.

I’m sure it would not take most of you too long to figure out ALL SORTS of other configurations but for the sake of this project and this board example– there are ports 2-21 where Arduino A0 is 14. Now,  if your board DOES have A6 and A7, note that they can ONLY be used as analog inputs – they cannot be used as ordinary inputs OR outputs – that’s just a simple feature of the board, not the software.

The point being – they are SO cheap and with this code make good general purpose I2c peripherals – you have to ask yourself – in some cases, why you would use anything else!

So before we start – this will only work for short strings or series of numbers with the standard WIRE library for Arduino – see the blog where I learned the hard way this weekend that WIRE has a 32 byte incoming buffer AND a 32 byte transfer buffer and if you try to send more than that – the Arduino crashes – I’ve updated my WIRE to 128 bytes (so that’s 192 bytes more than before ) and it is working a treat with long strings – the reason I want that is because though you won’t see it in this basic code, I’m now working on running QTECH 160*120 displays in the Arduino peripheral.

I’ve updated the code and here is the current state of affairs – evolving rapidly, for the Nano - expect this to change – again  -  this time tomorrow it will no doubt have changed - again.

 

[pcsh lang="cpp" tab_size="4" message="" hl_lines="" provider="manual"]

//
// A simple i2c SLAVE - default device number 9 - reads instructions from
// master and either sets outputs or returns inputs accordingly.
//
// 
#include <Wire.h>
#include <EEPROM.h>

#define MAXPORTS 21
#define ADDR_LOC1 0
#define ADDR_LOC2 1

#define SET_OUTPUT  1
#define READ_INPUT  2
#define READ_INPUT_PULLUP 3
#define SET_PWM     4
#define READ_ANALOG 5
#define SET_ADDRESS 6

byte ports[MAXPORTS];
byte params[6];
byte paramp;
byte retParam;
byte bigcount;
byte device=9;

void setup() {

  byte eeprom1,eeprom2;
  eeprom1=EEPROM.read(ADDR_LOC1); eeprom2=EEPROM.read(ADDR_LOC2); 
  if ((eeprom1^eeprom2)==255) device=eeprom1; // programmable address
  bigcount=0;
  Wire.begin(device);           // join i2c bus with address #9 by default
  Wire.onReceive(receiveEvent);
  Wire.onRequest(requestEvent); 
  for (int a=0;a<MAXPORTS;a++) ports[a]=0;
  paramp=0;
  retParam=0;
}

void loop() {}  // not used yet

// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent() {

  Wire.write(retParam); // respond with message of 1 bytes as expected by master
  //Wire.write(34); // respond with message of 1 bytes as expected by master
  //Wire.write(45); // test
  //Wire.write("This is it you know",19);
}

// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void receiveEvent(int count) {
int tcount;
tcount=count;
paramp=0;
// no time consuming in here or the routine to send a byte back will be missed.
  while ((tcount--)&&(paramp<128))
   {
    params[paramp++]=Wire.read(); 
   }
  switch (params[0])
    {
    case SET_OUTPUT:
          if (ports[params[1]]!=1) { ports[params[1]]=1; pinMode(params[1],OUTPUT); } 
          digitalWrite(params[1],params[2]? HIGH : LOW); params[0]=0;
          break;
    case READ_INPUT:
          if (ports[params[1]]!=2) { ports[params[1]]=2; pinMode(params[1],INPUT); } 
          retParam=digitalRead(params[1]); params[0]=0;
          break;
    case READ_INPUT_PULLUP:
          if (ports[params[1]]!=3) { ports[params[1]]=3; pinMode(params[1],INPUT_PULLUP); } 
          retParam=digitalRead(params[1]); params[0]=0;
          break;          
    case SET_PWM:
          if (ports[params[1]]!=4) { ports[params[1]]=4; pinMode(params[1],OUTPUT); } 
          analogWrite(params[1],params[2]); params[0]=0;
          break;
    case READ_ANALOG:
          if (ports[params[1]]!=2) { ports[params[1]]=2; pinMode(params[1],INPUT); } 
          retParam=analogRead(params[1]); params[0]=0;
          break;    
    case SET_ADDRESS:
          EEPROM.update(ADDR_LOC1,params[1]); EEPROM.update(ADDR_LOC2,params[1]^255); 
          // update address - will take effect on next powerup of the device as you 
          // can only call "begin" once
          break;      
    default: break;  
    }
}

[/pcsh]

Facebooktwittergoogle_pluspinterestlinkedin