techBASIC Example Circuit

The example we are about to describe shows how to read data from climate sensors using techBASIC. The sensors can measure temperature, humidity, atmospheric pressure and UV intensity. The readings are sent to an iPhone or iPad, which runs a techBASIC program, over BLE. For BLE communications we will be using a BL600 module, which will surely be familiar to many Elektor readers. We will make use of two breakout boards: an Adafruit Si1145 breakout board for UV intensity measurement and a BME280 breakout board for the other three quantities. The whole thing will be powered from a CR2032 coin cell: in my prototype one cell has already given about ten months of continuous operation.

The circuit is shown in Figure 1. If desired, a ‘USB to UART converter’ can be attached at JP1 to allow programming and debugging of the BL600 module. JP5 allows configuration of the operating mode of the BL600: the details have already been discussed comprehensively in Elektor. In our application the jumper must be fitted in the ‘AUTORUN’ position. One special feature is the button S1: this, in conjunction with the software, is the key to the low power consumption of the device. Normally the device is in what is called ‘deep sleep mode’, where the current draw is very low indeed. Only when button S1 is pressed will the device wake up, read the sensors one by one, and transmit the readings over Bluetooth. After about two minutes the BL600 returns to deep sleep mode. The software for the BL600 ($autorun$ is available for download from the Elektor website [4].

fig 1 4 techBASIC Example Circuit

07. February 2019 by sam
Categories: Apps | Comments Off on techBASIC Example Circuit

What can techBASIC do?

As you might have guessed from the name, techBASIC has very many similarities to the old-school BASIC programming language. However, when it comes to the range of available functions there is no comparison to the original BASIC. The techBASIC Reference Manual [3] offers a complete description of what is available: as well as the usual mathematical and string functions (such as LEFT$), techBASIC sports a number of functions to support event handling. For example, it is possible to have a program respond to the press of a button on the screen. There is also a range of functions to support BLE and WiFi, allowing communication with the outside world. BLE and WiFi are also the only two communications protocols approved by Apple: this is not the case for USB or Bluetooth 2.x. Thus BLE and WiFi are the two wireless protocols of interest if we are looking at connecting to external sensors for applications such as IoT or home automation.

WiFi is supported using the Comm class. Using these functions it is very easy to create a simple HTTP client running on the iPhone or iPad. As one example, I have developed code (OnOffTemp.txt) that allows you to control a boiler remotely via an ESP8266 HTTP server. Listing 1 shows the part of the program responsible for dealing with inputs from the user interface; the complete program can be downloaded from the Elektor website [4].

There are also functions provided in techBASIC to read values from the device’s internal sensors, such as its accelerometer and its GPS receiver. There are graphics functions that allow you to plot complex curves and other graphical elements, but we will not look at those in detail here.

Much more interesting to us (the iCing on the iCake?) is the comprehensive set of functions for building graphical user interfaces (GUIs). With just a few commands it is possible to create an impressive array of widgets just like those used in any commercial application: buttons, sliders, date selectors and so on. There is a demonstration on the website of the makers of tech-BASIC that shows all the available widgets on the display of an iPhone or iPad.

07. February 2019 by sam
Categories: Apps | Comments Off on What can techBASIC do?

The techBASIC app

Even if all you want to do is use your smartphone to control an external device and provide a simple and straightforward user interface (plus the specific code necessary to drive your circuit), using Xcode is a lot of bother. An interesting alternative is the ‘tech-BASIC’ app by Byte Works [1].

The entire integrated development environment (IDE) is contained within its own app, which is available as a demo version (called techSampler), and as a full-featured version for around US$20, downloadable from the app store [2]. The demo version only allows built-in demo programs to be executed: is is not possible to write your own programs or modify existing ones.

When the app is launched all the available programs (or demos) are displayed in a directory. It is possible to run or edit programs from this listing. It is also possible to convert a finished program into a standalone app, which requires the techBASIC App Builder program (priced at US$49) and a Mac computer on which the app is built. However, for most hobbyists this is an unnecessary over complication.

Developing programs on an iPhone is far from ideal because of its small display. An iPad with an external keyboard makes a much better platform for writing code, whether the target device is an iPad or an iPhone. It is of course only necessary to purchase the techBASIC app once.

07. February 2019 by sam
Categories: Apps | Comments Off on The techBASIC app

FPGA-DSP Board for Narrowband SDR

When the push-to-talk (PTT) signal on header K7 is pulled logic Low (see Part 1, Figure 2), the FPGA goes into transmit mode. A CW carrier can then be generated with the DDS block in the FPGA, through the DAC, by pulling the KEY signal Low.

In addition, the Weaver blocks are implemented in such a way that they can be used “backwards” to form an SSB modulator. When USB or LSB is selected and PTT pulled Low, the audio at the microphone input is sampled, compressed and low-pass filtered, and then fed to the modulator. This works very well, but needs external filtering due to the difficulty of up-sampling from the low KSPS rates in the audio and modulator to the high 120 MSPS rate used by the DAC. The two spectrum plots in Figure 1 show transmitter signals generated in the 14 MHz (20-m) amateur radio band. The graph on the left is a CW signal generated directly by the DDS. The discrete noise components, spurious responses or “spurs”, around the carrier are around −70 dBc (i.e. they have an amplitude of −70 dB relative to the carrier) and originate from clock signals inside the FPGA. This signal may be amplified to, say, 5 to 10 watts and transmitted while keeping interference risks low.

The spectrum on the right of Figure 1 shows the output from the Weaver SSB modulator when fed with an audio signal. Here the internal clock signal residues are much stronger, and strong alias products due to the modulation are visible too. With these unwanted signal components now as strong as −30 dBc, one should not simply amplify and transmit; filtering is required.

Apart from the spurious/alias products from the modulator there are also other limitations to be aware of. These stem mainly from the fact that the non-modulated signals generated by the FPGA through the DAC are not as clean as one would want ideally. This has two reasons mainly:
1. The clock for the DAC, generated at 240 MHz and then divided by two, is created by the internal PLL circuitry of the FPGA. This master PLL clock signal is not ideal with respect to phase noise, i.e. its output has a certain amount of jitter and is not a perfect square wave with an exactly determined frequency and phase.
2. There will also be discrete spurious frefilquency components in the output. These have different origins, like unwanted coupling between different clocks, or quantization effects in the DDS blocks and lookup tables due to word-size limitations in calculation steps, memory and DAC resolution. Some of these parasite signals are visible in the unmodulated spectrum in Figure 1 (left graph).

fig 1 3 FPGA DSP Board for Narrowband SDR

07. February 2019 by sam
Categories: Projects | Comments Off on FPGA-DSP Board for Narrowband SDR

Advantages of the Würth Elektronik loss model

• The empirical data is based on real-time measurements, enabling accurate determination of losses for any given duty cycle.
• The model works over a wide frequency range (10 kHz to 10 MHz) with high accuracy because the constants of the power equation, including the magnetic modulation, have been determined over a wide range.
• Slight changes in the core material and winding structure are also taken into account.
• Also valid for components composed of more than one material.
• Allows precise determination of losses with iron powder and new metal alloy materials.
• Valid for any desired core shape and winding structure.
• Includes AC winding losses.

04. February 2019 by sam
Categories: Labs | Comments Off on Advantages of the Würth Elektronik loss model

Disadvantages of the Steinmetz model

• Dependency on empirical data from the core manufacturer: manufacturer data is required to generate the core loss diagrams. Manufacturers of passive components have no control over test setups.
• Low accuracy with pulse and triangular waveforms because the core loss diagrams are based on data obtained with sinusoidal excitation.
• Due to errors in parameter conversion, modified Steinmetz models only work well with a 50% duty cycle and within a limited frequency range.
• Limited to components made from specific materials or originating from specific manufacturers.
• Due to the high complexity of estimating the magnetic path length, estimation of core losses for iron powder and metal alloy materials using existing models is difficult and subject to strong deviations.
• Losses from skin and proximity effects also occur in windings due to time varying magnetic flux density. The previously described approaches do not take
AC losses in the winding into account.
• Estimation of losses is not possible for components composed of more than one material.
• High complexity of setups necessary to acquire empirical data with sufficient accuracy.

04. February 2019 by sam
Categories: Labs | Comments Off on Disadvantages of the Steinmetz model

REDEXPERT: Simulator for Inductive Components

Many electronics designers occasionally have doubts about how to design a switching power supply. With suitable ICs now available for nearly every purpose, along with online design aids and simulators from semiconductor device manufacturers, you might think this is no longer a major issue. But inductive components can still be difficult due to their complexity. Fortunately, inductive component specialist Würth Elektronik eiSos has developed a new online tool called REDEXPERT which simplifies designing with inductive components.

The main sources of power losses in switching power supplies are power semiconductors and inductive components. Losses in inductive components occur in the core and in the windings. Accurate determination of these losses is more important than ever for reliable circuits with high efficiency. Complex measurement setups may be necessary to estimate core losses in switching power supplies, but there is no assurance that these estimates will be reliable for specific applications. In the early days, core losses were calculated using the Steinmetz equation [1] or modified forms of that equation. However, this equation is only reliable under specific conditions and for specific materials. Würth Elektronik eiSos has therefore developed a new model based on the current state of the art, which allows core losses to be determined reliably and precisely. This model is implemented in the new REDEXPERT tool [2].

REDEXPERT is a new online tool from Würth Elektronik for selecting and simulating inductive components, which simplifies the process of selecting a suitable storage inductor. It is a convenient and effective tool (Figure 12) which facilitates fast comparison and selection of inductors. First you enter the input and output parameters for the desired topology, and then REDEXPERT calculates the inductance value and displays a list of suitable components.

Würth Elektronik offers a wide range of storage inductors for all possible applications, so it should be possible to find a suitable inductive component for virtually every application after entering the parameter values. The precise AC loss model integrated into REDEXPERT dramatically simplifies the critical and normally complicated process of calculating the AC losses of inductive components. Thanks to accurate calculation of the overall AC loss, the tool is also suitable for temperature estimation.

04. February 2019 by sam
Categories: Labs | Tags: | Comments Off on REDEXPERT: Simulator for Inductive Components

MiniPro TL866A Programmer

There are currently many components that can be programmed using a cheap interface connected to a USB port on the PC. The first question we should therefore ask ourselves is if such a universal programmer is still needed these days.

There are plenty of designs where an ICSP connector would be hopelessly in the way, and there have been many times when the connector has been inadvertently left out in a prototype. Furthermore, some settings (fuses) in microcontrollers can’t be changed via the ICSP connector. The MiniPro TL866A, made by the Chinese company XG Autoelectric [1], has a standard 2×20 pin DIL ZIF socket, as well as an ICSP connector. It can therefore replace a Microchip PICkit or make the Atmel AVRISP redundant. The TL866A can be used to program over 14000 different devices, from the most recent microcontrollers to the most archaic (E)PROMs. It can also be used to test for the correct operation of logical ICs (CMOS and TTL), DRAMs and SRAMs.

Although the accompanying Windows program looks a bit oldfashioned, it does the job very well. However, it can sometimes take a while to find a particular function. A positive aspect of the program is that it supports ‘projects’, which are files that contain the configuration bits of the microcontroller as well as its memory contents.

During my first attempt at programming a microcontroller with the TL866A, I had problems with the settings for the fuses (configuration bits) of the ATTiny85. There appears to be some confusion as to what it means when certain tick-boxes are set: Is the option then enabled or disabled? Will the bit be programmed as a ‘0’ or a ‘1’? For one bit it was the exact opposite to how the software of the Elnec programmer behaved, which we normally use in the Elektor Labs. Fortunately, we were able to use the MiniPro software to inspect the resulting configuration words in hexadecimal, which turned out to match the values in Atmel’s datasheet. When in doubt, this method can be used to verify that the bits are programmed to their desired state.

Linux software for this programmer can be found on the MiniPro TL866 Community Wiki [2]. This site also contains other information that could prove useful when you’re using this programmer.

fig 1 2 MiniPro TL866A Programmer

04. February 2019 by sam
Categories: Reviews | Comments Off on MiniPro TL866A Programmer

GoNotify, a Flexible IoT Sensor Interface

Some time ago I wondered what the requirements for a connected device would be. First off, it had to be wireless, meaning it’s battery- or solar-powered. This in turn implies that it should consume as little energy as possible; hence it must be a low-power design all over. Furthermore, the system should be simple and low cost, and there should be no connection costs. Finally, the device has to be flexible and easy to develop with. Wi-Fi fits almost perfectly what I was looking for and the popular Wi-Fi chip ESP8266 makes this technology accessible at low cost. The low-power side of things, on the other hand, might be a challenge. With all this in mind I set out to work.

fig 1 GoNotify, a Flexible IoT Sensor Interface

The design that I came up with consists of four major blocks (Figure 1):
• for Internet connectivity a cheap ESP-01S module containing the ESP8266 Wi-Fi microcontroller;
• an ATmega328PB to handle the sensors;
• a USB serial port for programming and debugging;
• a power module consisting of an LDO and a step-up regulator.

fig 1 1 GoNotify, a Flexible IoT Sensor Interface

04. February 2019 by sam
Categories: Projects | Comments Off on GoNotify, a Flexible IoT Sensor Interface

The Quality of Audio Connectors

The connector needs of professionals and consumers never stop evolving The manufacturers develop products that are ‘better performing and oriented towards the future’ which take account of new functions and electrical constraints, from EMC (Electro-Magnetic Compatibility) (linked to the nature and speed of the signals) and mechanical (increasing number of pins, different sizes for fixed and mobile use). After the 3-pin DIN and the 1-pin RCA/Cinch, here comes the era of the 29-pin HDMI connector which also supports video and Ethernet.

Whether analog or Digital, the quality of the connectors is paramount. With analog, you can sense a problem coming (reduced quality, noise). With digital, it is more subtle, because it can pass very quickly from ‘everything is fine’ to ‘nothing works’. The signal rates (and associated clock frequencies) used give rise to problems of impedance, length and parasitic capacitance of cables and connectors. Ordinary cable and any old connector won’t cut it any more; it’s imperative to use cable with a matched impedance (50, 75 or 110 Ω for example) and suitable connectors. A digital symmetric AES link [1] needs a 110 Ω impedance cable and XLR connectors, and a digital asymmetric S/PDIF link needs a 75 Ω cable with BNC 75 Ω connectors (but often RCA/Cinch on consumer equipment, because they’re cheaper). With HDMI, TMDS streams [2] pass over twisted pairs with a differential impedance of 100 Ω. With a theoretical speed of 48 Gbit/s of HDMI 2.1, the quality of the connectors (and indeed the cable) becomes even more critical!

A consumer connector has to be cheap; a professional connector has to be reliable. In fixed pro audio (recording studio, broadcast site) the lifetime of the links has to be long. And ageing of the cables and connectors must not cause problems. Cables or connectors of bad quality will degrade quicker over time (oxidization and/or degradation of dielectrics). In pro mobile audio (events, concerts), the connectors must not fail when they are walked on, they must stay locked on to equipment, and above all the wires must stay connected to their pins when a foot gets caught in the cable. To sum up, the connectors must be robust, and that’s why you choose a metal-bodied connector rather than a plastic one. As an aside: even for amateur use, choose a metal bodied connector (including DIN and RCA/Cinch), because a conductive body connected to ground gives better protection against parasitics. For resistance to disconnection, several techniques exist: tongues that fold on to the cable, shells that are screwed together, or even jaws with teeth. But be careful with the last two solutions, these methods of fixing the cable only really work for the right diameter of cable!

29. January 2019 by sam
Categories: Labs | Comments Off on The Quality of Audio Connectors

← Older posts

Newer posts →