App note: LED diagnosis in automotive applications

an_osram_AN059

App note from OSRAM about different approaches on LED string diagnostic in automotive. Link here (PDF)

One requirement especially in automotive applications is the diagnosis of failures in functions and systems. Therefore light functions realized with LEDs like break light, daytime running light, low and high beam may require a diagnostics function. This application note describes some items which have to be taken into account, when a diagnostic function for a LED string or a multi LED module has to be realized.

ESP32 (36) – OTA with Freshen

In one of the first posts of this tutorial, I wrote about the bootloader and about how the flash memory is organized. That article says:

This allows to implement an over-the-air (OTA) application update process: you send the new version of your application to the esp32 chip; the version is stored in a new app partition

There are different ways to implement OTA updates for your application… today I’ll show you how to do it in an easy way, thanks to a cloud service named Freshen.

Freshen

Freshen is an IoT backend, that is a cloud dashboard (published on the Internet) to manage IoT devices.

After having connected your devices to Frashen (I’ll show you later how to do it) you can:

  • display the list of the devices and their status
  • send a command to a device
  • manage the files stored in a device
  • update the firmware over-the-air (OTA)

Freshen is developed by Cesanta, the company that also develops the Mongoose library and the MongooseOS, very used in the embedded world and compatible with the esp32 chip. The service has different fees, including a free one:

freshen-001s

To use Freshen, first you have to register, using your Github or Google account:

freshen-002

Client library

Cesanta offers a client library you can use to connect your IoT project based on the esp32 chip to Freshen. The library consists only in a header file (freshen.h), and is available on the official site.

The library is fully compatible with the esp-idf framework and supports all the functionalities of the dashboard:

freshen-003

It’s also very easy to use. First copy the freshen.h file in the main folder of your project:

freshen-009

Then include the file in your program:

#include "freshen.h"

To let the library communicate with the Freshen platform in the cloud, in your program you have to periodically call the freshen_loop() function:

You can do it in a dedicated task:

void freshen_task(void *pvParameter) {
  while(1) {	
    freshen_loop(FIRMWARE_VERSION, ACCESS_TOKEN);
    vTaskDelay(2000 / portTICK_RATE_MS);
  }
}

This task calls the function every 2 seconds. Create the task in your app_main() with:

// start the freshen update task
xTaskCreate(&freshen_task, "freshen_task", 10000, NULL, 5, NULL);

The freshen_loop() function requires two parameters: the firmware version (it’s a text string at your choice, for example “v1.0″) and the access token, a code that is generated by the platform when you register a device.

Connect to the dashboard and click on Add new device:

freshen-010

