The blog of a dedicated radio amateur and electronics enthusiast

"Having fun on the air and in the workshop - communicating and creating"

08 October 2023

Remotely operated Antenna Tuner - in use

In my last post I described the system I have recently put together to remotely tune ➿ the antenna 🗼 I use for the MF 630m ( medium wave) amateur band. The images below show the outdoor parts of the system now deployed and in operation with the antenna.
Base of antenna showing tuner, coil, element & support
A usb rechargeable power-bank 🔋 provides power for the remote unit and motor. I made a protective cover ( yellow object ) for the stepper-motor to keep it dry.

Container cover removed to show remote unit & power-bank

While trying it all out for the first time when using my transmitter I was able to re-tune 🔁 the antenna as I changed transmission frequency, from the operating position indoors.  All parts of the system are performing well. I am very pleased with the results.

22 September 2023

Remotely operated Antenna Tuning

My inverted-'L' ( end-fed Marconi ) type antenna🗼for the 630m 📻 amateur band uses a variometer tuned loading coil ➿ at its base, which has to be adjusted to maintain antenna resonance when the transmitter changes frequency. Manual adjustment has always been possible; but never convenient as the coil is situated 35m from the house. So I devised a method for 'tuning' the antenna remotely, building on my experience using  LoRa and BluetoothⓇ 📶 in some previous projects.
Indoor unit (display active), remote unit, stepper motor & coil
The setup comprises an indoor unit for the LoRa transceiver and BluetoothⓇ server and remote units consisting of  another LoRa transceiver and stepper motor. TTGO LoRa Esp32 micro-controller boards are used.
App "Step_Match" opened
My custom App "Step_Match" for a smart-phone📱 connects to the server "Step_Tune" with BluetoothⓇ. Each time 'Step CW +' or 'Step CCW -' is tapped a command is sent to the indoor unit, then via LoRa to the remote receiver to drive the motor shaft clockwise or counter-clockwise by 5ͦ . Cumulative motor steps, number of clicks and degrees of rotation, ( relative to a half-way position at zero ), are updated. The motor actually makes 28 steps for each 5ͦ of shaft rotation, 2048 steps per revolution at a speed of 2rpm. 
The 3-D printed 3cm diameter toothed wheel  ( 24 teeth ) fitted to the motor shaft engages with a 4cm diameter toothed wheel ( 32 teeth ) on the variometer coil adjustment shaft; this gear ratio being 1/1.33. So the variometer shaft rotates 3.75ͦ per click. A initial check just holding the motor in position confirmed that it developed enough torque.
I temporarily placed the 'remote units' outdoors next to the antenna. The 868MHz LoRa link worked perfectly. Everything is now ready for use with the antenna. 
 
LoRa = Long Range ( a low bit rate, low power, long range digital wireless data technology ).
🗼 An image showing the original antenna was posted on 11 September 2012.

10 August 2023

True RMS Voltmeter⚡

The digital multi-meter ( DMM ) in the electronics enthusiast's workshop may be specified as measuring the actual RMS voltage on its AC voltage ranges; but that may still only apply to sinusoidal voltage waveforms, or non-sinusoidal are displayed as if sinusoidal. Actually, my DMM only measures the less useful average value, which is not the same. *
Back in 2017 I designed a voltmeter capable of measuring the true RMS voltage of signals having complex waveforms, ( not just sinusoidal ), up to frequencies of several MHz, and even superimposed on a DC level. Central to my voltmeter's operation is a highly accurate RMS-to-DC converter chip. I had made several of them with different display back-lights; orange, green & white.
Measuring a 5V 100KHz square-wave, 12% duty cycle, CF 2.86
I decided to look again at the voltmeter to see if any improvements would be beneficial. Since 2017 I have changed the development tools I use for my embedded projects several times, which would rule out making alterations to the firmware. 
First I fitted a 3-D printed front panel; see image below.
Measuring the output voltage of a 3V DC precision source
I also carried out some comparative tests together with my DMM and oscilloscope using:
(1) a 400Hz sine-wave and (2) a 400Hz square-wave, having a 27% duty cycle.
The results suggested that my DMM is AC coupled and employs a full-wave rectifier circuit for sine-wave voltages. Surprisingly it is almost as accurate as the RMS voltmeter for measuring square-wave voltages. 

