Category Archives: Battling with Tech

How to do things with your gadgets – usually learned the hard way

Adding an RSS feed to a WordPress site

An RSS feed lets people subscribe to the blogs on your website, without having to open their web browsers to see what’s new. They say that RSS stands for ‘Really Simple Syndication’.   I don’t understand that term, but it’s how to use it that matters.

WordPress automatically generates an RSS feed for every blog that you write.  It’s important to realise that an RSS feed is not an email generator – it does not send emails to subscribers.   You have to subscribe to the feed by entering its address into an RSS reader, including Microsoft Outlook, which has an RSS reader built in.

WordPress has a built-in RSS ‘widget’ that lets you put an RSS feed onto your website from either your own or any other website.  I have added a feed from my own website into the left-hand sidebar.

Not only does this give a quick summary of my latest blogs, but users can copy the URL of the feed from the sidebar and add it to their own RSS reader, so they’re always up to date. Quite neat.

My feed is at:

It is worth mentioning that by default, WordPress only updates the RSS feed once every 12 hours by default, although I understand that when customising your Theme (not the Widget) you can usually change this.

Write/Read a file in Python

In this blog, I am simply wanting to write some data to file so that my program can read it during  a subsequent restart.

I’m running Python 3 under Raspbian on a Raspberry Pi computer, so I am only going to deal with that system.  I shall ignore the complexities of input/output as far as possible.

Python holds its variables in many different formats such as text, integer, floating point and binary.   I want to store some integer values from a list variable and then to read them back at some future time.

The first step is to tell the system the name of the file and the directory where I want to store it.   The directory can be on any resource that I can access from the Pi, but in this case I will store it in the Pi’s Downloads directory. I will store the full path and file name (motorPosition.text) in a variable called logfile, using the statement:


