Advertisement · 728 × 90
#
Hashtag
#ch32v003
Advertisement · 728 × 90
Post image

Explorez l'écosystème des microcontrôleurs ultra-économiques avec #CH32V003 : un microcontrôleur RISC-V, à découvrir dans notre nouveau numéro. Actuellement en kiosque et disponible sur boutique.ed-diamond.com/nouveautes/1....

0 0 0 0
Preview
Speech Synthesis on A 10 Cent Microcontroller Speech synthesis has been around since roughly the middle of the 20th century. Once upon a time, it took remarkably advanced hardware just to even choke out a few words. …read more
0 0 0 0
Preview
10 Cent Microcontroller Makes Music Compared to the old 8-bit Arduinos, it’s incredible how cheap modern microcontrollers like the ESP32 have become. But there are even cheaper options out there if you don’t need that …read more
1 0 0 0
Preview
10 Cent Microcontroller Makes Music Compared to the old 8-bit Arduinos, it’s incredible how cheap modern microcontrollers like the ESP32 have become. But there are even cheaper options out there if you don’t need that …read more
1 0 0 0
An image of the described RVPC PCB.

An image of the described RVPC PCB.

This is the #RVPC, a 1 Euro "computer" you can order from #Olimex in Bulgaria. It sports a WCH #CH32V003 #RISCV microcontroller with 16 kB Flash/2 kB RAM, a VGA port, a PS/2 keyboard port and a buzzer. The VGA signal has to be generated entirely in software […]

[Original post on mastodon.social]

