App note: Li-ion battery and gauge introduction

an_ricktek_an024

Richtek app note for Li-ion battery definitions and gauge introduction. Link here

SOC is defined as the status of available energy in the battery and usually expressed as percentages. Because the available energy change depends on different charging/discharging currents, temperatures and aging effects, the SOC could be defined more clearly as ASOC (Absolute State-Of-Charge) and RSOC (Relative State-Of-Charge). Typically, the range of RSOC is from 0% to 100%, a fully charged battery’s RSOC is always 100% and a fully discharged battery has 0% RSOC. The ASOC is a reference calculated by Design Capacity which is a fixed capacity from when the battery is manufactured. A fully charged new battery will have 100% ASOC, but a fully charged aging battery could be less than 100% because of different charge/discharge conditions.

Battery management is part of power measurement. The fuel gauge is responsible to estimate the capacity of battery in the domain of battery management. The basic function of fuel gauge is to monitor the voltage, charge/discharge current and battery temperature, and to estimate the battery’s SOC and Full Charge Capacity (FCC) of battery. There are two classic methods to do the SOC estimation which are Open Circuit Voltage (OCV) and Coulomb Counter, respectively. The other method is dynamic voltage-based algorithm designed by RICHTEK.

Pocket high voltage generator quick build

IMG_20181003_164820

Aki made this DIY pocket HV generator:

There are times you find yourself looking for a relatively high voltage (100V to 200V often in my case) but low current DC power supply. I have zener diodes that are higher than 30V, which makes the lab supply useless, and filament LEDs with forward voltage over 60V. When I need to test them quickly, I used to hook up a simple rectifier circuit to a variable AC power supply (nothing more than a slidac with isolation transformer). While this gets job done, the setup is capable of supplying much too high current (1A or more), so I was always very nervous and extra careful in handling the circuit. All I need is a little HV generator that gives me around 200V DC and only capable of supplying a milliamp or less. Realizing that I do have such design available – one of the Nixie supply circuit – I just decided to put one together to use.

Project info on The LED Artist blog.

Two bits per transistor: high-density ROM in Intel’s 8087 floating point chip

1die-labeled

Ken Shirriff has a great write-up about the multi-level ROM in Intel’s 8087 floating point chip:

The 8087 chip provided fast floating point arithmetic for the original IBM PC and became part of the x86 architecture used today. One unusual feature of the 8087 is it contained a multi-level ROM (Read-Only Memory) that stored two bits per transistor, twice as dense as a normal ROM. Instead of storing binary data, each cell in the 8087’s ROM stored one of four different values, which were then decoded into two bits. Because the 8087 required a large ROM for microcode1 and the chip was pushing the limits of how many transistors could fit on a chip, Intel used this special technique to make the ROM fit. In this article, I explain how Intel implemented this multi-level ROM.

More details on Ken Shirriff’s blog.

DIRTY CABLES: a new cable editor

cover-image

DirtyCables.com has a live preview of a new custom cable builder. This is a from-scratch rewrite of the editor at DirtyPCBs with new features based on your requests:

  • Isometric connector drawings with pin numbers save a trip to the datasheet
  • Improved connector selector with room for additional info
  • One to many “Y” connections. Same connector “U” connections
  • Bigger, cleaner interface

Check out the live demo, and read about the updates below. The new editor is in preview mode, saving and buying cables is disabled.

add-hover

The editor is full screen and adjusts somewhat to different device sizes. Click “Add Connector” or “Add Wire” to insert a new part.

cables-add-CH

The add part dialog has been completely reworked. Choose the connector family to see a photo and isometric drawings with pin numbers. There’s room to add more information about the part in the future.

cables-complex

Click and drag to connect a wire and a connector. This is different than the click-to-select interface in the previous editor, and lacks the UI bugs. Pins, labels, and connections are handled by an open source library called jsPlumb.

Y-type one-to-many connections can be made for some parts. It’s also possible to do U-type connections that connect two pins of the same connector to the opposite ends of a single wire.

flip

Click to flip the connector and pin order. The reverse view shows the bottom side isometric drawing.

length

Click the wire to edit the length. Click “X” to remove the wire and its connections. This is much more compact than the old editor and makes complicated cables look a lot cleaner.

cables-docs

DirtyCables.com will be the new dedicated  site for the Dirty Cables service. The new site has simple and clear navigation, and it gives us room to grow the cable documentation and resources. In the next year we hope to double the connector and wire options, and add 100 common pre-made cables to the store. Of course it would also be nice to have mating sockets for all the connectors.

It’s a big decision to move this service outside DirtyPCBs, but we’ve made a lot of progress in the last year. We have a solid supply chain, we can accurately estimate prices, and we have a procedure to evaluate cable samples before they ship. DirtyCables is currently in preview mode, but it should be open for orders early next week.

Try out the new cable editor preview here. Can’t wait to buy custom cables? DirtyPCBs’ cable creator is ready to take your order. Need to see the connectors? Try our cheap Dirty Connector Sample Kits.

 

 

 

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.