Now I need to open the file with the parameter ‘w+’ which means it is opened for writing, as shown below.  The file will be created if it does not already exist. If it does exist, any contents will be deleted when the file is opened.  (If I want the new contents to be added, then I need to use the ‘a’ (append)  parameter instead of w+.  Note that the open command can fail for a variety of reasons, but as we aren’t trapping  errors, this would make execution halt.

Next we create a string of text.  MotorPos is a list of integer values, so  the for loop takes each value from the list, converts it to a string and appends it to the string called text.  Each value is followed by a newline character (‘\n’).  This will mean that each value will be on a separate line in the file.

When all the values in the list have been added to the string, the for loop terminates and the next statement writes the text to the file.

The next line closes the file.  This is important as it ensures that the output buffer is flushed and the system resources are released.

file = open(logfile,'w+') # store motorPos on SD card
for line in motorPos:
  text = text+str(line) +'\n' #append values to string

file.write(text) # write string to file
file.close() # flush buffer and release resources

Next we are going to try to read the values back into the list, using a try structure to trap a FileNotFound error.  If the file is present, it is opened for reading and a for loop reads lines 0 to 6 into motorPos, converting each string value to an integer.  It prints the result and then closes the file. (For reasons best known to its authors, range loops stop when the parameter reaches the upper limit rather than when it exceeds the upper limit.)

However, if the file does not exist, the program takes the necessary action (in this case, it is simply to pass control to the next statement).  Without the try structure, execution would terminate if the file is not present.

try: # Use motorPos positions from file if present
   file = open(logfile,'r+')

   for line in range(0,7):
      input_text = file.readline() 
      motorPos[line] = int(input_text)
   print (motorPos)
except FileNotFoundError: # File not present

Input/output is error-prone on any computer system and it is important to trap errors, otherwise programs will often fail for reasons that are unfathomable to the ordinary user.

I’m sure that Python aficionados will point out more elegant ways of doing this, but this is the most obvious way that I could fathom.  The documentation is quite fragmented, so that many sophisticated features are quite obscure.

Editing the file

You can read the file using the Pi’s built-in text editor.  It will look something like this:


You can then edit the file, which could be used to supply starting parameters to the program.  However, you will only be able to save the updated file if you have the necessary permissions, generally if you are the owner.  I have found that if I let the program create the file, then I can view and copy the file but cannot save an update.  However, if I create the file first using the text editor, then the program can write to it and I retain permissions to update it.  This is just one of the complexities of input/output that i mentioned previously.  Of course, file permissions can be changed by the superuser, but that is another ball game.

Investigating a DRV8834 Stepper Motor Driver

The Barometer uses small car dashboard stepper motors for driving the dials, but it has never been entirely satisfactory as the dials easily lose position.  This seems to be due to random movement, especially because they sometimes flip backwards a notch at the end of their motion as described here: Inaccurate stepping.  I am now trying to get to the bottom of this, using the oscilloscope I acquired for the purpose.

The steppers are bipolar, meaning they have two coils which need to be energised in a certain sequence.  For the reasons mentioned here: Thinking about the electronics I bought DRV8834 low-voltage stepper drivers to operate the dials.

With these drivers, you only need to set the direction and supply the pulses.  There is a pin to wake or sleep the drivers when not used, which is great because the barometer only changes when the weather forecast is updated and the dial hands will stay in place when not energised.

The drivers can be set to move in full steps and fractional steps.  However, fractional steps required the motor coils to be kept energised, so I was intending to use full steps.

Connecting the Oscilloscope

My oscilloscope has four input channels: in essence, each channel measures the voltage on its input, relative to ground.  In common with most electronics, my circuit has the negative rail grounded, but to ensure a good ground connection, I connected the negative rail of the circuit to the ground connection of the oscilloscope.  (Oscilloscopes have a very high input impedance, so without a good ground, the signal will can be obscured by mains ‘hum’ and RF pickup, giving a fuzzy display.)

I selected a particular stepper and connected Channels 1 and 2 to opposite ends of motor coil 1, and Channels 3 and 4 to opposite ends of motor coil 2.  Using a short Python routine, I sent ten 2 ms pulses to the motor.  The pulses are preceded by raising a wake signal to the driver and terminated by dropping the wake signal.

Two coils being pulsed


Two coils displayed

The above oscilloscope display shows a sequence of 10 pulses on motor coil 1 (ch1 = yellow, ch 2= blue) and motor coil 2 (ch 3 = Green, ch 4 = Red).  Using 1 to represent high and 0 to represent low, we can see:

1 0 0 1
1 0 1 0
0 1 1 0
0 1 0 1
1 0 0 1
1 0 1 0
0 1 1 0
0 1 0 1
1 0 0 1
1 0 1 0

Looking at this sequence both coils are always energised, but in a sequence that rotates:
coil 1 north, coil 2 south
coil 1 north, coil 2 north
coil 1 south, coil 2 north
coil 1 south, coil 2 south

After the last long pulse, there is a short but strong pulse on 2 and 4, equal to 0101.  I’m assuming this is generated by the ‘sleep’ pulse, as the motors are then de-energised.

The horizontal scale represents time, at 5 ms per division so each pulse lasts for 4 ms. I had assumed that the coils would only be energised for the time that the pulse pin was held high, followed by an un-energised pause, but this is not the case: the pulse pin is held high for 2 ms, then set low for the 2 ms pause before the next pulse, but the coils remain energised in their current state until the next pulse.  This makes sense where microsteps are obtained by partial energisation of the coils.

The final step in the sequence will depend on how many pulses were sent.  If it is not a multiple of four, the motor could end up in some random end state such that it might not be able to respond to the initial pulse, as I don’t suppose the chip remembers the last state it was in.  So it could lose as many as three pulses on each movement, which over a few days would certainly throw it out.  The answer would be to round the pulses to a multiple of four.

I am also concerned as to why the voltage on ch1 is only about 0.5 V and on ch 2 about 4 V – this means coil 1 is energised more strongly in one direction than the other – but this is something for later.

So now I have something to work on!



My New Oscilloscope

I took the plunge and bought an ‘RS Pro’ RSDS1104CFL Digital Storage Oscilloscope.  As you could almost guess from the name, it is a 4-channel scope with 100 MHz bandwidth.  So far I’m just getting used to it.  The instruction manual is written in Chinglish.  For example, the introduction is headed ‘Accidence’ and tells me that there are four ashen buttons on the front face.  I can’t imagine what they were trying to say.

The first thing I’ve done with it is to investigate the waveform that drives a quartz clock movement with a ‘Sweep’ Seconds Hand.  This is one that moves continuously rather than in 1-second jumps accompanied by a loud tick.

This photo shows that it is driven by a ‘Lavet’ motor that is identical to that in a one-second stepping clock.  The difference is that there is an extra set of reduction gears, so that the rotor (the little round thing just below the copper coil) can turn more quickly.

I soldered a pair of wires to the terminal pads connected to the two ends of the copper coil.  They are underneath the coil so you can’t see the connection in this photo.  I connected these to the new oscilloscope and adjusted the display until it showed a steady waveform, see below.  You will see that the motor is being pulsed with a positive 1.5 volt pulse, followed by a rest at zero volts, followed by a negative 1.5 volt pulse and another rest at zero volts.

Using the measurement system built into the oscilloscope, we can see that the pulses are at a frequency of 8 Hz (8 pulses per second).  Each pulse, and each rest period, is of the same duration, 31.28 ms.  Since there are two pulses and two rest periods per cycle, the period of the waveform is 125 ms (one eighth of a second). [In fact, each pulse should be 31.25 ms long, so perhaps the rest period is marginally shorter, or maybe it is measurement error.]  So this motor is fed with pulses at 8 times the frequency of an old-style stepping clock, but has extra reduction gearing so that the seconds hand appears to rotate at a steady rate of once per minute.  Note that the gearing ratio is 1 to 8, which is of course a factor of 2, and so fairly easy to get from the same binary counter chip as the normal one-second pulse.  Indeed, it looks as thought the chip probably has an (unused) one-second output as well.

What is interesting to me is that the pulse duration is very similar to the 25 ms that I found to be optimum for my moon clock, and the pulse and rest periods are the same duration, again as I found optimum for the moon clock.  My 25 ms pulses will give 10 revolutions per second, which is slightly faster than the 8 rpm that this clock is using, but of course 10 is not a power of 2, therefore not so easy to derive from the binary counter.

I think that I can conclude that if you want to drive a Lavet motor fast, for example when setting to a particular time, then the pulse and rest period should be equal and that 25 ms pulse and rest periods are pretty close to the shortest which will work.  Note that although you might be able to use a shorter pulse with a higher voltage for the ‘on’ part of the cycle, the rotor must then continue to the next rest position under the power of its permanent magnet.  If you don’t allow enough time for it to rotate, re-applying power for the next (negative) pulse can actually make it return to its previous position. In this case, the rotor could vibrate between two positions and thereby lose its position.  And a steady rotational speed will help to maintain the inertia of the drive train and hopefully give less vibration.  Vibration of a large seconds hand could cause the rotor to spring backwards.

So the scope has already proved to be very useful and I will describe some of its workings in a later post.

Lost bookmarks in Google Chrome

I use my computer for work, for hobbies and for personal things, which means that I log into various services with different user names.    I also use Google Chrome as my main browser because I kept getting told that Internet Explorer wasn’t secure.

Anyway, have done some work tasks, which involved uploading videos to YouTube, I logged into my personal account and when I loaded Chrome, my Favourite bar and shortcuts had disappeared.  Whilst not an utter disaster – I keep a note of important things –  it was puzzling and I wanted them back.  I consulted some articles that said that Bookmarks were stored in a folder called

C:\Users\[myname]\AppData\Local\Google\Chrome\User Data\Default

Sure enough, the Bookmarks file was there.  So why was the favourites bar empty and the shortcuts gone?  I could see that the file hadn’t been updated for one day.  This must mean that the Bookmarks were being stored and read from somewhere else.

I search in Windows Explorer didn’t help but some probing around showed that in User Data there were other folders called Profile 1 and Profile 2.  The path to Profile 1 was:

C:\Users\[myname]\AppData\Local\Google\Chrome\User Data\Profile 1

Profile 1 had been used earlier in the day, so I looked there and sure enough there is a Bookmarks file much smaller than the one in the Default folder, so I copied the one from Defaults and pasted it into Profile 1 and Hey Presto! All the bookmarks and shortcuts have returned.

So, if you sign into Google as a new user, it may create a new profile and of course, without any bookmarks.  I should mention that I’d had a bit of trouble signing in as the new user – indeed I think my computer crashed – so maybe that cause Google to think I’d created a new account.

Hope this helps if your Favourites disappear.


How do IP addresses work

What is an IP address?

IP addresses are ‘Internet Protocol’ addresses and not to be confused with IP Ratings, which I discuss in a different post on here.

Each device on the internet must have a unique IP address.  Allocation of addresses is managed by the Internet Assigned Numbers Authority which devolves this to Regional Internet Registries.  But in this post, we are considering the technical workings of internet addressing, not the bureaucracy.

This is only intended as a brief over-view of Internet Protocols. I’m not trying to compete with the intricate detail available from an internet search.

Transport Protocol

The IP address is only one part of the internet system – the other major part is the formatting or ‘Transport Protocol’ of the messages.  There are two core protocols, TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).  TCP/IP is used by the world-wide-web, email and file transfer. UDP has fewer features for controlling transmission errors, but may be preferred in time-critical situations such as streaming TV or Voice-over-internet.