0 0 0 0
Candle Flame Oscillations as a Clock _Todays candles have been optimized for millenia not to flicker. But it turns out when we bundle three of them together, we can undo all of these optimizations and the resulting triplet will start to naturally oscillate. A fascinating fact is that the oscillation frequency is rather stable at ~9.9Hz as it mainly depends on gravity and diameter of the flame._ _We use a rather unusual approach based on a wire suspended in the flame, that can sense capacitance changes caused by the ionized gases in the flame, to detect this frequency_ _and divide it down to 1Hz._ ### Introduction Candlelight is a curious thing. Candles seem to have a life of their own: the brightness wanders, they flicker, and they react to the faintest motion of air. There has always been an innate curiosity in understanding how candle flames work and behave. In recent years, people have also extensively sought to emulate this behavior with electronic light sources. I have also been fascinated by this and tried to understand real candles and how artificial candles work. Now, it’s a curious thing that we try to emulate the imperfections of candles. After all, candle makers have worked for centuries (and millennia) on optimizing candles NOT to flicker? In essence: The trick is that there is a very delicate balance in how much fuel (the molten candle wax) is fed into the flame. If there is too much, the candle starts to flicker even when undisturbed. This is controlled by how the wick is made. ### Candle Triplet Oscillations Now, there is a particularly fascinating effect that has more recently been the subject of publications in scientific journals12 : When several candles are brought close to each other, they start to “communicate” and their behavior synchronizes. The simplest demonstration is to bundle three candles together; they will behave like a single large flame. So, what happens with our bundle of three candles? It will basically undo millennia of candle technology optimization to avoid candle flicker. If left alone in motionless air, the flames will suddenly start to rapidly change their height and begin to flicker. The image below shows two states in that cycle. Two states of the oscillation cycle in bundled candles We can also record the brightness variation over time to understand this process better. In this case, a high-resolution ambient light sensor was used to sample the flicker over time. (This was part of more comprehensive set experiments of conducted a while ago, which are still unpublished) Plotting the brightness evolution over time shows that the oscillations are surprisingly stable, as shown in the image below. We can see a very nice sawtooth-like signal: the flame slowly grows larger until it collapses and the cycle begins anew. You can see a video of this behavior here. (Which, unfortunately cannot embed properly due to WordPress…) Left: Brightness variation over time showing sawtooth pattern. Right: Power spectral density showing stable 9.9 Hz frequency On the right side of the image, you can see the power spectral density plot of the brightness signal on the left. The oscillation is remarkably stable at a frequency of 9.9 Hz. This is very curious. Wouldn’t you expect more chaotic behavior, considering that everything else about flames seems so random? The phenomenon of flame oscillations has baffled researchers for a long time. Curiously, they found that **the oscillation frequency of a candle flame** (or rather a _“wick-stabilized buoyant diffusion flame”_) **depends mainly on just two variables: gravity and the dimension of the fuel source.** A comprehensive review can be found in Xia et al.3. Now that is interesting: gravity is rather constant (on Earth) and the dimensions of the fuel source are defined by the size (diameter) of the candles and possibly their proximity. **This leaves us with a fairly stable source of oscillation, or timing, at approximately 10Hz.** Could we use the 9.9 Hz oscillation to derive a time base? ### Sensing Candle Frequencies with a Phototransistor Now that we have a source of stable oscillations—remind you, **FROM FIRE** —we need to convert them into an electrical signal. The previous investigation of candle flicker was based an I²C-based light sensor to sample the light signal. This provides very high SNR, but is comparatively complex and adds latency. A phototransistor provides a simpler option. Below you can see the setup with a phototransistor in a 3mm wired package (arrow). Since the phototransistor has internal gain, it provides a much higher current than a photodiode and can be easily picked up without additional amplification. Phototransistor setup with sensing resistor configuration The phototransistor was connected via a sensing resistor to a constant voltage source, with the oscilloscope connected across the sensing resistor. The output signal was quite stable and showed a nice ~9.9 Hz oscillation. In the next step, this could be connected to an ADC input of a microcontroller to process the signal further. But curiously, there is also a simpler way of detecting the flame oscillations. ### Capacitive Flame Sensing Capacitive touch peripherals are part of many microcontrollers and can be easily implemented with an integrated ADC by measuring discharge rates versus an integrated pull-up resistor, or by a charge-sharing approach in a capacitive ADC. While this is not the most obvious way of measuring changes in a flame, it is to be expected to observe some variations. The heated flame with all its combustion products contains ionized molecules to some degree and is likely to have different dielectric properties compared to the surrounding air, which will be observed as either a change of capacitance or increased electrical loss. A quick internet search also revealed publications on capacitance-based flame detectors. A CH32V003 microcontroller with the CH32fun environment was used for experiments. The set up is shown below: the microcontroller is located on the small PCB to the left. The capacitance is sensed between a wire suspended in the flame (the scorched one) and a ground wire that is wound around the candle. The setup is completed with an LED as an output. Complete capacitive sensing setup with CH32V003 microcontroller, candle triplet and a LED. Initial attempts with two wires in the flame did not yield better results and the setup was mechanically much more unstable. Read out was implemented straightforward using the TouchADC function that is part of CH32fun. This function measures the capacitance on an input pin by charging it to a voltage and measuring voltage decay while it is discharged via a pull-up/pull-down resistor. To reduce noise, it was necessary to average 32 measurements. // Enable GPIOD, C and ADC RCC->APB2PCENR |= RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOC | RCC_APB2Periph_ADC1; InitTouchADC(); ... int iterations = 32; sum = ReadTouchPin( GPIOA, 2, 0, iterations ); First attempts confirmed to concept to work. The sample trace below shows sequential measurements of a flickering candle until it was blown out at the end, as signified by the steep drop of the signal. The signal is noisier than the optical signal and shows more baseline wander and amplitude drift—but we can work with that. Let’s put it all together. Capacitive sensing trace showing candle oscillations and extinction ### Putting everything together Additional digitial signal processing is necessary to clean up the signal and extract a stable 1 Hz clock reference. The data traces were recorded with a Python script from the monitor output and saved as csv files. A separate Python script was used to analyze the data and prototype the signal processing chain. The sample rate is limited to around ~90 Hz due to the overhead of printing data via the debug output, but the data rate turned out to be sufficient for this case. The image above shows an overview of the signal chain. The raw data (after 32x averaging) is shown on the left. The signal is filtered with an IIR filter to extract the baseline (red). The middle figure shows the signal with baseline removed and zero-cross detection. The zero-cross detector will tag the first sample after a negative-to-positive transition with a short dead-time to prevent it from latching to noise. The right plot shows the PSD of the overall and high-pass filtered signal, showing that despite the wandering input signal, we get a sharp ~9.9 Hz peak for the main frequency. A detailed zoom-in of raw samples with baseline and HP filtered data is shown below. The inner loop code is shown below, including implementation of IIR filter, HP filter, and zero-crossing detector. Conversion from 9.9 Hz to 1 Hz is implemented using a fractional counter. The output is used to blink the attached LED. Alternatively, an advanced implementation using a software-implemented DPLL might provide a bit more stability in case of excessive noise or missing zero crossings, but this was not attempted for now. const int32_t led_toggle_threshold = 32768; // Toggle LED every 32768 time units (0.5 second) const int32_t interval = (int32_t)(65536 / 9.9); // 9.9Hz flicker rate ... sum = ReadTouchPin( GPIOA, 2, 0, iterations ); if (avg == 0) { avg = sum;} // initialize avg on first run avg = avg - (avg>>5) + sum; // IIR low-pass filter for baseline hp = sum - (avg>>5); // high-pass filter // Zero crossing detector with dead time if (dead_time_counter > 0) { dead_time_counter--; // Count down dead time zero_cross = 0; // No detection during dead time } else { // Check for positive zero crossing (sign change) if ((hp_prev < 0 && hp >= 0)) { zero_cross = 1; dead_time_counter = 4; time_accumulator += interval; // LED blinking logic using time accumulator // Check if time accumulator has reached LED toggle threshold if (time_accumulator >= led_toggle_threshold) { time_accumulator = time_accumulator - led_toggle_threshold; // Subtract threshold (no modulo) led_state = led_state ^ 1; // Toggle LED state using XOR // Set or clear PC4 based on LED state if (led_state) { GPIOC->BSHR = 1<<4; // Set PC4 high } else { GPIOC->BSHR = 1<<(16+4); // Set PC4 low } } } else { zero_cross = 0; // No zero crossing } } hp_prev = hp; Finally, let’s marvel at the result again! You can see the candle flickering at 10 Hz and the LED next to it blinking at 1 Hz! The framerate of the GIF is unfortunately limited, which causes some aliasing. You can see a higher framerate version on YouTube or the original file. That’s all for our journey from undoing millennia of candle-flicker-mitigation work to turning this into a clock source that can be sensed with a bare wire and a microcontroller. Back to the decade-long quest to build a perfect electronic candle emulation… All data and code is published in this repository. _This is an entry to theHaD.io “One Hertz Challenge”_ ### References 1. Okamoto, K., Kijima, A., Umeno, Y. & Shima, H. “Synchronization in flickering of three-coupled candle flames.” _Scientific Reports_ 6, 36145 (2016). ↩︎ 2. Chen, T., Guo, X., Jia, J. & Xiao, J. “Frequency and Phase Characteristics of Candle Flame Oscillation.” _Scientific Reports_ 9, 342 (2019). ↩︎ 3. J. Xia and P. Zhang, “Flickering of buoyant diffusion flames,” _Combustion Science and Technology_ , 2018. ↩︎ ### Share this: * Click to share on X (Opens in new window) X * Click to share on Facebook (Opens in new window) Facebook * Like Loading... ### _Related_