* Specification of my own 3½ digit DMM : average value of sine wave, frequency range 40Hz-400Hz
RMS = Root Mean Square ( the RMS value is a particularly useful quantity as it relates directly to the power ['heating effect'] of the signal )

   

16 July 2023

Mobile App User Interface for a DDS Module 📶

I previously featured a DDS module based on the Analog Devices AD9850 32bit device on 4.1.2018. The method I used then to generate an output frequency from the DDS board involved an SPI-USB protocol converter dongle with pc terminal software.
Another method I recently devised uses a micro-controller and my custom "DDSTerm" App installed on a mobile phone📱. As before SPI protocol is still needed to upload the tuning word, phase and power control bytes to the DDS configuration register and this operation is now performed by the micro-controller. But instead of software running on a pc, the App is now used to generate the bytes required, which are then sent using BluetoothⓇ Low Energy ( BLE ) to the micro-controller. An ESP32 micro-controller has SPI peripherals and built-in BluetoothⓇ, and so was used.
App 'DDSTerm_v1.06' opened
The micro-controller functions as a BLE server 'AD9850_DDS'. The App on the client device scans for this server and connects to it. The desired frequency, phase and power mode are entered. Clicking "Generate" produces the required 5 bytes ( hex 004831C8C4 in the image example ), and clicking "Send to DDS" sends the bytes using BluetoothⓇ to the ESP32, which then uploads them to the DDS board on the SPI.  An output is generated on the selected frequency, e.g., 137.7KHz. Clicking 'PWR DWN' puts the DDS in 'sleep' mode. The two yellow LEDS ( see image below ) are toggled on/off with GPO1 & GPO2. The last uploaded frequency is saved and automatically recalled whenever the App connects.
The hardware setup during development & testing
The hardware ( image above ) consists of an AD9850 DDS module board bought very cheaply on-line and mounted on my test jig from 4.1.2018. Inside the 3D-printed blue and yellow enclosure is the ESP32 micro-controller development board which is a typical one having the ESP32-WROOM-32 processor. Both the DDS and ESP32 are 3.3v supply and logical level compatible. No level shifting is therefore required when interconnecting.
I also use DDS modules fitted with the AD9851 chip; see 2.11.2017. The only changes to the App, ( other than selecting the correct device ), would be a 'x6 Reference Clock Multiplier' checkbox, and extending the frequency range of the 'slider control'; both optional.

DDS = Direct Digital Synthesis.
GPO = General Purpose Output
SPI = Serial Peripheral Interface ( 3-wire bus ). 
 

09 March 2023

Multi-Sensor Air Quality Monitor

I have completed my project to modify a domestic air-quality monitor, ( AQM ), which retails for GBP15 in the UK, and turn it into a multi-sensor AQM. See also 5, 9 & 12 February.
The original AQM only has a Cubic PM1006 particulate matter sensor. The colour of an illuminated indicator changes, ( green, yellow or red ), with the PM2.5 ( 2.5 micron ) particle concentration in the air. I have retained this feature in my modified versions.
I fitted a 'D1 Mini ESP32' micro-controller board to read the sensors and send the measurements to a display for viewing. The display module is a 128x32 pixel OLED. The sensor types I chose are the CCS811 ( CO2 & TVOC ), (  see also 20 January ), and the AHT20 ( temperature C & relative humidity % ).

Internal view showing position of the main components

I have made two versions of the multi-sensor AQM, suited to my intended use based on which sensors I fitted and with a display to give a direct readout.. The image above shows the internal layout of the PM1006/CCS811 version.
The PM1006/CCS811 version displays data for PM1, PM2.5, PM10, CO2 & TVOC. I shall be using this version in my workshop where TVOC could occasionally be present.
The PM1006/AHT20 version displays data for PM1, PM2.5, PM10, temperature and relative humidity. I shall deploy this one in the kitchen primarily for the particulate matter measurements ( presence of smoke, flour etc ), and also the humidity.
So, in two places at least, I'll have some knowledge of how clean the air is that I'm inhaling.
I've also written software for a third version with just the PM1006, ( as in the original AQM ), only displaying data for PM1, PM2.5 and PM10. It would just be a simple matter of uploading the software to either of the other two versions.
Version PM1006/CCS811

