Friday, February 14, 2025

0000 0000 1111 1000

Beefing up the Bakin' and Leds

There have been a couple of incarnations of the Lab Led Lighting project (alliteration for the win).

Some time ago the original DC/DC converter fried itself, and so I replaced it with an MP1854 module which hummed along for a few months before self destructing.

So now I want to play with this project again, the main thing is to put a "beefier" DC/DC module to start with, but also to maybe spin out the voltage and current control knobs to the front of the 3D printed box for easier access.

It didn't all go my way - stand back for popping sounds as I further my reputation as a "trial and error and error and error" type.



Saturday, February 8, 2025

0000 0000 1111 0111

A long time between drinks

I've been missing for awhile and in this video I explain the reasons for my absence, as well as dig out an old friend the AO3400 N-Channel mosfet, not for a few drinks - but to blow it up!

Take care of yourselves and please leave a comment and a like for this one. 



Saturday, October 26, 2024

0000 0000 1111 0110

The last impossible thing

I've been working in the background on replacing the NiMH battery in the candle project with a supercapacitor. It's been quite the journey and at times I definitely did not believe that it would ever happen.

There is a great benefit when you are a mad pioneer in being ignorant of what is conventionally regarded as not possible, so I just assumed in my usual trial and error, and error, and error method of experimentation that the problem would eventually be solved.

Three impossible things needed to happen for this project to be completed:

1. A supercapacitor needed to be able to run a microcontroller (just ticking over anaemically at a very low clock rate) for a useful amount of time (e.g. overnight) - done

2. A microcontroller (e.g. the PADAUK PFS154) needed to be able to detect when it was night time just from the charge profile of a capacitor - done

3. A circuit designed to have at it's heart a NiMH battery would need to be fooled and use a collection of passives instead

The final result needs more polishing, but all three miracles have occurred and now the candle project will be re-imagined as a supercapacitor project. Done?

Magic!




Sunday, October 13, 2024

0000 0000 1111 0101

Mailbag #44 - some nice modules

The usual responsible grab-bag of goodies from AliExpress - including some great little modules.

The ESP32-S3 (dual core) which may be pressed into service as a toddler clock (!), and a CH32X035F8 module with some impressive stats!

Enjoy!




Monday, October 7, 2024

0000 0000 1111 0100

CH32v003 Serial and SWIO Communication Clash

The SOP8 version of the CH32v003 is pretty amazing, and one "feature" is the ability to remap many functions/protocols to the same pins.

This is fine up to the point where there might be a clash. For instance, just look how busy pin 8 is - overloaded including the function that allows it to be programmed and reprogrammed (the one-wire SWIO "single wire" protocol) that for some reason is on the same pin as serial TX.

So...what if you have engaged serial communication AND want to reprogram the chip?

Disaster! But, there are a few ways I have found to get around the problem.

1. Use the minichlink program as we saw in a previous blog and video.
2. Only open up Serial when you need it, and then the chances of interrupting the program to "reprogram" are increased (dodgy I know)
3. Use a mysterious function on a mysterious piece of software to somehow use the one-wire protocol to "printf" from pin 8.

4. Re-map the pins! (see below)
5. Buy the version with more pins you cheapskate!

Now the deep deep deep dive into pin re-allocation took me through many websites, forums and configurations files, but here is what you need to do:

a) find the files PeripheralPins.c and variant_CH32V003F4.h in the core directory as follows:

b) Make the following config file edits to re-map the pins:

1. in the file PeripheralPins.c

//*** UART ***
#ifdef UART_MODULE_ENABLED
WEAK const PinMap PinMap_UART_TX[] = {
  {PD_6, USART1, CH_PIN_DATA(CH_MODE_OUTPUT_50MHz, CH_CNF_OUTPUT_AFPP, 0, AFIO_NONE)}, // from PD_5
  {NC,   NP,     0}
};
#endif

#ifdef UART_MODULE_ENABLED
WEAK const PinMap PinMap_UART_RX[] = {
  {PC_1, USART1, CH_PIN_DATA(CH_MODE_INPUT, CH_CNF_INPUT_PUPD, PULLUP, AFIO_NONE)}, // from PD_6
  {NC,    NP,     0}
};
#endif

2. in the file variant_CH32V003F4.h

// UART Definitions
#ifndef SERIAL_UART_INSTANCE
  #define SERIAL_UART_INSTANCE  1
#endif
// Default pin used for generic 'Serial' instance
// Mandatory for Firmata
#ifndef PIN_SERIAL_RX
  #define PIN_SERIAL_RX         PC1 // from PD6
#endif
#ifndef PIN_SERIAL_TX
  #define PIN_SERIAL_TX         PD6 // from PD5
#endif

c) add the following lines to your setup() code in your Arduino IDE sketch:

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD | RCC_APB2Periph_USART1 | RCC_APB2Periph_AFIO, ENABLE);
  GPIO_PinRemapConfig(GPIO_PartialRemap2_USART1, ENABLE);
  Serial.begin(115200);

Full code:

#define ledpin PC4
int counter = 0;

void setup() {
  pinMode(ledpin, OUTPUT);
  // Must enable clock for AFIO
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD | RCC_APB2Periph_USART1 | RCC_APB2Periph_AFIO, ENABLE);
  GPIO_PinRemapConfig(GPIO_PartialRemap2_USART1, ENABLE);
  Serial.begin(115200);
}

void loop() {
  digitalWrite(ledpin, HIGH);
  delay(80);
  counter++;
  digitalWrite(ledpin, LOW);
  delay(300);
  Serial.print("blink ");
  Serial.println(counter);
}

After that the only "gotcha" is to remember to switch the connections as follows:

Then you can reprogram at your leisure and enjoy serial communication as well. Speaking of enjoyment, please see the video below and let me know if any of these workarounds did the trick for you as well.



Saturday, September 28, 2024

0000 0000 1111 0011

AO3400 Super Transistor!

Looking to power a fan to keep an Orange Pi 3B cool inside it's enclosure, I turned to a "power" mosfet I hadn't worked with before, the super little guy AO3400.

Rated to 30V and a fanciful 5.8A it seemed to be perfect for the job because it could "open the gate" at around 1.1V.

I designed a suitable circuit, soldered the little bits together on a SOP8 to DIP8 adapter (!!) as per below:

The design seemed to work for an LED circuit, so I boxed it up and ran it from the 5V rail of the OPi 3B.

See the result below. Please add comments on YT below the video, especially if you have a view on fan orientation!



Saturday, September 21, 2024

0000 0000 1111 0010

Mailbag #43 - many nice parcels!

Here we are at 43 and so many lovely parcels flowing in - including some incredible chips that play around with voltage like they were born to do it!

If you would like to build the circuits for the MAX1044 check out the datasheet.

Enjoy the video!