IPv4 vs IPv6

The present system is called IPv4 which provides 4.3 billion addresses, and whilst it was thought that system would never run out of addresses, the internet has proliferated so much that technically the system ran out of new addresses in 2011. Various bodges have been devised so that we can continue to use IPv4, but eventually we will have to move to a new system called IPv6.  This provides 340 trillion, trillion, trillion addresses, which theoretically will never be used up, but never is a long time, as the saying goes.

New modems and routers are capable of using IPv6, and in fact it has been in use since 1996, but the vast number of legacy devices means that IPv4 has to work in parallel possibly for decades to come.  Of course, most people use the Internet happily oblivious to the way that they connect to their favourite web site or streaming service.      They just type in the domain name of their favourite website, or more likely now, use an app which does it for them. Domain names are only a user-friendly way of getting the IP address of the web site, which the system finds by consulting a ‘Domain Name Server’ or DNS.

IPv4 uses a 32-bit number for the IP address, whilst IPv6 uses a 128-bit number.

An IPv4 address is typically written
Each group is a decimal number (8 bits long, called an octet)
An IPv6 address is typically written 1468:db9:0:4321:3:765:7:1
Thus each group is a hexadecimal number (16 bits long)

It should be noted that IPv4 and IPv6 are not interoperable, which complicates the move to IPv6.