The 'D1 Mini ESP32' micro-controller board has built-in wifi. This opens up the future possibility of integrating the multi-sensor AQM into a 'smart home' network. 
 
TVOC = Total Volatile Organic Compounds ( paint, solvents etc ).
 
 
 
 
  
  

12 February 2023

Displaying PM2.5 data from the PM1006 sensor

After I had received the raw data, ( see 9 February ), I then wanted to connect a display module to show the PM2.5 particulate matter concentration value, which would also be a very useful addition to the domestic air quality monitor.
The setup in use while I was developing the software is shown in the image below. The setup comprises an ESP32 microcontroller development board, 128x64 pixel blue OLED display, control board and PM1006. The serial data connection to a hardware UART peripheral on the ESP32 required a resistive level shifter because the PM1006 outputs 5 volt logic high level, whereas the ESP32 UART input is for 3.3 volt and is not 5 volt tolerant. 
PM2.5=47ug/m3, (top-left) note the resistive level shifter
Each time the PM1006 is polled the software filters those bytes received by the UART that I had previously identified as containing the PM2.5 information, does the conversion to ug/cubic metre and sends the result to the display module. The software also selects the header and checksum bytes and uses them to detect any data errors to prevent corrupted data being displayed.
Now it is time to think about re-assembling the air-quality monitor. I'll need to choose a smaller micro-controller board and a different OLED display module to fit in the available space. I'd also like to fit additional sensors for measuring air temperature, relative humidity, TVOC and CO2.
  

09 February 2023

Reading PM2.5 data from the Cubic PM1006

Continuing the topic of the last post I can now decode the PM2.5 concentration data from the PM1006 particulate matter sensor. 
I dis-assembled the air-quality monitor, ( AQM ). Inside is an electronic circuit board and the PM1006. To access the data I connected the 'REST' test-pad and 'GND' test-pad on the circuit board to the 'RX' and 'GROUND' respectively of a 'USB-UART' protocol converter dongle. The dongle connects to a pc via usb in order to display the data using a serial terminal program.
(L) USB-UART dongle, (R) AQM control board & PM1006
The PM1006 data sheet states that the serial data format is 8 data bits, 1 stop bit, no check bit and speed 9600bits/second. When I had configured a serial terminal program to match, I was able to view the data bytes. 
I have observed that the control board switches on the sensor's fan, then polls the sensor 7 times. Each time 20bytes of data are output on the 'REST' connection. This process takes about 15 seconds, after which the fan is switched off for 20 seconds before the cycle repeats.
7 x 20 bytes (columns) of data displayed in hexadecimal form
The PM1006 data sheet also states that after 3 bytes of header, ( always 16 11 OB ), there are 16 bytes of data ( data fields DF1-DF16 ) and a checksum byte at the end. DF3 and DF4 ( columns 6 & 7 counting from the left ) contain data relating to the PM2.5 concentration. The actual concentration is found first by converting the hex to decimal and then using the formula ( DF3 x 256 ) + DF4. So '00 26' gives 38ug/cubic metre and '00 25' gives 37ug/cubic metre. The front of the AQM was illuminated yellow at the time; 36-85 is medium concentration and air quality 'OK'.
I extinguished a burning match near the PM1006. DF3 and DF4 peaked at 02 & 81 corresponding to PM2.5 of 641ug/cubic metre. The front was illuminated red.
The next step will be to parse the raw data ( in the image above ) in software and fit a display module to display the actual PM2.5 concentration in a 'user-friendly' form. That's a task for a micro-controller and the topic of a future blog-post !
 
Notes: 2 hex digits = one byte, and UART = Universal Asynchronous Receiver Transmitter. 
 
  

05 February 2023

Particulate Matter Detector