"Candle Flame Oscillations as a Clock"
cpldcpu.com/2025/08/13/candle-flame-...

#electronics #ch32v003

1 1 0 0
Post image

通電一発で動いた :-) #CH32V003 Game Console

1 0 1 1

タグつけ忘れた #Arduino #CH32V003

1 1 0 0

And now I'm off implementing the i2c-puppet API on the #ch32v003. There isn't a lot of documentation on how to do things so I needed to read cnlohr's source code for #ch32fun and cross-check it with the #WCH reference manual for the microcontroller to figure out how to do things. #riscv #handheld

2 0 1 0

I got it to work! 🥳🎉
Even the 5-direction switch works.

#ch32v003 #handheld #riscv

1 0 0 1

And so I learned that PD7 on the #ch32v003 is special: it is normally the reset pin and I think minichlink -D should be run to make it a GPIO pin. I moved it to use a different port instead because I want to be able to use the reset button for now. It now works, and now I can proceed...

0 0 0 1

And now that I've wired everything up it seems that the 74HC595 is acting up again. 😩 No rest for the wicked. #ch32v003 #hardware

0 0 0 1
Post image

And I managed to turn the #ch32v003 into an I²C peripheral. The red LED is controlled by the Arduino that acts as an I²C controller. So now things are taking shape.

0 0 0 1
Keypad, 5-way switch, I²C display, Arduino Nano, and keypad. Under the keypad, a CH32v003 board and a 74HC595.

Keypad, 5-way switch, I²C display, Arduino Nano, and keypad. Under the keypad, a CH32v003 board and a 74HC595.

Wire wrapping on the board

Wire wrapping on the board

So I'm going to try to put this all together. I'll set the keypad and the #CH32v003 up as an I²C target, with an Arduino Nano as I²C controller, which will also drive the display. We'll follow the same protocol as the I²C puppet firmware used by the #SQFMI #Beepy.

0 0 0 0
CH32v003 dev board with keypad and pulldown resistors.

CH32v003 dev board with keypad and pulldown resistors.

So after getting a new multimeter I was able to diagnose some of the problems which included bad Dupont wires and other faulty connections. I couldn't get the #ch32v003 to read the keypad without pulldown resistors. I think the system should have internal pullup/pulldown GPIOs but not sure howto use

1 0 1 0
Post image

So I finally got the 74HC595 shift register to work the way I wanted. Having problems now doing digital read GPIO on #ch32v003. Then the multimeter I was using to test this died suddenly. I can't even test for continuity. 😩 Ah well, I guess that's a sign to really go on vacation. #riscv #handheld