Private Networks

As originally devised, the IPv4 network number was given by the first group (called an octet), giving only 256 different networks!  This problem was reduced by defining certain network numbers as ‘private’ so that within each private network the same range of IP addresses can be used.  For example, any IP number from  to is private. Most devices within a domestic network will use IP addresses within this range. Certain other number ranges are also private or reserved for special purposes.

Network Address Translation

Devices within a private network can only communicate with the external internet by using a system called Network Address Translation (NAT).  This changes the private IP address of a device to the external IP address of the router, which will have been assigned by your Internet Service Provider.  This has the further advantage of shielding devices within the private network from intruders, as an intruder cannot send messages directly to your computer or printer, for example. (Sadly, intruders still find ways around this.)


The IP address identifies the actual device, for example a computer.  But suppose you want to download a photograph from your cloud storage to your photo processing program.  The IP address will route the message from your cloud storage to your device but then it needs to get to the photo processing app and not to your email app.

This is achieved by  attaching a port, which is a 16-bit number, to the IP address. Specific ‘services’ (types of program) are identified by specific port numbers, but a range of port numbers is available for users to assign arbitrarily.    An app identifies which port it is using via an ‘internet socket’, which is part of the computer’s networking software.  This gives a one-to-one link between the internet and the app.  The port number is attached to the internet address and is typically written

This basically says that the message is intended for the app running on the device connected to the private network at address 123 and listening to port 80 (used by the world wide web, so probably a web browser).  The port number is a 16-bit number, i.e. ranging from 0 to 65535.

When using NAT, the router changes the port number on the outgoing message to identify both the device and the port on the private network. It reverses this when an incoming message is received.

Subnet Mask

You may also have come across the ‘Subnet Mask’, although you should rarely have to worry about this.  On domestic networks the subnet mask is always  Remembering that each group of digits represent 8 bits, basically, this says that that all the bits in the first three groups are for identifying the network itself.  The last 8 bits are not used to identify the network, so are available to define individual devices within the network.  In essence, you can have up to 256 devices on such a network. [255 in decimal is 11111111 in binary.  It is used as a ‘mask’ by applying a logical ‘and’, causing every digit in the address to pass through. By contrast, 0 in decimal is 00000000 in binary, so that a logical ‘and’ does not pass any part of that octet through.]

A similar system is used for IPv6, but in order to reduce the amount of writing, the length of the network identifier is described in terms of the number of digits, for example the block.

1468:db9::/48 says that the first 48 bits are used as network identifier, so it represents the block of addresses from
1468:db9:0:0:0:0:0:0 to 1468:db9:0:ffff:ffff:ffff:ffff:ffff
remembering that these are hexadecimal numbers [f represents the binary number 1111 or decimal 15].


I have mentioned Routers several times, and it is clear that they are complex devices fundamental to the operation of any network.  I will need to write a separate blog to describe their operation in any detail.

Internet security