I've recently been using several different gas sensors, some of which I have already mentioned. But I also wanted a 'Particulate Matter' ( PM ) sensor to detect microscopic solid particles in the air, particularly as I am frequently sneezing in my work-area ! Realising that such sensors are also used in home 'air-quality' monitors, I bought a very cheap one for about GBP15 to take apart. Refering to the image below, green indicates 'good' air quality; PM2.5 between 0 and 35 ugms/cubic metre.
The domestic air quality monitor I bought
I removed the sensor from inside and identified the type as PM1006 made by Cubic. Searching for a data-sheet for more information, it is described as a LED Particle Sensor for detecting particles ranging in size from 0.3 to 10 microns. Especially interesting was to read that it has a built-in micro-controller which directly outputs the particle mass concentration in digital form, ( units of micro-grams per cubic metre ), as a serial bit stream at 9600bits/s which I should be able to hack in order to decode the data and display the concentration value. In fact a permanent numerical display would be a useful addition to the air quality monitor to supplement the changing colour of the visual effect.
Next time I'll be describing how I hacked the data.

micron = one millionth of a metre.
PM2.5 = Particulate Matter 2.5 micron ( reference particle size adopted internationally in particle concentration definitions of air quality ).
 
 

 

20 January 2023

CCS811 VOC & CO2 Gas Sensor

Until just recently I was using analogue gas sensors, ( see previous post 16 January ). I have now turned my attention to digital gas sensors, from which the measurement data are already in digital form.
I am experimenting with the CCS811 sensor which has a I2C digital interface, ( 2-wire bus, clock and data only ). The CCS811 measures the concentration of CO2 ( carbon dioxide ) and TVOC ( total volatile organic compounds, which become a gas at room temperature ) in the air in ppm and ppb respectively which would be useful in giving an indication of air-quality in a closed workshop environment.
I connected an ESP32 micro-controller development board to the CCS811 circuit board and also to a I2C 128x64px blue OLED display in the corner of an already densely populated solderless breadboard.
( top-left) Mauve coloured CCS811 circuit board
The measurement results being displayed were obtained in my basement workshop. There is an established air-quality index called the 'TVOC Index' which is derived from the TVOC ppb concentration. Ppb between 0 & 220 corresponds to a TVOC Index of between 0 & 50 and an 'Index Category' of 'Good' air quality. I am pleased as I spend a lot of time in the basement.
 
I2C = Inter Integrated Circuit
ppm/ppb = parts per million/billion
  

16 January 2023

Multi Gas Detector

The 'MQ-' series of gas sensors comprises many different types, and each one is sensitive to one or more specific gases. They are analogue sensors meaning that a voltage is produced that varies with gas concentration. They are also cheap. I bought several MQ-135 and MQ-4 types for use in simple multi gas detectors.
The varying output voltage from the sensor was connected to a 12bit analogue to digital converter on an ESP32 micro-controller development board and the various gas concentrations in the air in the workshop were displayed in parts per million ( ppm ) on a 320x240px colour display.
The MQ-135 sensor is sensitive to the following gases: carbon dioxide, alcohol, carbon monoxide, toluene, ammonia & acetone.
The MQ-135 sensor is near the bottom-left corner
The MQ-4 sensor was used in another multi-gas detector to detect LPG, methane, carbon monoxide, alcohol & smoke.
LPG = Liquefied Petroleum Gas
 

06 January 2023

Touch Screen Displays

Nowadays it seems almost obligatory that electronic gadgets have a touch screen display user-interface.
The particular display type I have been trying out recently is a 2.8" 240x320 pixel TFT LCD touch panel display with SPI and using the ILI9341 driver chip. On the back is an SD card slot. Cost when purchased was just under GBP11.
The display and an ESP32 micro-controller development board, ( with my code uploaded to it ), were mounted on a prototyping board and connected up. The ESP32 micro-controller has two built-in sensors; a temperature sensor which measures the CPU temperature, and a Hall-Effect sensor which responds to magnetic fields. Either cpu temperature or magnetic field data can be displayed separately in real-time by tapping on a displayed 'button', which is then highlighted in green.
The CPU temperature measurement has been selected
Although both measurement values could easily have been displayed together, I now have my ready made code to import into future projects which really would benefit from a touch screen.
( SPI = Serial Peripheral Interface, 4-wire bus )