1 0 0 0
A CH32V003 microcontroller board hooked up to a 74HC595 shift register and a matrix keypad on a protoboard.

A CH32V003 microcontroller board hooked up to a 74HC595 shift register and a matrix keypad on a protoboard.

Suddenly I realized that I didn't really know how to do GPIO programming for the #CH32V003, and so I rigged up this little circuit with a matrix keypad and a 74HC595. The same principle and code structure should apply to the BBQ10KBD, just a matter of a few more pins.

1 0 0 0
A small I²C OLED display showing the RISC V logo, driven by a RISC V CH32V003 dev board

A small I²C OLED display showing the RISC V logo, driven by a RISC V CH32V003 dev board

It seems my old WCH-LinkE USB programmer and #CH32V003 dev board vanished without a trace so I had to buy a new one. I modified the I²C OLED demo from the ch32fun repo of @cnlohr.bsky.social to show the #RISCV logo. 10¢ RISC V microcontroller FTW.

5 1 0 0
Preview
CH32V003マイコンでWS2812B RGB LED (NeoPixel)を動かす - rpine lab Tech Blog CH32V003マイコンでNeoPixel(WS2812B)LEDを制御する方法を解説しています。既存のライブラリーを流用して、SPIとDMAを活用することでCPU負荷を抑えながら安定した制御が可能です。サンプルコードを示してLEDを様々な色で光らせる実装方法を紹介しています。

CH32V003マイコンでWS2312B RGB LED (NeoPixel)を動かしてみました。
公式SDK(Mounriver Studio Ⅱ)とch32funのLED制御ライブラリーの組み合わせで、SPI+DMAを使って制御信号を生成しています。
blog.rpine.net/posts/ch32v003-ws2812b
#CH32V #ch32v003 #ws2812b #NeoPixel

0 0 1 0
Video

Working on my custom digital PWM firmware for the #ch32v003 tonight... Installing this on the upcoming Mini shard and possibly the AG EchoFrame visor. #wearabletech #electronics #cyberpunk #cosplay #makersgonnamake

5 1 0 0
Preview
Reviving old tech with new tech: A $0.03 RISC-V microcontroller brings an Acer N30 PDA back to life The Acer N30 is a PDA released in 2004 that shipped with a 240 x 320 pixel resistive touchscreen display, a 266 MHz Samsung S3C2410 processor, and Windows Mobile 2003 software. It's been out of production for nearly two decades, but could still be used as a mobile devices for taking notes, playing games, and other activities... if you can find one with a functional battery.

Reviving old tech with new tech: A $0.03 RISC-V microcontroller brings an Acer N30 PDA back to life #Acer, #AcerN30, #Battery, #CH32V003, #Microcontroller, #Pda, #WindowsMobile

2 1 0 1
Bit Banging LCD + Touch + USB on the ch32v003
Bit Banging LCD + Touch + USB on the ch32v003 YouTube video by CNLohr

I couldn't help but to play with these 21¢ LCDs on the 10¢ #riscv #ch32v003. Adding touch, LCD outputs USB to a processor that has none of them, and without a USB connector! Join me on this little side quest. www.youtube.com/watch?v=KNDR...

24 5 2 1

Also #CH32V003. ESP are the usual go to for Bluetooth or WiFi. If you have particular requirements, a different chip or module might be better. eg. some are easier to breadboard than others

1 0 1 0
Post image Post image Post image

多分動く基板が書けたので発注した。 #CH32V003 #しかのこのこのここしたんたん

1 0 0 0
Preview
Bring Linux To CH32V003 Through, Yes, RISC-V Emulation Like playing around with Linux on low-power devices? You’d be hard pressed to find a better example than the [tvlad1234]’s linux-ch32v003 project. It’s not just a one-off — …

Bring #Linux To #CH32V003 Through, Yes, #RISCV Emulation
hackaday.com/2024/03/03/b...

0 0 0 0
Preview
WCH RISC-V microcontrollers can now be programmed with the Arduino IDE - CNX Software WCH has announced Arduino support for their RISC-V microcontrollers such as the 10 cents WCH32V003 or the features-rich WCH32V307 MCUs.

Den #CH32V003 kann man jetzt auch mit Arduino bespielen www.cnx-software.com/2024/01/04/wch-risc-v-mc...

2 0 1 0
Preview
An Animated LED Fireplace Powered By The CH32V003 Once you’ve mastered the near-magical ability of turning your ideas into a piece of hardware you can hold in your hand, it’s only natural that you’ll want to spread the joy. The h…

An Animated LED Fireplace Powered By The #CH32V003
hackaday.com/2024/01/02/a...

0 0 0 0