Because many services (standard programs) use standardised port numbers, hackers often use automated software to ‘scan’ these ports on a computer to see if a standard app is listening on that port, and probing to see whether the app will respond to a malicious message that can give them unauthorised access.  ‘Firewall’ security software attempts to monitor and ward off such attempts.  If a particular IP address sends such a message, they will block it.  Because firewalls are so effective, hackers resort to fooling users into installing ‘viruses’ of many different types.  I have written about some scams in other blogs and users have become savvy at recognising them.  Successful hacks use subtle tricks to get the user to install malicious software.

In particular, I would warn against installing ‘free’ versions of paid-for software.  A criminal has already removed the legitimate protection from the software … and it is reasonable to assume that they wouldn’t be satisfied with just doing that.  Some websites (particularly those offering tempting deals) can suggest that you install apparently legitimate ‘helper’ add-ons when you visit them, but these can flood your browsing sessions with infuriating advertising and be extremely difficult to remove.


I hope this brief over-view helps to explain some of the workings under the bonnet and to help when you have to confront some of the more arcane terminology of networking.  I’m intending to add more as and when the opportunity arises.

What is a Network Switch?

You can think of a Network switch as a box that connects lots of Ethernet network devices together.  Ethernet communication sends information between digital devices connected by an electric cable.   The clever part is that each device needs only one cable to reach all the other devices on the ‘network’.  This means that a cable can be carrying information between several different devices at the same time.

To ensure that the correct recipient picks up the information, the sending device splits the information into short packets or ‘frames’.  Each frame has to contain the address of the sender and the address of the recipient, because several devices might be talking to the same recipient.   For example, two different devices might both be sending message to the printer, or receiving messages from the internet via your modem, and you don’t want these different messages to get mixed up.

The sender and recipient’s addresses are not usually permanent, but are assigned by your router to each device on your local network using a system called DHCP (dynamic host configuration protocol).  The addresses follow the standard IP or Internet Protocol. Ethernet networks are usually ‘local’ (abbreviation LAN), usually covering just a single building, but your modem will use a similar system when you send a message over the internet.  The only real difference is that a limited number of internet addresses are specially reserved to be used on your local area network and messages with these addresses are not sent onto the internet.

So a network switch connects all your Ethernet cables together.  But they’re not just a large electrical connector.  Each cable connects to circuitry that stores and tidies up the signal before sending it out again on each of the other lines.  The more advanced switches can convert the speed that the cable is using, so that a message that comes in at 1000 Mb/s (megabits per second) can be slowed down to go out along a cable to a device that can only work at 10 Mb/s.

The switch sends out each message to all the devices on the network (including returning it to the sender), and each device checks the address to see if it is meant for them.  If not, it just ignores the message.

How does the system avoid messages getting jumbled by everyone speaking at once? Before sending, it checks whether there are any messages already on the line and if so, it waits.  But two senders might start speaking at the same time, so the senders also listen to detect whether a collision has occurred (by checking if their return message is garbled) and wait a random time before trying again.

In small office and domestic networks, the devices each connect to the switch using an Ethernet Cable.  Both ends of the Ethernet cable are wired the same: it doesn’t matter which end goes into the switch.

These are the basics but more detail is to follow.

Wiring a CAT5 RJ45 ethernet cable

Why wire your own Ethernet cable?

To finish installing my security camera, I need to drill a hole through a 9-inch wall.  I happen to have a long 8 mm masonry drill, and some ‘CAT 5e’ cable, but there’s no way that an Ethernet (RJ45) plug will go through an 8 mm hole, so I will have to fit plugs on each end.

How do you wire an RJ45 plug?

Well if you think about it, in theory there will be a correct electrical connection as long as you connect the same colours to the same pins at both ends.  But that won’t be satisfactory for high-speed data transfer.  A Cat 5e cable contains 4 ‘twisted pairs’, i.e. eight wires, for a reason.  Each pair carries a different part of the Ethernet signal and each pair of wires is twisted together because this helps to reduce the pick up of electrical ‘noise’ from stray signals.  This includes pick-up of signals from the other pairs (called ‘cross-talk’), and electric fields from nearby mains cables, radio signals, noisy electric motors and the like.  So the first thing is to ensure that you keep the pairs together.  They are easy to identify as each pair consists of one wire with a ‘solid’ colour and one white wire with that solid colour striped along it.