A new device will be added (My Device #n). You can click on its name to display the details.

The access token is hidden… Click on click to copy to save it in the clipboard on your computer; you can then paste it in your program:

freshen-011

The device details page also allows to change the name of your device.

If you run the example program (you can download it from my Github repository) you’ll notice that, after a couple of seconds, the status of your device changes to online, to indicate that it’s correctly sending data to the dashboard:

freshen-012

In the details page, you can now list the functions that you can remotely call:

freshen-013

For example, if you call the Sys.GetInfo function you can retrieve the information about firmware version, architecture, compile date…:

freshen-014

OTA

To be able to update the firmware of your device over the air, you have to select an appropriate partition layout. For example you can choose the “OTA” layout that is already included in the framework:

freshen-006

Let’s now modify the firmware version, to be “1.1”:

freshen-015

then compile the program but don’t use the flash command. Note the path of the binary (compiled) file:

freshen-016

Select your device in the dashboard and click on OTA update selected:

freshen-017

 

Choose the .bin file that contains the new version of your firmware.

After a few moments, you’ll probably see the device going offline and return online. If the update process was successful, call the Sys.GetInfo function again and you’ll see the new version:

freshen-018

 

Atari 5200 Playstation 2 dual-shock controller adapter

5200-ps2-built

Dr. Scott Baker has developed an adapter that allows you to use Playstation 2 analog controllers on an Atari 5200, that is available on gitHub:

This adapter allows you to use a PS2 controller on an Atari 5200 gaming console. The 5200 was notable at the time for its use of analog joysticks, but the controllers that shipped with the console are pretty lousy. They don’t self-center and they have a mushy annoying feel to them. The fire buttons aren’t very tactile in nature. The controller in my opinion just doesn’t feel or work good. Nevertheless, you have to give the Atari 5200 some respect for trying to be a pioneer in the technology.
As such, several solutions have been proposed for using alternate controllers. There are adapters for Atari 2600 digital sticks, adapters for analog PC joysticks, my own handheld controller, etc. I decided to adapt the basic technique of my handheld controller to a PS2 adapter.

See the full post on Dr. Scott M. Baker’s blog.

The ARM chip that wont cost an arm and a leg

2018-09-18T16 25 43.036Z-board

A small ARM developmentboard from SMDprutser, that is available on GitHub:

Searching the prerequisite Chinese websites to satisfy my shopping fetish I came across a neat little ARM Cortex-M0 chip which is an extremely good bang for buck. I believe it is the smallest chip available in a reasonable hand-solderable package (TSOP8). This board gives you everything to explore this marvel of this Chinese Semiconductor.

Project info at smdprutser.nl. It’s also up on Tindie.

BUS PIRATE: USB Micro B connector test

header

USB Micro B is the connector of the moment, but we haven’t had a very good time working with it. The bog-standard Chinese generic Micro B connectors on Bus Pirate v5 and Bus Pirate NG1 break constantly. We tested a Micro B connector with through-hole support tabs on the latest Bus Pirate PCBs. It turned out really well.

Standard Chinese USB Micro B connector

china-standard

A ton of mom and pop factories around Shenzhen churn these out by the bucket load. It seems like a great part: ubiquitous and cheap, doesn’t require a special board slot, versions with extended leads and centering pegs are easier to hand solder. Unfortunately, every connector soldered by every member of our team has eventually decided to exit the PCB.

This connector is optimized for paste stencil and reflow soldering. Most support should come from two solder pads under the connector that are impossible to reach with a soldering iron. Maybe it could be done with hot air, or the QFN “solder from the bottom of the board through a via” hack.

Connectors with supporting through-hole tabs

usb-old-new

The generic Chinese connector (left) has six solder pads holding it to the PCB. Four can’t be reached with a soldering iron – the two under the front, and the two recessed pads at the back near the pins.

A Molex 47589-001 (right) with through-hole support tabs went into the next revision of the Bus Pirate boards. The tabs aren’t long enough to go completely through a 1.6mm PCB, but they can still be soldered in place from the top of the board. It’s much more expensive – essentially free vs $0.50 each – but we’re optimizing for hand assembly, not production.

usb-connector

Now we’re living the dream. The four tabs are really secure, and we don’t have to treat the prototype like glass. The next step is to find the most widely available Chinese equivalent.

 

 

 

IoT LED Dimmer

IOT-Dimmer

Sasa Karanovic shared a how-to on making a IoT LED dimmer:

Making a IoT LED dimmer that you can control via your PC, phone, tablet or any other device connected to the network is super simple, and I’m going to show you how.
I’m sharing my three channel LED dimmer that you can use to dim single RGB LED strip or dim three separate LED channels. I want to be able to control lights above my desk and also mix warm white and cool white strip to give me more flexibility over lighting while I’m working, taking pictures or watching movies.

See the full post on Sasa Karanovic’s blog.

Trying a quick turn hand-assembly prototype service

hand-soldered-bus-pirate-sm

These Bus Pirate v5 prototypes were hand-assembled by a random PCBA shop on Taobao. Assembly took two days and cost 80RMB (~$12) for each board, we provided the PCBs and components. Normally we relish a prototype build because it’s a source of so many design improvements, but this was an emergency.

The USB Micro B connector on the Bus Pirate v5 and the Bus Pirate NG1 keeps breaking. In fact, the connector on v5 broke while we took pictures for a post. We soldered it on well enough to finish the photos, but we need to replace the trashed board ASAP to continue working on BusPirate.com.

How it worked

We contacted a random PCBA shop on Taobao using QQ messenger. The assembler reviewed the gerber files and quoted 80RMB (~$12) to assemble each piece. That’s just the assembly cost.

PCBs and all the components came from our own suppliers. PCBs came from the Dirty PCB factory, parts came from JLC and a few Toabao suppliers. Sourcing the components for the “kit” took quite a bit of time, maybe the same as soldering a Bus Pirate. After two days we had the PCBs and parts in our Shenzhen office, then it all went to the assembler by same-day courier.

Communication with the assembler

The assembler relied on the BOM and the PCB silkscreen to stuff the board. They didn’t need an image of the schematic nor do they accept Eagle files. All interaction happened over QQ, which is pretty typical for everything in China.

missing-marking

They had a single question about the orientation of a component. The dots marking pin 1 of the BL1551s was on the wrong layer and didn’t get printed on the PCB. We’ll make sure all the orientation markings are clear for a speedier build next time.

wrong-size

The assembler found a problem with the parts we sent too. The 74HCT4066 is in the wrong package, it should be TSSOP instead of SOIC. We ordered a replacement part from JLC and chose SF shipping for 12RMB (~$1.90). The replacement arrived at the factory the next day.

The result

Finished boards arrived in our office two days after the assembler received all the parts, about 5 days after we ordered parts. Soldering is very good, but you wouldn’t mistake it for a board done in a reflow oven. All the components are stuffed in the right place and in the correct orientation. There’s a tiny bit of flux around the LEDs, but otherwise the board is super clean.

back-led-solder-sm

Bus Pirates have a row of unpopulated indicator LED footprints on the back of the board named LED1A-LED4A. These are the same as the LEDs on the front (LED1-LED4), and just open up more case options at no additional cost. The BOM we sent to the assembler specified LEDs for LED1-LED4, and made no mention of LED1A-LED4A. The assembler soldered LEDs to both sides of the board.

Our instructions were too ambiguous. The LED silk labels are PWR, USB, MODE, and VREG, not LED1-LED4. There was no way for the assembler to tell which LEDs were supposed to be populated, so they stuffed them all. In the future we’ll make sure the BOM names match the PCB silk, and explicitly state which parts are “do not populate”.

Does it work?

buspirate-v5-selftest

Powered up, programmed a bootloader, flashed the latest v5 firmware freshie build. Every board works and passes the self-test.

Quick turn hand-assembly

It’s super nifty to send away parts and get back assembled boards a few days later. If the orientation of every part is really obvious on the PCB silkscreen then the assembler can probably handle the build without any questions. The boards all work perfectly, and outsourcing the build really did keep the project moving at a critical moment.

Sourcing the parts and kitting the components took a lot of time. It would be a lot easier if the assembler provided common resistors and capacitor values so we don’t have to find them. There’s also a lot of caveats: this was all handled in Chinese, requires Chinese payment methods, and our Shenzhen office was able to coordinated everything.

Glowing mercury thyratrons: Inside a 1940s Teletype switching power supply

glowing-tubes

Ken Shirriff take a look inside a bulky DC power supply REC-30 rectifier, how it works and contrast it with a MacBook power supply:

We recently started restoring a Teletype Model 19, a Navy communication system introduced in the 1940s.14 This Teletype was powered by a bulky DC power supply called the “REC-30 rectifier”. The power supply uses special mercury-vapor thyratron tubes, which give off an eerie blue glow in operation, as you can see below.
The power supply is interesting, since it is an early switching power supply. (I realize it’s controversial to call this a switching power supply, but I don’t see a good reason to exclude it.) While switching power supplies are ubiquitous now (due to cheap high-voltage transistors), they were unusual in the 1940s. The REC-30 is very large—over 100 pounds—compared to about 10 ounces for a MacBook power supply, demonstrating the amazing improvements in power supplies since the 1940s. In this blog post, I take a look inside the power supply, discuss how it works, and contrast it with a MacBook power supply.

See the full post on Ken Shirriff ‘s blog.

App note: Challenge and Response with 1-Wire® SHA Devices

an_maxim_AN190

Another app note from Maxim Integrated about challenge-response security on 1-wire devices. Link here (PDF)

Challenge-response can be a secure way of protecting access to any privileged material if implemented correctly. In this document, many options for challenge-response access control are discussed but the most secure method given is presenting a different random challenge on each access attempt and having a response that only the host can interpret without giving out any secrets. This document shows why Maxim’s SHA-1 iButtons® and 1-Wire devices are ideal choices when implementing this kind of challenge-response system