Now, you might think that in the plug, the pairs would be laid in the sequence solid colour/ dotted colour side by side.  But they’re not.  It seems that the original sequence was arranged so that you could use plugs with just one pair, with two pairs and so on.  So the first pair occupies the central two pins, and the next pair takes the next two pins outside the central two, and so on.  This is called ‘USOC’ and is convenient where you often don’t need many pairs.  But it resulted in the ‘positive’ connections being on one side of the plug and the ‘negative’ connections being on the other side of the plug, which is not ideal for rejection of stray signal pickup, because the pairs of wires are separated in the plug.  So they came up with a system that kept the primary pair in the centre of the plug, the second pair straddling each side of the first pair (so the same as the original USOC wiring) and the other two pairs are kept together each side of the central two pairs.  Quite logical.  This is called T568-A and was used for ISDN (telephone) wiring.  Indeed a small (two-pair RJ11) jack plug can plug into an RJ45 4-pair socket and will work if it is wired for a telephone.

However, it discovered that there is less cross-talk between the data pairs when pairs 2 and 3 are swapped in the plug.  This is called T568-B.  Pair 3 now straddles the central pair 1, pair 2 is on pins 1 & 2, and pair 4 is on pins 7 and 8.  To ensure that the colours alternate across the plug, the white stripy one of the pair is first and the solid colour is second. Except for pair 1 where the solid colour is first.

The T568-B arrangement should now be used for new data cabling for this reason.

Ethernet Wiring Pairs
Ethernet Wiring Pairs (not the wiring order in the plug)

As an aside, going back to the telephone jack-plug days, in each pair the white stripy wire is the ‘tip’ and is positive, and the solid colour is the ‘ring’ and is negative.  USOC stands for ‘Universal Service Ordering Code’.  It was originally developed by Bell Telephones in the 1970s and used in the RJ-11 (two-pair) jack plug for example, to connect telephones to the network.

Which Ethernet pair is which?
  1. Pair 1 is blue
  2. Pair 2 is orange
  3. Pair 3 is green
  4. Pair 4 is brown

This does not follow the resistor colour code, sadly!

What are the pairs used for?

This depends on the system that they are connected to.  For Ethernet up to 100 Mbps, then using the abbreviation Tx for Transmit and Rx for Receive:

  • Pair 2 (orange) is Rx at the Modem and Tx at the computer
  • Pair 3 (green) is the Tx at the Modem and Rx at the computer
  • The other pairs are spare (but may be used for power)

As previously mentioned, the plugs at both ends are normally wired identically: the distinction between transmit and receive pairs is handled within the devices – the modem or switch can automatically detect which pair is Rx and which is Tx.  However, when connecting two computers directly by a single cable, they might both try to transmit on one pair and to receive on the other pair.  This won’t work, so you might need a ‘crossover’ cable to fix this.

For Gigabit Ethernet, all four pairs are used.  Each pair carries a bi-directional signal.  Gigabit Ethernet does not require a higher operating frequency – it transmits more data by using all four pairs bi-directionally (to send and receive). This needs a much more sophisticated modulation system.

It also means that you can’t mix Ethernet systems connected on a single cable –many Ethernet switches will revert to the slowest system on the network, although ‘smart’ switches contain additional electronics to ‘buffer’ data when connecting from a slow system to a fast system, and thus don’t slow everything down.  One of the easiest ways to speed up a network is to install a ‘smart switch’.

[I will need to write separately about network switches – these are clever boxes for connecting devices on the same network.]

Power over Ethernet (PoE)

Devices using the Ethernet will need some sort of power for their electronic circuits.  For peripheral devices that don’t need much power, such as security cameras and telephones, it makes sense to supply the power via the Ethernet cable.  For speeds up to 100 Mbps, the spare pairs can be used for power, but for Gigabit, power is supplied on the data pairs.    For this reason, care is needed when supplying PoE as this might cause an issue with an old device that doesn’t expect it.  The PoE voltage is 48 v and usually limited to around 10 w per device.  However, ‘intelligent’ switches can adapt between various modes of operation.

Types of Ethernet cable

There are several different types of Ethernet cable.  The most usual is UTP cable, standing for ‘Unshielded Twisted Pair’. FTP cable has each pair shielded by a metal foil.  It is also possible that the whole cable is shielded by braiding or a foil.  If the whole cable is unshielded, this is designated as U/UTP.  If each pair and the whole cable is shielded with metal foil, this is shown as F/FTP.  S/FTP is even better protected with a braided sheath around the cable.

CAT5e vs CAT6

Why bother with CAT5e when you can have CAT6?  The wiring of the cables is identical, but CAT6 is designed to have lower cross-talk and less signal loss, so it can work at higher frequencies.  A CAT6 cable often has an internal PVC separator to keep the pairs correctly positioned.   However a CAT5e cable is fine for Gigabit Ethernet.  A CAT6 cable can support 10 Gigabit Ethernet, which is more than common network hardware can use, although it might be more future-proof, especially in office environments.

It’s worth noting that you can’t always tell the effective transmission rate of a network – if the network is noisy or lossy, then it has to keep resending ‘messages’ and if this gets excessive, it will become too slow to be useful.  In this case, a slower transmission rate will be much more effective.  Some smart switches have network analysis capabilities which can help with troubleshooting network bottlenecks.

How long can an Ethernet cable be?

Generally speaking, a Cat5e twisted pair cable can run at 100 Mbps over lengths of up to 100 m.  Different cable designs or signal repeaters can be used for greater distances.

Installing a ‘Quoizel’ Outside Lantern

During the lockdown, at my request my builder installed two outside lights with PIR movement detectors, but they were just white LED floodlights, glaring and looking awful. I found the movement detectors were unreliable – staying on all the time or not coming on at all, or not detecting people approaching.

I really wanted some stained glass porch lanterns, but I couldn’t find any.  In fact, finding pleasant lighting at a fair price has been very difficult.  After hours searching the internet, I found some ‘Quoizel’ lanterns with Tiffany glass shades that I really liked, advertised by several companies.  Following enquiries, I found that like so many on-line firms nowadays, the companies don’t actually have them in stock, but ‘back-order’ them when you place an order.  I’ve had bad experiences with this on other orders, but having chosen a firm, I pressed them on deliveries, being aware that things could get difficult with the various lockdowns and the end of the Brexit transition period.  I was met with the despairing reply that ‘Nothing is Made in Britain these days’ and that these came from Poland!  I decided to chance it, as the firm was well-established, and to be fair they did arrive on the promised date some weeks later.  But ‘Made in China’ of course!  The Tiffany glass is very pretty,  though the lantern is made of pressed mild steel and the so-called ‘Valiant Bronze’ finish is nothing more than brown paint with streaks of red in it!   To be honest, I didn’t really expect anything else.

The 'Quoizel' lantern
The ‘Quoizel’ lantern

But the mounting system is dreadful.  Basically a thin pressed steel perforated strip with two steel captive bolts that protrude through two holes in the painted rectangular back plate.  This is very weak when you consider the swaying effect caused by wind loading in stormy conditions. There is also a bottom glass-retaining panel held on by two similarly fiddly nuts (that they quaintly call ‘mounting balls’).  It would be so easy to lose these or to drop the glass panel.

Worse, there is no cable inlet cut-out.  Since the instructions are specifically to mount it on a wall, do they expect you to channel out the wall? No way! I suppose I could have hacked it with a saw, but that would damage the paint, as would screwing the box to a very rough brick wall.

The back-box showing flying lead for electrical connection
The back-box showing flying lead for electrical connection

The electrical connection is to a flying lead terminating in a press-fit plastic box.  Not waterproof in the slightest.  Moisture has a habit of ingress into any enclosed space just through the ‘breathing effect’ of temperature rise and fall.  Moreover, there is no system to support the unit while you make the connections.  I had to lash it up with some wire.

When you read the small print of the installation instructions, you are told to ‘caulk’ around the mounting box and the wall, and also around the fixing nuts.  My guess is that it wouldn’t pass the electrical safety tests otherwise.

Plywood pattress showing the thin metal mounting strip supplied
Home-made plywood pattress showing the thin metal mounting strip supplied

I decided that the only decent way to mount the lanterns was to custom-make a couple of pattresses from some strips of plywood that were waste from another project, which I had to paint black for weatherproofing.  I cut a slot for the cable at the bottom of the pattress.  I will ‘caulk’ these to the wall, but it is too cold and stormy right now, as the sealant needs to be applied when the temperature is above 5 degrees. So I have filled the nuts with grease and hope this will hold the fort for now.

PIR detector

As to the PIR movement detector, I bought a LAP8461V which is mounted separately from the lanterns, allowing its position to be optimised without compromising the position of the lanterns.  The detector has adjustments for sensitivity to movement, for ambient light level (so it can be set to come on only after dark) and for on-time.  It also has a simple manual override so that it stays on (or off).

Schematic Wiring Diagram
Schematic Wiring Diagram

To give me flexibility in positioning the sensor, I have connected both lanterns to a weatherproof junction box which carries the supply and earth to all items.  They are connected to the neutral and switched live supplies. It would be possible to daisy-chain the supply from one lantern to the next, although the connector in the lantern would need to be changed as it won’t accommodate extra wires.   A 3-core and earth lead runs from the junction box to the sensor. The 3-core lead carries neutral, live and returns the switched live supplies, as the sensor requires a power supply in order to operate.  I used conventional two-way switch cable for this.

It is working very well and I’m delighted with the appearance. Only time will tell on their durability.

Installing a Reolink RLC-522 PoE IP security camera

The rationale for installing a security camera

I decided to install a security camera, partly because my Synology Network Attached Storage unit has software call ‘Surveillance’ and I thought I should try it out.   I’ve not bothered previously because the cameras seemed too expensive for my little office.

What is an IP camera?

An IP camera is a digital video camera that uses the digital Ethernet network to attach to other digital devices. It communicates using the Internet Protocol (IP).  With suitable software, it can be viewed from anywhere that the internet can be received, including over the mobile telephone data network.

Why a PoE camera?

Thinking I’d like another project amidst all these lockdowns, I decided to scout around for cameras.  I liked the idea of a ‘Power Over Ethernet’ camera as this would only require one cable to be installed.  I’m not that keen on a wi-fi camera as it still needs power. Running off rechargeable batteries is a hassle – and the Law of Universal Cussedness will ensure that they run down when you’re away from home. However, PoE provides only a few watts of power, so this will limit the capabilities of the camera.

Synology is compatible with a wide range of cameras including the Open Network Video Interface Forum (ONVIF).  This is a standard that defines a common interface for controlling security cameras, so any camera that complies with that standard will be fine.

Choosing a camera

I started by Googling security cameras and of course it came up with a vast number of them, with prices from tens of pounds to thousands of pounds. I whittled it down by selecting ‘Power Over Ethernet’ (PoE) cameras, but this only removed the cheapest ones.  I also set aside any that seemed to need any sort of cloud or subscription service.

A name that kept coming up  was Reolink, a completely unknown name to me.  But they seemed to have a range that was a sensible price (£50 to £60) and after looking at ‘dome’ and ‘bullet’ cameras, I chose the Reolink RLC-522 dome camera.  This is claimed to be an outside camera which is ONVIF compliant and with an IP66 rating, which means that it is protected against low-pressure jets of water from any angle, compared with IP67 which is proof against high-pressure jets of water.  Basically, it shouldn’t be subjected to driving rain.  I’m intending to place it under the eaves of the house, so that should be OK.  It has remote zoom, but pan and tilt is entirely manual, so it can only be altered from a ladder.

Setting up the infrastructure

So having acquired the camera, what next?  Should I get a PoE power injector (which feeds power down an ethernet cable), for about £20? My existing Netgear network switch is almost two decades old, but has been sitting there quietly neglected as it has never given any trouble.  But it’s a 10/100 Mbps switch whereas my fibre broadband supposedly has a gigabit capability.  So an appropriate time to upgrade.  I found the Netgear 8-port PoE 10/100/1000 Mbps ‘smart switch’ on offer for about £80 and decided to go for that.  The Netgear switch is cleverly designed so that each link can run at its native speed without slowing down the other links.  You can also prioritise traffic, for example to give video calls priority over web-browsing, although I have no requirement for that.  You can also monitor each link to detect the traffic consumption and cable problems.  I’m not using any of the management features, however, I just plugged in and let it run.

Of course, the disadvantage of PoE is that you have to have a dedicated Ethernet cable from the network switch to the camera, whereas if you use a power injector, you could have a wireless or powerline connector from the switch.

So was that it with the camera? Up and running ‘just like that’? No, not so simple.  Reolink supply utilities (Apps) for PC and Android (I imagine also for iOS, but I haven’t tried that yet.) You need to download them from the appropriate ‘Google Play’ or their website.  They installed without hitch.  I’ll describe the features in detail later.

First impressions

But the immediate thing is, What did I think of the camera?  In one sentence, it has greatly exceeded my expectations.

The first thing that has amazed me is that I can view the image in real time on my smart phone from anywhere!  I never expected this.  TBH I’m not quite sure how its doing it.  Although it’s an IP camera, the IP address is an internal one.  And BT don’t use fixed external IP addresses. This is something I will have to delve into.

Secondly, it’s all very well saying it has a 5 k resolution, but this is not the issue if the lens can’t produce a sharp 5 k image.  The image is good: I can read the number plate of a car about 30 m away.  I think it would be a struggle at 50 m.

Now I need to mount the camera externally and report back on more extensive tests.  I haven’t set up motion detection or recording yet – more on these later.