[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/diy/ - Do It Yourself

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


Previous Thread: >>2928655

Here we discuss microcontrollers (MCUs), single board computers (SBCs), and their accessories, such as Atmel mega and tiny AVRs (Arduinos), PICs, ARM boards such as blue/black pill STM32, ESP8266/32s, RP2040, Raspberry Pi, and others.

For general electronics questions (power supplies, level shifting, motor driving, etc.) please ask /ohm/.

>where can I find verified quality microcontrollers and other electronic sensors or parts
digikey.com
mouser.com
arrow.com
newark.com

>but that's too expensive
aliexpress.com (many parts here are fake, particularly specific parts out of stock in the above sites)
lcsc.com

>I need a part that does X and Y, with Z specifications. How can I find it?
use DigiKey's or Octopart's parametric part search. Then purchase from one of the sellers listed above.

>how do I get started with microcontrollers, where should I start?
There is no defined starting point, grab a book and start reading or buy an arduino off ebay/amazon and start messing around. There are a plethora of examples online to get started.

>resources:
https://github.com/kitspace/awesome-electronics

>RISC-V microcontroller list:
https://codeberg.org/20-100/Awesome_RISC-V/raw/branch/master/RISC-V_MCU_development_boards.pdf
>>
>>2952647
Arduino is not cool. In fact it's fucking stupid in multiple ways.
>>
>>2952826
Are we gonna start hating on starter kits now?
>>
Which is the easiest SoM to build a PCB for and get it to work with an embedded linux? Aren't there any templates with the right footprints and conducting traces for a basic periphery? As well as a pre-configured embedded linux? I basically seek a starting point to jump off the development board onto the self-designed board.
>>
>>2952826
i'm a noob. what's stupid about it
>>
File: sarcasm.jpg (246 KB, 1200x742)
246 KB
246 KB JPG
>>2952861
It doesn't require signing your life away for an awful clunky toolchain that's bloated to all hell for some reason, and doesn't require a spaghetti of wires to an expensive bespoke programmer to develop for it.
Therefore, "real" embedded devs hate it.
>>
>>2953044
The Arduino IDE is the most clunky thing I've ever encountered, except maybe for the vendor Eclipse IDEs, that only idiots use.
>>
>>2952826
it's a general purpose prototyping board, it's not cool inherently. It does what it needs to and is relatively easy to adapt to changing requirements. I don't want to have to configure SFRs just to spin a motor when a button is pushed, my boss wants me to have a functional prototype yesterday. The PIC16F that will be used in production isn't cool either, but it's cheap, reliable, and and will be configured to the product spec that is already written before it even gets selected.
>>
>>2953076
How are pics still a thing how much are they saving per unit a nickle? And it has to be programmed in assembly how much does that cost?
>>
>>2953086
There are compilers for PICs. I think a lot of the use of PICs these days is with legacy designs where the code is already written, I see them in multi-stage lead-acid battery chargers, that kind of stuff where you’d need under 50 lines of C anyhow. Doesn’t matter how inefficient your compiler is at that point, maybe these things are written in Basic. There’s also 32-bit PICs that surely nobody programs in ASM.
>>
>>2953044
>>2953049
>>2953076
what mcu do the cool kids use?
>>
>>2953049
You don't need the IDE. You can just use avr-gcc and avrdude.
>>
>>2953049
how is it clunky? just type da code and compile and upload
>>
>>2953174
I know, but it's annoying how the IDE hides all the tool use, which could be pretty simple, and even needs to do that init/loop bullshit.
>>
>>2953176
It's designed for babbies, who would be confused by such things
>>
>>2953223
Stop being such an elitist debby downer and make something cool. The fish wont care you used an arduino to feed them. Bedides youre not getting an embedded job without a license anyways.
>>
>>2953146
Arduino is dinosaur tech which began with a 20 year old microcontroller. 8bit MCUs are going extinct.

Anyway the cool kids might use stm32, which is a pretty modern, extensive family of processors. As few as 8 pins, or over 100 if you want. They have the "nucleo" dev boards too which makes it easy to get started. I've used them and like them.

ESP32 is also worth a look. The company Espressif has sold over a billion esp32s, they're everywhere. Cheap devboards but extremely capable (lots of flash, lots of ram, and high clock rate, up to 240MHz IIRC)
>>
>>2953255
I'm using a teensy 4.1, which I kind of lump in with Arduino because it uses Arduino IDE. It's pretty powerful.
>>
>>2953255
>8bit MCUs are going extinct
i just had a look at the new avr generation and i dont think so.
>>
>>2953174
Then it's just an overpriced ATMega/ESP/whatever the fuck they use now development board
>>2953255
ST is pissing me off with the whole Cube stuff, having to register with full name and address. ESP is nice, ESP-IDF is good to work with desu.
And I think AVR 8bit MCUs are here to stay.
>>
>>2953229
I didn't say there was anything wrong with that. If you know enough to need more, you can figure out how to get it.

>>2953488
>Then it's just an overpriced ATMega/ESP/whatever the fuck they use now development board
Duh, but why would you ever buy a real one? Chang will happily sell you ten functionally identical knockoffs for the price of one genuine Arduino™ board. As a beginner, that gives you access to all kinds of Arduino-oriented handholding AND nine chances to keep going after badly fucking up.
>>
>>2953488
>ST is pissing me off with the whole Cube stuff, having to register with full name and address
This alone drove me to other micros when I was picking a chip for a project.
I'm sure there are probably thirdparty toolchains that don't have this crap, but I can't be bothered to investigate when other chips work out of the box with no strings attached (also the supply chain issues of the time didn't help ST's case).
>>
>>2953554
Back when it was new and ST guys were first trying to shill it, I looked at Cube and decided it was shit. Being able to pick a configuration with a Windows gooey app might be cute and impress PHBs and Arduweenies, but as I recall it generated *customized* header files. So much fun if you've actually got a product that you want to keep track of in source code control.
I never stopped using their old hardware libraries, which were flawed in other ways, but didn't change due to a fucking checkbox.
>>
Putting esp32's on custom pcbs. What, pray tell, do I actually require to be able to use serial over USB? Supposably you need a quart/USB chip, but there is also mention of it being native to the esp32, pins 19/20?
>>
>>2953076
>PIC16F
Is it possible to use a Raspberry Pi Pico to play the role of a PIC programmer and transmit data between them using a very thin wire carrying a signal through USART so as to have a Pico and a PIC picking up and passing pieces of data though a wire thinner than a toothpick?
>>
>>2953486
I looked now because of your post and yeah the new avr stuff is pretty cool. I take it back, there's still space for 8bit
>>
>>2953146
Different kinds of cool kids everywhere.

The pic stuff has some interesting options for extra peripherals. The language and your ultimate goals are the key. It is nice to use an interpreter like with Flash Forth, or Micropython, or Circuit Python. Any of the Forth languages can be fun. However, you will be doing stack based programming, so branching is a bit more complicated. Anything from Adafruit with support for Circuit Python is nice and well documented. Thony is an easy way to interface without some electron, google, or microsoft stalkerware. The cool kids take the time to learn both Emacs and Vim, usually Doom Emacs and NeoVim.
>>
File: 1568788740272.png (100 KB, 299x376)
100 KB
100 KB PNG
>work has 3 high school kids as interns for the week
>kid I'm assigned says he has thousands of hours in Warthunder and WoW
>hand him a box of microcontrollers, breadboards, and other electronic scraps and tell him to figure out how a transistor works
He was entertained for the entire day, and he can't wait to continue tomorrow.
>>
>>2953760
that's cool of you anon. did he figure it out?
>>
>>2953778
With a little help, yeah. Had him solder LED blinker circuits at the end of the day.
>>
>>2953488
> 8 bit is here to stay
Sadly, DIP or PDIP is slowly leaving us.
This is because the materials of the packaging (shipping, epoxy, lead frame, bond wires) cost way more than the actual die. Neo-Nexperia is finding this out now. So we’ll see more bare-silicon/flip chips since factories are getting better at using raw dies. We’ve had the black epoxy blob for decades. Bad for the diy’er. Get good at making carrier boards.

8 bit may also leave us for various complicated reasons. We’ll probably be emulating 8051s and z80s with ARM in the near future.
Home devices that only need 4 or 8 bit cores (like breadmakers, toasters, juicero, etc.) will soon want to be wired to the internet for the “service model” idea which 8-bit cores can’t really do by themselves.
>>
>>2953806
that's sad about dip. i don't mind SMD that much but i probably would have found a different hobby if i had to deal with SMD only. but smd will likely get easier in time as well with cheaper solutions
>>
>>2953588
Which ESP32 model? Some of the more recent models have native USB capability, and some can even be programmed by USB without a hacky bootloader, but from what I remember they needed to be told to enable this first. Or that you need to cycle power, or push the programming boot button, or some other caveat that makes it less convenient. Unlike an RP2040.

If you’re just using UART to program them, you can use one or two of the flow-control pins to pull down the boot button or whatever, so you don’t have to press the button manually. Take a look at the schematic of a NodeMCU board to see how they did it.

>>2953682
Wire thickness isn’t an issue at all. 30awg can carry USART, no problem. I don’t know how PIC programming works outside of a PIC-kit, but I think I’ve seen one or two projects that implement it on custom hardware. One was on another PIC, which isn’t surprising.

>>2953760
Fun. I wish someone gave me that kind of internship out of high school, instead of going off to university for a useless degree.
>>
>>2954113
S3-WROOM

19/20 are on USB data lines for programming, apparently I have to put the chip in USB otg mode or some shit. Eff that I'll just ftdi off board.
>>
File: IMG_1189.jpg (474 KB, 1591x1649)
474 KB
474 KB JPG
>>2952647
Stupid question: I bought a bunch of these weak laser diodes off Amazon a while back. I think they’re rated 3 to 5 volts. I was just using them with 3 volt coin batteries but I want to use them with an arduino project. Do I need a resistor or a transistor to connect them? If so what kind? Also, even dumber question: can I make them brighter somehow?
>>
>>2954873
Lasers are kind of like LEDs, but usually much more fragile, so they need current limiting.
A resistor should be enough for low power ones (IDK the exact value, you'd need to look that up), but a proper driver circuit is best practice and almost mandatory for stronger lasers.
You cannot make them much brighter. Overdriving them will quickly destroy them.
If you want the most brightness for any given strength, go for green lasers since our eyes are most sensitive to it.

I know this sounds like a broken record, but be careful lasers. The type you have are probably genuinely <5mW and fairly safe, but strong ones can easily cause permanent eye damage (a reflected hit with a "weak" 20mW laser caused a spot in my eye for over a day), and online sellers habitually lie about the ratings (sometimes by hundreds of times) to skirt regulations.
>>
File: laser_danger_sml.gif (14 KB, 397x306)
14 KB
14 KB GIF
>>
File: 1000012664.jpg (386 KB, 1216x1095)
386 KB
386 KB JPG
Did I fuck up my pcb design so psram (U11) sees noise?

Long story short I making a cartridge for zx spectrum, and that thing has pico as well as PSRAM chip. Whenever I plug my custom ZX Spectrum cartridge in, the PSRAM starts spitting errors on a self test — even if the board’s powered by USB and the +5 V from the Spectrum is cut.

ZX address/data lines (A0–A15, D0–D7, MREQ, RD, etc.) go through 74LVC245s for level shifting to 3.3 V. Spectrum ground is tied to the same plane as everything else on the board.

If I cut A0–A7 lines from spectrum (by an adapter board), PSRAM self test passes. So it feels like the Spectrum’s bus noise or ground garbage is messing with the PSRAM/flash.

gpt suggests the following

– Separate ZX/buffer ground and tie it to main ground at one point?
– Add ferrite or resistors between ZX 3V3 and main 3V3?
– Series resistors on each ZX line?
– Some shielding or layout trick I’m missing?

But I am just a beep boop guy I don't know this high rf woodoo magic. RP2350 runs at 280mhz, PSRAM is driven at around 100 and spectrum is only 3mhz.
>>
File: LMP.png (34 KB, 763x445)
34 KB
34 KB PNG
I'm planning to use an LMP91000 to measure signals from a 3-lead electrochemical cell. Has anyone here worked with the TIA or similar setups?
Is it easy to implement ?
>>
>>2955036
You forgot the easiest thing to try—start soldering decoupling caps in random places.
Also, make sure the zx has any old caps replaced and it wouldn’t hurt to add decoupling caps there, either.
>>
>>2955332
I actually have like 15 of them - the pic doesn't show them all
>>
>>2955036
I'm seeing lots and lots of broken attempted ground planes with traces crossing them and very few stitching vias, both of which are no bueno for noise since AC signals are going to travel all around your board without a short low impedance path to ground.
I suggest switching to a 4 layer board with dedicated ground layers or completely redoing your layout while keeping traces on one side of the board to a minimum
>>
>>2955592
ah, I've already sent this version for production - i've taken PSRAM chip closer, made CS line shorter, and in a follow up pic put ground plane for ZX buffers into a separate region.
>>
>>2955592
>>2955611
This is selected area of special ground plane I've made for the buffers, as these are leaking per gpt. I've mead a single ground tie so hopefully that current on those buffers goes back to ZX instead of affecting PSRAM.
I've also removed ground plane under 0-7 pins between buffer and CPU so they wouldn't radiate into psram as much.

Hope that helps, I don't know what I am doing.

>stitching vias
You're saying just cross planes with vias to make ground plane more uniform?
>>
File: 1761001230425091.gif (2.97 MB, 360x199)
2.97 MB
2.97 MB GIF
>>2955612
Single ground tie makes for a pretty bad high frequency ground and removing the ground plane under pins means they're now radiating more than if they had a plane under them

>as these are leaking per gpt
ChatGPT is terrible at electronics. Look at any artbyrobot thread for what happens when you rely on chatGPT.

Stitching vias are for connecting ground planes together, but I posted that before realizing your top plane is 3V3 instead of ground. Having a power plane like that is probably overkill for whatever you're doing and complicates routing compared to properly sized traces.

I highly recommend this channel for a good intro to SI if you don't have time to watch/read lots of Eric Bogatin interviews or articles
https://www.youtube.com/@HansRosenberg74/videos
>>
>work inna factory
>factory heavily dependent on compressed air
>we have 3 air compressors for this purpose
>no centralized controls for them
>me and coworker short of obsessed with optimizing their load/unload settings
>reached a point where we need to check if, and how often, a specific compressor unloads
>go no data collection in the compressor about this
>slap together a breadboard with an ESP32C3 and a SSD1306 to hook up to a NC switch on the compressor's main contactor
It simply counts how long it's been on for and how many times the contactor has shut off and prints it to the display. Gonna leave it over the weekend and see what it says.

This microcontroller shit is useful. Glad I got into it recently.
>>
just ordered like 15 CH32V003 dev boards since they were under a dollar a piece

did I fuck up?
>>
>order random T48 set off of Amazon
>have to install the right libusb-dev to build minipro
>even worse fuckery trying to get it installed on an old Mac too, but I think I got it working
>try to run algorithm extract script
>it locks up in one of the steps to extract from the .exe
>have to fuck around with the script to get it to extract successfully
>finally get it working
>realize after all that fucking around that the algorithms were probably only needed for T56/T76 anyhow, but I don't care
>realize that it had a really old firmware on it
>more fucking around to find the appropriate update file
>get it updated from linux, no winderz were used during this
Anyhow, I was able to write to a little 12F519 chip that I had lying around, and read some random EPROMs.
>>
CH32V003J4M6's are pretty fucking nuts, price-wise.
>>
>>2955615
Amazing input thanks anon
>>
File: 1733544297188231.jpg (50 KB, 510x546)
50 KB
50 KB JPG
>>2955869
Glad to help! Good layout isn't as mystical as it seems once you know where to start looking
>>
File: 1644897180752.png (41 KB, 600x600)
41 KB
41 KB PNG
>>2952647
anyone here do any x86 assembly, specifically 64 bit? i know it's not a microcontroller isa but just asking.
>>
>>2955615
>ChatGPT is terrible at electronics
it really is. fucking retard gpt
>>
>>2952647
I finished a simple, two-day script to log data from an accelerometer with my arduino. It would have been one day, if not for some file on my SD that was broken and kept the getNextFileName() function in a loop.
I'll calculate how strong the acceleration forces are for the people who drive in my household, to see why they say I'm driving badly. This is to improve my driving skills, not to prove that they drive just as badly. No, I'm not resentful.
>>
>>2955937
Nothing like spite to push a project onwards. Personally I bought a handful of openlog modules for data logging projects, tiny cheap boards with a 328P on one side and a micro-SD slot on the other side, with some I/O pins broken out. Haven’t needed one yet, but it’s only a matter of time.
>>
>>2955878
a little bit, why?
>>
quick question here: I'm trying to identify the pins of the micro usb port here, and it seems that VCC and GND are both connected to the circled connection. is that normal?
>>
https://store.steampowered.com/app/2198800/CRUMB_Circuit_Simulator/

Anyone tried this?
>>
File: 1734212560931457.png (383 KB, 1280x720)
383 KB
383 KB PNG
>mfw reading ARM assembly
>>
>>2953146
i recall circa 2016 reading somewhere that half of mcus of the "real industry" produced still were 4bit systems. i.e. programmable industrial thermostats, proximity sensors etc.
Anyway, the mcu programming example from 'the art of electronics II' on MC6800 , a 50yo 8bit controller... it's how cool guys are doing stuff.
>>2953255
>8bit MCUs are going extinct
zoomers are brain damaged
>>2953086
pics are fun. pics are also retarded. A lot of critical infrastructure still use them, a lot of oldtimers respect them.
>>2953131
asm is pretty much descriptive. it's just one abstraction layer away from C. You can write programs in x86_64 asm for pc also.
>32-bit PICs that surely nobody programs in ASM
wtf are you talking about. If you write bootloaders, you will most likely be involved in ASM.
>>
>>2955878
The loss of things like the Geode x86 SOC from Nat Semi/Cyrix/AMD is a travesty.
There’s no good reason they can’t take a single 64-bit efficiency core with no vector/fp … add some peripherals… and sell it into the embedded market.
It would crush, even at bigger process fab sizes.

The only thing that prevents them is the world using it to run Windows XP again on a $10 dev board, but faster than it did in it’s era.
>>
>>2956369
>is it normal that the USB port that supplies power was designed to make a short circuit?
No. How did you determine that? Try plugging it in, and if the charger instantly heats up like a water heater, you were right to ask.
Otherwise, get your multimeter again, put one probe on GND, and with the other, check the voltage of the far left and far right pins.
>>
>>2955878
>x86 assembly
I've always thought about doing it as a pastime riddle but what's the point(besides creating some memory stealing exploit) BC C language basically allows for the same abstraction layer.
I've always thought of doing some parts in asm so that retards fuck shit up when trying to use my code.
>>
File: file.png (15 KB, 961x136)
15 KB
15 KB PNG
>this week on "Things That Compile with Absolutely Zero Fucking Complaints from -Wpedantic"...
>>
File: microGod.jpg (452 KB, 2637x2572)
452 KB
452 KB JPG
I AM THE KING OF THE MAGNETIC FIELD
THERE IS NO CHANGE IN MY LOCAL MAGNETIC FIELD THAT I CANNOT SENSE

FEAR MY POWER
>>
>>2957192
Whats the plan here? Are you hunting ghosts?
>>
>>2957192
>slight breeze through room
>all readings are off
I hope you tape that stuff to a solid surface.
>>
File: magnetGOD.jpg (1.03 MB, 1929x1718)
1.03 MB
1.03 MB JPG
>>2957302
>I hope you tape that stuff to a solid surface.
...Is would I would say...

IF I WERENT THE KING OF THE MAGNETIC FIELD

you think my readings with be CONFINED to the dimensions of 2D? That they will need a HORIZONTAL PLANE to be EFFECTIVE?

hah HAH hhaha HAHAHAHAHAHAHA

BEHOLD 6 DEGREES OF FREEDOM ACCELEROMETER AND GYROSCOPE

THE BREEZE WILL SIMPLY BE DATA to be ERASED by the power of MATH

the X Y Z axis will be DEFINED to the PERAMITERS of WHERE EVER THE FUCK I WANT THEM TO BE
the TYRANNY of MOVEMENT and BEING UPSIDE DOWN has been USERPED BY TECHNOLOGY
>>
File: sweatysneek.png (31 KB, 207x215)
31 KB
31 KB PNG
>>2957297
i... are ghost something that might mess with my magnetic field.... i... is that something I need to worry about ....?
>>
>>2957367
>THE BREEZE WILL SIMPLY BE DATA to be ERASED by the power of MATH
Sure, but you'll still need to tie the other boards to those, or the bending of the wires relative to the boards will offset your readings.
>>
Hello, noob question ahead:
I've never used microcontrollers, if I wanted to make a simple rechargeable (maybe) battery powered lcd timer (just a learning project) what board should I use? I think I have a chink arduino nano clone I bought on a whim lying around
>>
Well first, just know that LCD anything except for those common (mostly 2x20) displays is a pain in the ass.
But yeah, this sounds like a standard Arduino project. Start with something talking to the display, then get it counting time, then make it count the right way, then figure out how to hook it up to a battery bank.
The important thing is one step at a time. Don't try to do too many new things at once with hardware or you will get stuck and unable to figure out what's wrong. You don't go from zero to a 6502 computer or an MP3 player. Break it up into steps.
>>
>>2957421
I really underestimated how easy it would be to make a functioning quaternions now I feel like udder fool :( I thought I was a master of magnets but I was only a master of my own hubris
>>
>>2957727
> a chink arduino nano clone
Almost anything would do for a timer.
Might as well re-use the nano clone.
>>2957763
> lcds are a pain in the ass
Agreed. If you are clever, you could use one or two LED 7-segment displays. (e.g. 9 hour, hour granularity display/separate minute display and set)
> rechargeable
That’s not a real requirement. Any battery powered device could also be hard-wired and vice-versa.
>>
>>2957822
Anon, IMU fusion is a modern marvel of mathematics that took 6 decades of work by the world's smartest people to develop. There is no way you could understand it in a single day.
>>
Does anyone know why these types of drivers have separate +5V inputs for the pulse, direction and enable? I mean everyone seems to just wire them in parallel so why not just bridge them internally?
>>
>>2957924
A: they can be used as differential inputs for better noise immunity
B: they’re internally connected to optocouplers
Probably the former
>>
What is the current software situation in general? I'm tired of broken vendor IDEs and bloated HAL libraries that eat up flash just to perform basic functions. Should I just throw out everything and deal with registers directly? GPIO is easy enough to get going but something like I2C is going to take a while to figure out on 32-bit micros.
I'm tempted to learn forth to avoid bloat and enjoy simple interactive development and ability to just connect over serial to develop without any special tools, even if I'm stranded at some remote location with nothing but bluetooth serial module and a phone.
Does anyone have experience in forth? Is it possible to develop reliable software with advanced features multitasking and using advanced peripherals like DMA? How do you even handle interrupts in forth? Can I even implement efficient digital filters in it? It seems to me it's only good for simple automation tasks, but it becomes very difficult to work with it if you want to develop advanced algorithms or deal with non trivial data structures.
>>
>>2957827
>Almost anything would do for a timer.
I see, that's nice to know, thanks!
>>
>>2957763
Thanks for the advice, that makes a lot of sense to make starting out less daunting. I found the wokwi arduino simulator and I started screwing around with it a little just to get a feeling for the coding. But I think I'll go with externally recharged batteries to save myself some hassle for now
>>
>>2957978
>But I think I'll go with externally recharged batteries to save myself some hassle for now
Well yeah, duh. Kids these days don't know how good they have it with 2 watt USB power bricks and hueg lithium ion battery packs being thrift store trash. Most of the time you don't even need to waste your time autistically cutting power usage.
When I was a kid I had to deal with my parents freaking out over wanting to make a 7805-based power supply from radio shack parts. (and I still have it)
>>
>>2957974
PlatformIO is passable, if you hate Electron apps then text editor and command-line compilation and flashing it is. Assuming you can’t stand skins of Eclipse. No clue how to automate the makefile or import the hardware specific syntax highlighting of register and bitmask names though.

Direct register manipulation in C is probably the way forwards, but even if the vendor HAL is bloated there’s nothing stopping you from writing your own extensive macros for simplifying the process of setting up timers and ADCs and such. Spend a few hours figuring it out once, and you’re good for life. C compiles well for most MCUs out there, especially 32-bits, I wouldn’t trade it for anything unless I had a hardware-based reason to.
>>
any1 know how I can get my mkl25z128 to not hardfault when there is a floating point specifier in sprintf (`sprintf(perkele, "ADC: %d , voltage: %.2f",adcval,voltag)`)
I tried using -u _printf_float in the linker option in keil but it says it does not recognize it. perkele is big enough.
>>
>>2957297
Holy crap you weren't joking. Using an AS5600 combined with the IMU, there are spooky magnetic fields that pass by all the time. Some of them even move slow enough to look like human walking.
>>
>>2958269
I tend to use and do everything in integer math. Especially on embedded systems.
Multiply your voltag by, say, 1000, do stuff, then prnt it out as mV or insert a . three places to the left.
>>
File: Img 7491-1-1.mp4 (2.26 MB, 1280x720)
2.26 MB
2.26 MB MP4
greetings.
attempting to make a genlockable analog sync generator using a EPM240 fpga, stumbed upon a problem with horizontal sync separaton - it doesn't play nice with vertical interval.
composite sync is pre-separated with LM1881 and is lowered from 5 to 3.3v via voltage divider.
fpga program in verilog simulates a one shot multivibrator with a timer, simulation seems to separate sync just fine but on hardware this happens.
is this a code issue or should i drop this idea altogether and use a regular flip-flop for that instead?
>>
>>2958415
> 3.3 volts
The device probably runs natively at less than 1.8 V so 3.3 is pushing the upper limit there. I’d level shift it down some more and clamp it to some threshold. The logic levels might not be right either.
> and use a regular flip-flop
Almost certainly.
Fpga is n^n^n overkill. Plus the discrete logic will be much more voltage tolerant.
>>
>>2953044
Midwits love gatekeeping. There is nothing wrong with arduino. Its simple intuitive and fit for 90% of stuff.
>>
>>2953255
>8bit MCUs are going extinct
Whole industry runs on it. For 90% of things you dont need more.
Please telll me reasonable home project that needs more.
>>
>>2958494
Arduino is garbage on a technical level. And since idiots flock to it, its ecosystem is garbage too.
That's not saying it's not useful or that you can't use it. It's like eating fast food.
>>
>>2958502
>its ecosystem is garbage too
I see people say this, but then it's like, I try to make something using a PIC, and there is a $500 paywall for stack libraries, that you still need to do 40 hours of debugging on to get working well

then its like, it's already free on Arduino and it actually works
>>
File: rb_pico_2.png (318 KB, 1160x1902)
318 KB
318 KB PNG
Embassy is cute, Rust's stackless coroutines are the perfect fit for 32-bit MCUs.
>>
>>2958553
This is unreadable garbage. Main job of a programming language is to clearly communicate the computational process. No wonder rust programmers have trouble implementing even basic software like core utils without having logical bugs everywhere. So much noise just to implement a basic task. For what?
>>
File: 1763467720460095.png (23 KB, 385x489)
23 KB
23 KB PNG
>>2958554
>but muh memory safteez
The other problem with rust programmers is a compulsion to rewrite fucking everything from scratch. Starting with the bottom of the stack.
>>
>>2958554
> a programming language I don't know is unreadable for me
What are you trying to say? Everything is unreadable if you're illiterate.

But my point is not the syntax, which is fine; it's the ability to conceptualize your uC code as a collection of pseudo-parallel infinite loops communicating via mutexes or channels, each sleeping independently. All this for zero-cost performance-wise. That's a nice abstraction to have.

>>2958563
Yes, I'm trying to rewrite a two-button and an LED test project from scratch, shame on me.
>>
>>2958567
>Everything is unreadable if you're illiterate.
I'm just questioning a choice of using Qinjiang Mandarin when english works perfectly fine for what you're trying to accomplish. You might understand your code now but what about in 5 years from now? I can modify my old C code perfectly fine even if I don't look at it for years because language is so small as there is no complex abstractions that you have to keep in your head. It might be zero cost performance, but it's not zero cost maintenance. I already have to understand underlying hardware which is complex enough and now I would have to add another layer of complexity with language just as complex as hardware below?
>>
>>2958578
> english works perfectly fine
To continue your analogy, English may work perfectly fine when you discuss Shakespeare, but if you try to discuss Confucius, English is a poor choice, because you'll have to spend a lot of time expressing all the nuances a single Chinese character has. That's why most people outside the US actually learn foreign languages.

> what about in 5 years from now?
I will understand it just as well? How is it different from any other programming language? There's nothing inherently hard about Rust once you spend some time learning it - just like any other programming language. You have a strange conception of Rust and its complexity, just from seeing a couple of syntactic elements you're unfamiliar with.

> language is so small as there is no complex abstractions that you have to keep in your head
That's the other way around, C is so primitive you have to keep all the abstractions - like variables' lifetimes, coroutines' states, error handling - in your head. Try expressing in C an equivalent of the `.await` operator. Sure, it's possible, but the complexity you'll have to deal with will be enormous.

> add another layer of complexity
By that logic, you should use pure asm since it's the simplest, most abstraction-free way to program uCs. You don't have to learn all that confusing stuff about types, functions, control structures, memory allocation, and so on.
>>
>>2958589
I'm not sure about all of this. I see software getting worse day by day. Rust coreutils meme is a perfect example of this. If it is truly a superior language why is it so difficult to implement same software in it? You even have a 100% working reference so all you need to do is translate C to Rust - you don't even need to think about implementation details and edge cases and yet the result is buggy mess. I remember servo web engine, so much hype and where it is now? Compare that to ladybird which is written in C++ and coming along nicely. I don't know of any successful rust project expect maybe that butt plug firmware thing. We were promised bug free utopia if we convert, but all we got in the end was longer compile times for existing software and another set of dependencies.
>>
>>2958595
> Rust coreutils meme
This entire situation is Ubuntu's fault, I have no idea why they decided to ship a beta package, according to the package authors themselves. It has little to do with Rust. GNU coreutils is a large project with 40 years of history, no other coreutils implementation - BSD or busybox - even tries to replicate it.
> all you need to do is translate C to Rust
The goal is to reimplement it in idiomatic Rust, not to "translate" it from C.
> remember servo web engine, so much hype and where it is now?
Here: https://servo.org/ . A lot of Rust code from it has been in use by mainline Firefox for 5+ years now.
> I don't know of any successful rust project
That tells more about you, desu. Rust is used in the Windows and Linux kernels, both Chrome and Firefox, by AWS and Cloudflare. Both Microsoft and Google report a lot of positive results from adopting it and plan to expand its usare further. The majority of new code in Android is Rust now: https://security.googleblog.com/2025/11/rust-in-android-move-fast-fix-things.html .

I'm not trying to evangelise, I was sharing my positive experience with a tool. This knee-jerk Rust-bashing reeks of nocoders from /g/ and the Lindjew's engagement baiting.
>>
>>2958567
> 32 bit mcu
> mutexes or channels
> zero cost
I think those have a cost.
> flashing leds
Post code size.
32-bit Gaming PC Class “microcontrollers” with near infinite memory were a mistake.
Post code size.
>>
>>2958269
To print a float it needs to convert it from binary to decimal, maybe there’s no valid subroutine for that. Floating point is cringe, fixed-point is the way to go.

>>2958553
I was under the impression that any dynamic memory management was less suited for compiling onto a microcontroller, but that’s just an impression from writing code for AVRs with no need for memory reallocation. It would be interesting to see how efficiently (memory usage, lines of required code, and execution speed) different programming languages compile onto different architectures. Rust, or maybe Haskell or Erlang or whatever, might be a good fit onto some.
>>
>>2958596
> Rust is used in the Windows and Linux kernels
Not to any significant degree. There was prolog in there at one point, too, for network initialization. Nobody went hyper-religious about prolog claiming “everybody is doing it… look at this big company”
> Chrome and Firefox, Android
These are not technical companies driven by technical excellence. They’re run exclusively be mba grads/dropouts and their core competency is advertising, data mining, and selling user data. It’s not an endorsement: I see them hyperventilate over some new fad run the other way because it’s probably a scam. It needs to stand on it’s own merits, not because some internet rando made post about it.

When rust makes it into flight control software, I stop flying.
If rust starts managing the control rods in a nuclear power plant, I move to germany.
I’m going to be in great shape when rust starts running brake systems in electric cars because I’m biking everywhere after that.

Also, let me know when it can target 8051.
>>
>>2958553
> look at my fancy pragmata pro font I used on my helix editor using the wheatgrass theme on my 8K monitor.
> you’re not looking at me..
> LOOK AT ME
>>
>>2958658
>tfw using a teensy 4.1 to drive a TMR keyboard and the jitter filter + QMK is 1 mb
>>
>>2958553
Come back when you learn how to flash a LED in in 18 bytes of machine code and a (generous) 2 bytes of RAM.
Also run the entire development process and tool chain on the microcontroller itself. Because the new millennium is upon us, you can use a wyse serial terminal. We don’t want to be luddites here, now do we?
>>
>>2958589
>English may work perfectly fine when you discuss Shakespeare, but if you try to discuss Confucius, English is a poor choice, because you'll have to spend a lot of time expressing all the nuances a single Chinese character has.

Reading shakespear and reading confucios paralels to maintaining legacy software not to writing new books aka creating new stuff.
By the time you learn Mandaring writing to be able to express sex using horse character and a spear character meaning of which will be lost on 90% of the readers another person will write 10 books in english meaning of which will be more clear and whos message will spread far.
I can master whole history and meaning of confucios in english while you studdy chinese.
I will know what temper his 15th mistress had by the time you read the first page.
>>
>>2958553
What the fuck is this vomit. If that's supposed to be the future of low-level programming, then I'm quitting my job and gonna switch to farming or something.
>>
>>2958567
>That's a nice abstraction to have.
This sounds horrible, like a fragile javascript mess that fucks up whenever you make "unexpected" clicks or your network connection has a latency too high.
>>
>>2958775
even the font wears programming socks
>>
>>2958775
> vomit
It was written in such a way to be intentionally outrageous. You don’t have to write it that way. In fact, it’s not even recommended.
It was designed to look (and, in fact, *be* crazy) yet there’s nothing you can do about it. Regardless of how many times it takes down the internet or kills people in software controlling brakes, planes, or medical software, it will proceed to take over the software world. All you can do is stand by and watch and be outraged. That’s real power right there. If it wasn’t “rust” it would be some other unnecessarily obscure language. It’s literally the “newspeak” idea from 1984. Everything else has to go into the memory hole, and you C guys will end up being gatekept. C++ went fown the same path. Full-blown C++ using every feature of C++26 is just as unrecognizable and crazy looking as Rust.
>>
>>2958919
As a C++ programmer this is absolutely true. If you use every possible feature in C++26, the code would be incomprehensible to someone who targets C++11, say.
>>
>>2958919
Even "sane" Rust code looks like shit.
>>
>>2955870
>>2955615
>>2955592
After watching this dude's vids I made another revision making sure return currents from zx lines stay away and it worked, no noise.

Fucking sorcery.
>>
>>2959150
Congrats! Now you can put "Signal Integrity" on your resume and still not get any interviews for jobs you're more than qualified for
>>
File: 0a1.jpg (75 KB, 576x768)
75 KB
75 KB JPG
Now, I ain't really the type of guy who likes debating about programming languages since I just get excited by pressing a button and toggling an LED, but is there a Rust compiler for Atmega microprocessors? If so, is there a repository full of example programs for Arduino written on Rust?
>>
>>2959228
> 8-bit mcu
There will be, as soon as atmega becomes 64 bit with sse4 and avx512 and runs the amd_64 instruction set using ubuntu linux.
>>
Hi guise, this is probably a noob question but here goes, I’m working on a midi interface thing on teensy and i want to add a little function that records a sequence of midi notes in real time and then loops it . Basic idea for the program is
>press record button (timer starts running from 0 onwards)
>if a midi message is received, note the time , the message type and the data in some sort of log
>when the
>>
>>2959236
You coulda just Googled it and said "Yeah, there is one" (which is what I found out after I did), or if you didn't wanna do that, you could've used the usual "Google is your friend". No need to talk with such confidence about purely speculative stuff.
>>
>>2959255 (wew check ‘em)
Fuck hadn’t finished
>when the stop recording button is pressed a final line is written in the log file
So after that the log should look like
>time - message type - -data 1 - data2
>0000 Start.
>0040 NoteOn Note Velocity
>0050 NoteOff Note Velocity
>0060 Stop
Then when i press play another timer starts running, the value of the timer being compared to the time entries in the log file, then when the value of the timer is equal to a value in the log, the corresponding note is sent to the midi device. When it reaches the stop line (0060 in this case) the timer resets to zero and starts reading from the beginning again. This is probably pretty simple but i have no idea how to create some kind of short term event log. Anybody know a simple way of achieving this?
>>
>>2959259
Ask chatgpt.
>>
File: pico_2w_buzzer.png (273 KB, 944x1825)
273 KB
273 KB PNG
Looks like you guys have nothing to talk about besides Rust, so here's the next tutorial project.

>>2958659
> I was under the impression that any dynamic memory management was less suited for compiling onto a microcontroller,
There's no dynamic memory allocation out of the box as it's #[no_std], you have to use a separate allocator like https://github.com/rust-embedded/embedded-alloc .

>>2958663
It's Iosevka with vanilla solarized-light theme.

>>2958698
I know how to flash an LED without any code, m8.

>>2958662
>>2958775
Chill out, m8s, there's no need to be triggered, it's just a programming language.
>>
>>2958658
The ELF is 48kb, the text section is 16Kb, and the rest is the symbol table, which I guess could be truncated to only the symbols the uC needs to load the binary. Most of the 16Kb is the library, which will stay the same. I'm using RB Pico 2W with 2Mb flash and 520Kb of SRAM.
>>
>>2959268
No thanks I don’t talk to clankers
>>
>>2959273
So ::new is stack allocation?
>>
>>2959259
>Anybody know a simple way of achieving this?
Yes
In recording mode you keep a 32-bit hardware timer running and record USART input bytes when they come, with delta timestamps, to the teensy's ram, until recording mode is stopped.
In playback mode you also loop through the delta timestamps + midi bytes log, delay for the appropriate time for each one, then emit the corresponding byte out via USART, then loop at the end.
>>
>>2959279
Yes. Technically, it's just a static method that returns the struct by value: https://github.com/embassy-rs/embassy/blob/main/embassy-rp/src/gpio.rs#L125 . It may initialize the fields however it likes, but the struct itself is guaranteed to be RVO'd and be put on the stack. In practice, it's most likely inlined. To allocate on the heap you'd use `Box::new`.
>>
File: short.png (564 KB, 1406x1966)
564 KB
564 KB PNG
Also fuck freenove for not protecting the 31st pin with a register in this example. The uC had it on OUT/High when I connected the RP to USB, and the potentiometer was all the way to the right, meaning I had a short. Everything is fine, but the potentiometer still smells like burnt plastic.
>>
>>2959273
>it's just a programming language.
Just a programming language with followers so mentally ill and fanatical that the community routinely has discussions on how they conduct public relations.
>>
File: rusty-packard.jpg (144 KB, 592x448)
144 KB
144 KB JPG
>>2959286
Just a programming language that brought down half the internet because someone wrote code like a fucking 1st year CS student by declaring a fixed-size array, which fails when the prof runs it with his own test input. And then calling a function that should never be used in production code.
>BUT IT WAS MEMORY-SAFE
>>
>>2959285
Or add a series resistor as a safety margin giving a minimum resistance. Many pots and transistors perished when I was experimenting with current sources and amplifier circuits until I learned to add always add one even if just testing that one thing real quick.
>>
>>2959290
lol. And just recently ubuntu is redoing a lot of coreutils in rust. Last week sudo-rs was found to have multiple security vulnerabilities.
Another day, another overconfident Rust zealot "fixing" something that wasn't broken.
>>
im working on a project where i want to pair a mc to a raspi over bt to have it accept serial data and have it drive a cheapo usb display from that serial data. so far im playing with a raspi pico 2 w and its annoying as hell. i dont actually know if ill be able to drive the usb display at all yet because tinyusb is daunting and frankly all the documentation and examples for the rp2350 seem bad. are esp32 boards any better?
>>
>>2959434
If you want something easy to code, I'd suggest you to use an LCD or OLED display you can connect to through I2C. Leave USB stuff for when you actually want to learn about the USB protocol.
>>
>>2959436
ive managed to get an i2c display working so far, but the one i have is very unimpressive and its resolution is too low to drive a usable TUI on it (monocolor 128x64 px).

the usb display i have is the WeAct Studio Display FS V1 which is an rgb565 160x80 px display. its just barely large enough that i feel i could use it for a TUI and also use color to add functionality given the limited display realestate.

at some point im going to have to come up with an optics solution because the plan is to mount the device near my eye, but id imagine that a larger resolution would help a lot with this and give me more leeway with font rendering.
>>
>>2959430
Why are they like this. Why are they fucking up everything. Seriously mentally ill robots.
>>
>>2958596
>and Cloudflare
*unwraps your internets*
>>
>>2959438
If you haven’t seen him already, check out the AR and VR stuff done by Mañolo on youtube. He has a variety of different displays that are all quite compact and cost optimised.

I would go out of your way to find a display that runs on something other than USB or HDMI, for high density displays like you’re suggesting I’d be looking for something along the lines of SPI, maybe with parallel data lines. Whatever it is, you likely don’t want to have to bit-bang it, so you may have to select a microcontroller with more specialised hardware. The ESP32 uses QSPI if I recall, otherwise most manufacturers with a dozen or two 32-bit chips in a family have some that are specialised in having unique interconnect options.
>>
>>2959440
it's the same soi attitude that caused systemd
>>
>>2959465
The fuck systemd has to do with Rust? It's written in C. Besides, the systemd drama was like 15 years ago, everyone has moved on a long time ago. It's almost like you snowflakes enjoy being permanently outraged at something.
>>
>>2959531
I don't know what exactly he meant, but systemd is still being shit at present. Absolute fucking trash.
>>
>>2959531
It's the urge to rewrite something that is working just fine, because NEW THING BETTER.
>>
>>2959621
There is nothing wrong with improving something. But the systemd "philosophy" is something like hardcoding the thing they wanted, and broadening the scope of the project to anything they think they should "improve" and making it part of systemd. This is why systemd is an init system with a DNS server.
>>
>>2959531
Systemd broke my system twice because of its trash DNS resolver, so I just disable it now. It's a bug they just ignored because they are unable to understand the issue, because they're stupid fucking faggots. https://github.com/systemd/systemd/issues/13432 - issue closed, no plans to fix, and they don't even recognize it as being a problem.
>>
>>2959657
Why not use an OS designed not to be reliant on systemd? Like Artix or Devuan.
>>
>>2959280
Thanks this was the kind of reply i was looking for, keep in mind i haven’t programmed since high school so prepare for dumb questions but first the part I figured out , i create a buffer that contains the midi data and the timestamp and send that to a DMA channel, then in playback mode it reads this back from the start timestamp and sends the data out after corresponding delay times and looping back at the stop timestamp? , i do have some questions though
>32bit hardware timer
Does elapsedmicros use this? I’ve seen this used for measuring time measurement but idk if the hardware timer you’re mentioning is something different entirely.
>USART
is this an alternative way of spelling uart? It doesn’t return much on google by itself, and neither do the delta timestamps, i did however find this thread on some forum :
https://forum.pjrc.com/index.php?threads/teensy-3-6-add-timestamps-to-dma-transfers.43470/ Is this guy trying to do what i’m trying to do?? Does it make sense to comb through his code for inspiration?
>>
>>2954113
>for a useless degree
you seem pretty knowledgeable. What degree did you get?
>>
>>2960151
Physics. I guess some of the papers helped with my interest in electronics, but I’d have gotten there sooner or later. Not that the me now would hire the me out of high school for any skilled work. I was high on my own ego, I guess barely passing uni surrounded by smarter people was a humbling experience, but it took me another few years for that lesson to settle in.

As I am now I have a breadth of knowledge with depth in a few areas, solely from experimenting, setting myself lofty goals, and running into roadblock after roadblock. Most of those roadblocks are self-inflicted though, deliberately doing things the hard way.
>>
>>2960156
what field are you in? are u doing this out of a hobby?
>>
>want to do a fire effect
>use tardunio because lazy and I don't want to setup my workspace on my new PC
>a few analog writes and random calls
>"error: you are using 120% of available code space"
I mean it is attiny13 but what is arduino dragging into the project to add that much overhead
>>
>>2960159
Oh no I’ve been working retail for 6 years now. My knowledge comes in handy selling solar charge controllers and resistors and such, plus I meet people for jobs on the side, but I’m not easy to hire. The local volunteer repair org is fun though.

>>2960184
I also use tiny13s. They have plenty of memory if you:
>never use floats or division
>be careful with regards to multiplication since that’s done via an addition-based routine, and anything else that it doesn’t have hardware for
>don’t use any libraries unless you absolutely have to and have compared all alternative libraries
Those random calls will be your issue. Either I’d get random noise from an ADC sample on a floating pin, or code up an LFSR. 8 bits means 255 states, which is probably fine for a fire sim. But that is four taps, a 7-bit LFSR only needs two taps if you’re pressed for space. It doesn’t have an XOR instruction, bitwise or no, but you can probably trust your compiler to do that without eating up too much space.

The worst bottleneck as far as I’m concerned is the presence of just one timer, with no input capture for that timer either. I2C would be nice too.
>>
>>2960184
You wanted your C++ library, you got your C++ library.
>>
File: leftyshooter 8 ball.png (22 KB, 419x218)
22 KB
22 KB PNG
>>2952647
how dumb is this?
>put a fairly basic microcontroller battery, screen, accelerometer, and charger inside of a (reasonably small) SPENT bullet casing
>program the mcu to when shaken, it displays a random or randomly generated reddit comment on the screen
id think of it like a magic 8 ball, but instead of random wise 'thoughts', its the thoughts of mentally ill internet losers instead?
>>
>>2960402
Dumb in the sense that IDK why the fuck you would do it, but you could I guess. Could easily preload millions of comments into a flash chip/micro sd card.
The concern IMO would be battery life. Unless you have a power switch, or use deep sleep modes and a very low power accelerometer, it wouldn't last long.
>>
>>2952647
Hi everyone, would like to consult your expertise,
do you have recommendations for automotive sector ? i already did some CAN loggers, looking for inspiration ,i'm also interested in the growing trend of automotive Ethernet , but documentation seems scarces, i would realy like to get into it tho...
>>
hello sars. I'm thinking of making a pull-up counter as my first project. The idea is sticking an esp32 + a module that detects movement on top of the pull up bar that sends the records to my server through wifi. What should I put in the aliexpress basket? Also, does this sound reasonable for a first project? I don't think it's too advanced, is it?
> previous exp
have done some esp32 projects in college (as a comp sci major) but my recollection is quite bad.
>>
>>2960402
i like it. please provide a follow up
>>
Hallo SAAARS I wuz thinkin of making a grand total of 3 LEDs blinks cuz two is overdone and I want to use a non-deterministic machine learning-driven algorithm. Being as it is, alas, I was reincarnated in this life not as the son of a maharajah but as a poor sorghum farmer's illegitimate child, whence I must incur strong budget constraints and use the least expensive mu cee I can get my hands on.
Therefore I do beseech ye, my good sires, that ye may be of great aid unto me and that ye may recommend me a myoo cee available in the Islamic Republic of Pakistan at an extremely low price so as to engage in the endeavour I have in mind, not withstanding the constraint of being able to run something akin to TinyML.
>>
>>2961468
Woe to thee brother, alas if you were born white, you could aim for the lofty heights of 6 blinking LEDs. kinkartavyavimoodh!!!
>>
>>2961559
this is the most niggerlichious way to get 6 leds to blink ive ever seen in my life
>>
File: 1750521820788889.png (462 KB, 1337x521)
462 KB
462 KB PNG
gonna be modding some old oem rcontrollers for use on pc (with gp2040-ce software) as a first project and I want to dremel out a spot for a usb c port so I can use the same cord for all my controllers. what's the best way to go about wiring a pico to an external port? been reading about how usb c to c isn't a good idea so I'm at a loss.
and are there any recommended aliexpress picos or should I just go for a legit ones? the reviews basically look good on this one aside from the wifi which I don't care about anyway. open to other suggestions though if there's a known good chinese brand.
>>
>>2961559
I don't use breadboards I'm not a fucken bitch
>>
File: 1649707933060.gif (520 KB, 500x280)
520 KB
520 KB GIF
>>2963147
>this guy thinks he is cool because his projects take 30 mins to wire instead of 2
>>
I was wondering why esp32s arent used in commercial applications and turns out they are used. You cant beat that price if it needs wifi and or bluetooth. Its too powerful.
>>
>>2963430
Oh? Name where they’re used.
I’ve been doing embedded stuff for decades and I’ve never seen any.
I have seen AVR though, but never an actual “arduino” or clone.
>>
>>2963445
Just going by what gemini said. It said theyre used for smart appliances, cameras, etc…
>>
>>2963445
I've seen (and broke trying to mod) an IoT socket that used an 8266 and heard about lightbulbs using them, for what that's worth

>>2963452
>going by what gemini said
lmao
>>
>>2963463
Using the tensillica esp32 for a light bulb seems like n^nth degree overkill.
The light bulbs I’ve seen (e,g. the bluetooth osram sylvania) don’t use an esp, they use a realtek 72xx)
A lot of them, especially the later models, are going to burn out the programming allow fuse.
>>
>>2963445
>Oh? Name where they’re used.
https://templates.blakadder.com/esp32.html smart plugs, lights, etc
>>
Has qualcomm ruined arduino yet?
>>
>>2963961
Yes
>>
>>2963961
>implying it wasn't already ruined
>>
>>2963961
>they require your age to use the site now (so they don't get in trouble for selling kid's data)
>they claim all ownership of any code you share
>they're pushing for restrictions on commercial use
>they're pushing for cloud BS
It's dead Jim
>>
This piece of shit won't work properly no matter what I do. Wired the address pin to vcc but still the i2c scanner example from arduino detects a device only every few attempts, and the address on which it is varies a bit. What do
>>
>>2964030
More bypass capacitance
>>
File: PackagedRocks.jpg (386 KB, 1134x1500)
386 KB
386 KB JPG
>>2952647
Bros, I need a SBC for automotive applications (it will sit in my glovebox and handle dashcams + multimedia).
Here's what I need:
>Can handle two IMX678 at full tilt forever (12 bit, 60FPS, 4k)
>Do openCV on top
>Has enough connectivity for additional modules like GPS, accelerometer, etc.
>Runs fanless (cannot have a fire go off in my glovebox)
>Is energy efficient (needs to not drain my battery)
I'm not trying to find a unicorn that does all that and costs just 20 bucks, but I won't buy a 1000€+ SBC for proof of concept for a 4000€ shitbox.

I've got a few Rock Pi 4B+ sitting here, but they have only a single CSI connector each.
>>
>>2964091
> 5GB/s, GPS/glonass, Accel, etc
So, you probably need FPGAs.
Development boards are more expensive that end-user mass-produced products.
Good luck with your terrain mapping missile
>>
>>2964115
Goals are still a little floaty, I'm contemplating using the IMX585 instead after finding out about the fact that it is better in low light. I'm even considering lowering the resolution to FHD which would boost low light performance even more.
>So, you probably need FPGAs.
How so
>Development boards are more expensive that end-user mass-produced products.
I know. But I'm looking at the Rock 5B+ / 5T right now and if I actually go with FHD instead, it'll be more than capable enough for what I'm planning
>Good luck with your terrain mapping missile
The what. I'm building a DIY 24/7 dashcam + media-box
>>
>>2964091
>>2964126
Now I'm wondering: Where do I get my hands on an IMX585? The Ali sites only have a shitty IP-Camera with a proprietary board that absolutely sucks ass, other than that there's big ass systems for astro-photography that cost like 500 bucks.

I want something like this: https://radxa.com/products/accessories/camera4k/ just with an IMX585.
>>
>>2964015
Just corp shit.
>>
>>2964091
Rock Pis you are using are on RK3399 which is horribly inefficient and heats like a motherfucker. Switch to something on the newer RK3588, it's much faster and runs cooler. I used Orange Pi 5 and it has three CSI ports too. Also has NPU if you want to fiddle with AI on the camera feed.
>>
>>2964136
Yeah, I've pivoted to the Rock 5 (B+ or T, not sure yet), they also have the 3588(J):
https://radxa.com/products/rock5/5t/
>Also has NPU if you want to fiddle with AI on the camera feed.
That's the plan, I want to use OpenCV to blur faces.
>>
>>2964070
I wired it wrong, now it works luv
>>
Why did nobody tell me that jumper wires are unsolderable and I would waste hours debugging my UART?
>>
>>2964137
> Rock 5
It’s like $300.
You can buy a laptop for less than that
>>
>>2964136
>Orange Pi 5 and it has three CSI ports too
How do I actually use these? I have OrangePi 5 Pro.
None of the cameras made for r
Raspberry Pi fit.
Where can I buy cameras for this or do I need some adapter board?
>>
>>2964516
It needs its own dedicated camera module, look them up on aliexpress.
>>
I'm planning to wire an ultrasonic sensor to a small box with a screen that my parents can use to monitor their wastewater tank. For this, I'm looking for an assembly that has a microcontroller (virtually any) and a screen. I was thinking OLED. Does anyone know a good assembly I could use for it? I really don't care if it's a cheap atmel, esp32 or rp2040 or anything else.
>>
File: untitled.png (2 KB, 683x384)
2 KB
2 KB PNG
im trying to solder some shit into a pcb but the pin that goes into the pcb rings is very small and doesnt fully get past the pcb (like in right example of pic related)

can it still be soldered?
>>
>>2964713
If the pin touches the ring at all it sould be easy.
If its a plated through hole it shouldn't need to protrude at all to touch.
You just might need a smaller iron tip than you may be used to
>>
File: IMG_0302.jpg (1.34 MB, 4032x3024)
1.34 MB
1.34 MB JPG
>>2964717
why wouldnt it need to protrude?
>>
>>2964722
Do you understand the concept of a "plate-through hole"?
>>
>>2964631
aliexpress.com/item/1005010194288286.html ?
>>
File: output.webm (357 KB, 800x600)
357 KB
357 KB WEBM
Way late in the thread. Thinking of diving into embedded.

Anyone have a link to getting Vim set up for embedded C with the stm32?

I do all of my other coding in Vim, and I was hoping to not have to learn a new ide while I'm doing blinky lights and hello world.

>webm unrelated (a little game i programmed)
>>
>>2965633
Why would you need to "setup" vim for it? You just write C and compile it with a cross compiler to an elf. The only special step is converting the elf to something the target bootloader accepts, and putting it somewhere the bootloader can access (like flashing it).
>>
>>2965635
I'm unfamiliar even with some of the terminology you're using and feel retarded. Ok, I'll lurkmoar and just use the STM32CubeIDE from the tutorial until I get my legs under me; then, figure out how to do the stuff your talking about with preferred software.
>>
>>2965643
You can probably use the cross compiler from that IDE for now and still use vim to edit your files.
A cross compiler is something which runs on one platform, but generates binary code for another platform.
>>
>>2965650
I'm still a bit new. Literally just had first experience building from source and linking libraries for compilation in a way that wasn't automagically handled by apt last week. I'll get the hang of it. My Google searching for "how to do embedded on Vim" is pretty much a dead end of retards, like myself, asking questions wrong and being told to go away on SO and elsewhere. Lol.
>>
>>2965652
Just search for tutorials how to do embedded on the command line, preferably with make+Makefiles (and if not that, perhaps cmake, which is a completely different thing, considered industry standard by many, but I fucking hate it). You would just invoke make from vim to build your firmware.
Embedded compilation is exactly like on desktop, just that you need to use a toolchain and perhaps additional magic during linking and flashing (like linker scripts).
>>
>>2965656
Thanks brother. I'll get this into the notes, and check it out.
>>
>>2965657
Just a warning that make has a steep learning curve. Which some luck you might find a relatively minimal makefile that's not cluttered with nonsense.
>>
>>2965658
I'm honestly not even 100% sure how I got make working properly 6 months ago when I started learning C. Python was easy, but I'll have to revisit whatever the fuck i did to make shit compile when I started the CS50x course.

Even getting the Vim lsp autocomplete working and syntax highlighting for C was almost over my head. I feel very invested in Vim after all of that. Lol
>>
>>2965633
Use Emacs. If you want to have some bells and whistles, and you will, you will thank me for it. If you're not ready to let go of the vim key motions, use Doom Emacs, it has them built in by default.
>>
>>2965658
Even an empty makefile should still accept "make foo" and find foo.c and build it with defaults.
>>
Is it bad practice to only line-drive uart start and zero-bits on a rs485 line and not the one-bits because i can't distinguish between a one-bit and idle that comes out of the uart. It will work this way but i'm curious if this is common practice.
>>
>>2965698
RS-485 is differential, it's always driven one way or the other. If you take one of the sides (the negative?) and use ground as the other, you get RS-232. That's how the original Macintosh did it.
>>
File: 1280x698.png (89 KB, 1280x698)
89 KB
89 KB PNG
>>2965698
Picture added to clarify. I can only generate the blue level because ttl-uart doesn't distinguish between ones and the idle state and i don't want to send all ones on rs485 when idle.
>>2965703
>>
>>2965705
Do you even know how a UART works? That first zero is what's called a "start bit".
>>
>>2965698
What voltage levels are you using? If you're using an RS485 line transceiver IC, some of those ICs should have an extra output/input to indicate presence of an idle signal.

I assume you need to detect idle if you're using it as a multi-node bus, such that only one device affirms onto the bus at once?
>>
>>2965698
Maybe i'm bad at asking questions. Basically i'm just asking how a two level signal (uart) normally gets transported over a three-level bus (rs485). My solution was just send the zero bits then. Anyway.
>>2965713
>>
>>2965716
To get the tri-level output, you'd wire up an MCU pin to the enable pin of the RS485 driver half of the transceiver IC and that should work. You can probably actually use a UART hardware flow control pin to control the driver's enable input directly, as opposed to needing to bit-bang it. I don't see any need not to always enable the receiving hardware.
>>
>>2965721
Yes but when you just have a tx/rx coming out of something to work with then it's another story
>>
>>2965723
Ah so you have an existing UART signal and you want to send it across RS485? Where's the signal coming from? You could likely use a 555 timer or similar to enable the transceiver's output for a bit more than a full packet's width. I don't think it matters for the strict UART-speaking thing for it to sense when the bus is idle or not, maybe you'd want a pull-down resistor to ensure the default state is a zero when it's idle if the IC doesn't assert either way.
>>
>>2965723
>>2965740
Oh and either way, if it's just designed to produce UART, it won't be able to respond to a bus collision. If it ever tries to transmit data onto the bus while something else already started, the data will get jumbled for both packets.
>>
>>2965721
This. You need an extra signal to turn the RS-485 transmitter on and off. And of course on the receive side you have to ignore your own echos.
>>
File: file.png (112 KB, 840x822)
112 KB
112 KB PNG
>>2965754
>ignore your own echos
I figured if it were half-duplex (which it probably is but idk) then it wouldn't matter, but either way you could use the transmitter's enable signal to disable the receiver at the same time. Pic related is a chip from TI where the drive-enable and receiveenable pins have opposite polarity so it's as easy as connecting them together. Though it's not exactly a jellybean, it was the first one on TI's table and it's a $230 radiation hardened chip. The THVD1505 is more of a jellybean and has a basically identical diagram. Though the internal pull-downs and pull-ups will cancel.

Otherwise there might be smarter chips that actively handle idling the bus and bus collisions, and store data to an internal buffer that's accessed via UART. Worst case you can implement this feature using a little microcontroller between the UART source and the RS485 bus transceiver.
>>
File: IMG_20251220_210900_914.jpg (151 KB, 1078x1280)
151 KB
151 KB JPG
I didn't wanna spent $700 on a datalogger
Now 2 years later I have onboard laptimes, tachometer, and a dataviewing tool

2 years ago I was just a software guy

Hardware is fun and magical
>>
>>2966062
Cool stuff anon. As someone who started with hardware and am struggling with the firmware side, I do kinda envy people with a more formal understanding of programming. But I just don’t do enough of it for it to stick in my head.

To what extent did you use existing IDEs and HALs already set up for your hardware, compared to setting it up in your development environment of choice and learning how to compile and flash the programs more manually?
>>
>>2966112
I used a seed xiao nrf52840 in the arduino IDE

Today I'm learning how the "proper" ides work, surprisingly I didn't run into any performance issues with what I'm doing so it wasn't all that needed to leave the arduino IDE yet

HackTheTrack.net

Open sourced everything, I wrote 95% of the datalogger/library

The data viewer has been an experiment in vibe coding and I didn't write a single line of code lmao
>>
>>2966147
What did you use for the vibe coding?
>>
>>2966165
Lovable, I've used some of the other stand alone agents at work and this is a whole other level

It uses some silly decision engine to pick an AI agent for the task you asked it, it liter uses "all of the agents"

There's a reason you can't drop a project I to it like you can chat/Claude, I forced it to do that on a project and it went s little retarded with something it didn't make

You really need to wrong long and detailed requirement lists with concrete deliverables before letting it look

"Add this feature" usually results in you getting pissed off

Used half my month credits, and about 100 messages, so like $10 to build it

I've seen ads for another one that I now forget the name of, and it looks even better as they have their own Jira/kanban type system to create working tasks with hard goals

It's neat, I wouldn't shill it over Claude quite yet, but it's worked pretty well for this. I prefer working with Claude where I still do most of the grunt work, this has been a fun exercise in "being the project manager"
>>
>>2965643
>STM32CubeIDE
You can use STM32CubeMX as a standalone program to configure pins and clock speeds without having to use STM32CubeIDE. A lot of people get their source files and Makefile from there, and then just use VS Code or any other file editing program to actually edit the source.
>>
>>2964399
Jumper wire is a broad term and you can certainly solder jumper wire. I make my own from "station z" cable which is 4 non-twisted conductors of 22awg solid copper.

Did you buy some godawful aluminum shit by accident? Or maybe you are trying to solder nickel-plated wire without flux...
>>
File: file.png (106 KB, 968x840)
106 KB
106 KB PNG
are these examples written by chat gpt or am I missing something
https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7701_Automotive-Microcontrollers-ATtiny24-44-84_Datasheet.pdf
page 19 memories section


Both (0<<EEPM1)|(0<<EEPM0) and (0<<EEPM1)|(0>>EEPM0) are zero, they make zero sense

they were supposed to be 1<< I imagine
>>
>>2966749
Yeah that’s flat-out senseless, unless the compiler somehow interprets that as 11101111 or whatever. Also I’m surprised they don’t have bitmasks already defined for those bit-shifts.
>>
>>2966749
Only thing I can think of is the processor is so shit it takes 1 clock per shift and they need the delay
>>
>>2966749
The initial reset values of those two bits are unspecified, and so they need to be written, so the programmers here are stating their *intent* of clearing those two bits to set the programming mode. 00 means atomic erase+write. Think of it as self-documenting code.
The other bits are 0 on reset except for EPEE, so they aren't specified, and are all left at 0, which is what they should be.
EPEE needs to be written last to start the EEPROM write, which they do.

So no, they didn't make a mistake shifting 0 like they did, except for that second 0>>EEPM0, which was unintentional. Should be <<.
>>
>>2966806
No, those are compile-time constant expressions, they wouldn't be shifted at runtime.
>>
>>2966749
>they were supposed to be 1<< I imagine
Also to drive the point home that specifying those bits as 0 was intentional, and they didn't mean 1<<, table 6-1 from that datasheet says: 1 1 - Reserved for future use
>>
>>2966827
unspecified |= 0 is unspecified. It is not clearing anything. it is just senseless gpt/pajeet code
>>
>>2966827
>>2966840
assembly code just sets EECR to 0 though, unlike C++ version. So that is correct I assume since you want 0 for those bits

C++ version though just ORs them, which wouldn't work if they were not already zero (unless there are some shenanigans with that register and reading always returns 0 so |= 0 writes zero)
>>
Also it is a weird code no matter what 0<<x makes zero sense. If you want to clear all bits then just set it to 0 which would make assembly code's intent more clear. if you want to clear specific bits then common idiom is &= ~(1u << bit1 | 1u << bit2) and assembly equivalent. There is no such thing as 0 << x
>>
>>2966749
Is the C code missing the final semicolon on the questionable line?
>>
>>2966841
>>2966844
Wait, I am dumb. I took another look and c++ is doing =, not |=. So it is also technically correct.

`= (0 << bit1) |(0 << bit2)` is a weird way to write 0 though. But maybe it is a common idiom in professional world and shows the bits you care about. but then that is what comments are for
>>
>>2966844
>0<<x makes zero sense
That's "showing your work", documenting that you really wanted a zero in that bit position.
The ">>" is still a stupid thing that just happens to not cause a problem because it's still zero.
>>
doin a smartchair and need to know if MQ5 is a good gas sensor for fart?
>>
>>2966881
Use a spark gap and a microphone to detect
>>
File: mcu io.png (378 KB, 985x905)
378 KB
378 KB PNG
I need to generate two outgoing PWM signals (with potentially different frequencies) and monitor a third incoming PWM signal. For this reason I thought to use different timers for PWM generation (TIM5, TIM9). Should I use yet another timer for monitoring the incoming PWM signal or can I re-use TIM5 or TIM9 for that? I noticed there's a Combined Channels mode on TIM5.
>>
>>2967427
>and monitor a third incoming PWM signal
Scratch that, actually the incoming signal is just a toggle-type (fan tachometer) digital signal. I guess I could use a third timer in counter mode for that. Any better options?
>>
Instead of trying to do everything at the same time, maybe you could try doing each signal one at a time until you've got something that works at all, then combine them.
>>
File: max485.png (32 KB, 703x332)
32 KB
32 KB PNG
>>2965808
Most RS485 transceivers have all the same pinout like the MAX485,ADM485 and many more from other manufacturers, and are very cheap

You either connect it to a microcontroller and use the UART send buffer flag to only enable tramission when send buffer is not empty (data is being transmitted), and there should also be flags to clear to receive buffer

Or use a dumb circuit like used in many chinese modules https://oshwlab.com/virendra/rs485-to-ttl-converter-module_v2

>>2967438
If it's just a dumb slow fan just increase a variable for every state change and then reset it with a fixed timer interrupt, taking the current value as your revolutions/time
>>
>>2967427
> pwm
> software bug
> pwm stops leaving signal high, sending full on DC
> motor burns up
>>
>>2967450
>> pwm
>> software bug
I don't know about STM32 but on any decent mcu once you set timers and pwm registers the actual signal is generated in hardware.
Assuming the registers are initialized to 0 zero before software initialization it should never happen, plus there are watchdogs

The only potential issue is if you're driving computer fans that use an inverted pull-down signal for pwm control
>>
>>2967427
Generally you can do two different PWM duty-cycles out of one timer at the same frequency. For the input measurement, you’ll want to use a timer with input capture capability, i.e. the ability to trigger the timer off an input pin without resorting to using interrupts.

>>2967450
This is what state-machine programming is for.
>>
>>2952647
I'm looking at laboratory/benchtop PSUs and need a new one, I assume I should get a linear one this time because I want to work with high speed boards / communication devices?
>>
>>2967556
>high speed boards / communication devices
Do you need variable voltage AND low noise at the same time? If not, you're probably better off with a few fixed-rails with adjustable overcurrent latch thresholds. Fully adjustable CC/CV supplies are great for load testing, but often don't need to be too low noise.
>>
>>2967556
Not really needed unless you are working with especially noise-sensitive analogue stuff. Good to have anyway though, for when those times come up.
>>
>>2967558
>Not really needed unless you are working with especially noise-sensitive analogue stuff
Actually I plan on doing exactly that, I'll need to work with ~5 to 7.55 GHz analog video signals (1080p / 4K@60 Hz).
>>2967557
>Do you need variable voltage AND low noise at the same time?
I'm not entirely sure, that's why I'm asking. I'll clarify a bit: I'm that one fag from the /ohm/ thread who's building his own dashcam, so the final "product" will run in a noisy environment with variable voltage from 11v to 14v.
The part that concerns me is the SER-DeS, the chips take in a ~1.8vDC + a video signal (digital for the SER, analog for the DeS), output another video signal (analog for the SER, digital for the DeS), I also need to supply an analog GND, but "best practices" (mixed signal books and information) from what I gather tell me to just dump that into the digital GND and call it a day.
>>
File: SDS00001.png (33 KB, 800x480)
33 KB
33 KB PNG
I have an attiny84 and trying to make a buzzer using pwm.

I set my pwm via CTC mode like following code. And I can control frequency via prescaler and OCR0A

Now I want to also set a duty cycle so I can control volume. I enabled interrupt and I will toggle a BUZZER_PIN via interrupt as needed. From what I understand, this is the only way?

Right now I am toggling BUZZER_PIN on each interrupt and you can see the result in oscilloscope. Yellow line is output of PWM and purple one is BUZZER_PIN

What I don't get it why PWM is a smooth square while BUZZER_PIN is not. You can see that it is slowly dipping instead.

are PWM just faster at toggling pins or am I missing something here? PORTA ^= (1 << BUZZER_PIN) in interrupt is not toggling the pin as good


[code]
#define BUZZER_PIN PA0
ISR(TIM0_COMPA_vect) {
PORTA ^= (1 << BUZZER_PIN);
}


int main(void)
{
DDRB |= (1 << PB2) | (1 << BUZZER_PIN);

TCCR0A = (1 << WGM01) | (1 << COM0A0);
TCCR0B = (1 << CS00) /*| (1 << CS01)*/;
TIMSK0 |= (1 << OCIE0A);
OCR0A = 125;
sei();

while(1);
}
[/code]
>>
>>2967561
>Actually I plan on doing exactly that, I'll need to work with ~5 to 7.55 GHz analog video signals (1080p / 4K@60 Hz).
Linear power supplies are recommended for low bandwidth stuff like audio, something that high shouldn't be affected much by a 100kHz switching PSU
Also every hobbyist should have an hand-built linear PSU

>The part that concerns me is the SER-DeS, the chips take in a ~1.8vDC + a video signal (digital for the SER, analog for the DeS), output another video signal (analog for the SER, digital for the DeS), I also need to supply an analog GND, but "best practices" (mixed signal books and information) from what I gather tell me to just dump that into the digital GND and call it a day.
You're better off using some fancy isolated DC/DC converters with LC filters, star grounding is recommended for analog signals
>>
>>2967647
>star grounding
Not recommended for anything
https://resources.altium.com/p/using-pcb-star-grounding-can-keep-your-design-shining
>>
>>2967603
Post schematic, it’s going to be a hardware problem not a software problem.

>>2967669
I always thought star grounding ensured that you wouldn’t get voltage drop from one end of a ground plane/trace to another, when something is sinking significant current into it and something else is using it as a precise reference. Best practices would dictate that the former should be on a power plane and the latter should be on a signal plane, which is fine when you’re talking op-amps and other modern chips, but for transistor-based audio and radio circuits there isn’t such a simple boundary between trace impedance classes. Not that conventional star routing is a good idea for a radio circuit. When you have less copper layers than trace impedance classes to handle, I’d adopt some sort of hybrid system with ground planes tied together at a central star point. But you’d also want to ensure a direct ground return path for any traces crossing those plane boundaries. ICs that intrinsically bridge planes together, like a DAC with AVcc and DVcc but just one GND, kinda imply that the IC itself acts like a star grounding point.
>>
>>2967725
>Post schematic, it’s going to be a hardware problem not a software problem.
It is just an attiny84 on breadboard with nothing really attached to pa0 or pb2. Pb2 (pwm output) looks good but pa0 (controlled via interrupt) is not a smooth rectangle wave
>>
>>2967561
>11v to 14v
We're mimicking a battery voltage here so a variable linear supply is probably a good idea. But considering the current draw, a diy single-stage linear adjustable supply is probably the easiest way to go. LM317 or otherwise. The expensive linear supplies use relays to switch between secondary windings for optimising the pass transistor dropout, but in your case I doubt you're eating more than half an amp, dissipating 15W or so via a heat-sink bolted to an LM317 is going to be pretty simple. Adding a capacitance multiplier inside the LM317's feedback loop might do something useful as far as noise goes.
If you want to add an overcurrent latch feature that's also just a matter of adding a comparator, a current sense amplifier, and a JK flip flop IC (probably a 4027).
>>
>>2967603
>>2967725
I found my error. I was trying to set the direction of BUZZER/PA0 using wrong register
>DDRB |= (1 << PB2) | (1 << BUZZER_PIN);
should have used ddra
>DDRB |= (1 << PB2);
>DDRA |= (1 << BUZZER_PIN);
>>
File: 2025-12-27-15-59-44-569.jpg (2.87 MB, 4032x3024)
2.87 MB
2.87 MB JPG
Got the outdoor furnace controlled by HASS
>>
>>2967765
What about overvoltage protection? I've had an OEM radio blow up once when a gas station clerk connected a jumpstarter-battery to my car.
>>
>>2967869
Why the fuck are you heating up the outside?
>>
>>2968423
I’m talking about a bench testing power supply. For overvolt protection in your camera unit itself, you’ll want hardware (capacitors, transistors, regulators, etc.) capable of at least 25-30V, and to use TVS diodes that start conducting in the 18V range across that hardware. Some common-mode/normal-mode chokes may or may not help slow down sharp spikes, and fuses will help protect the system if too much current is dumped into the TVS diodes.
>>
Eat and poop simulator
https://www.youtube.com/shorts/Fk11Tw_AbFA
>>
>>2968448
Foul
>>
>>2968442
Because it's cold out
>>
>>2956347
didn't realize this thread was still here.

i'm looking at function epilog/prolog and stack management in intel syntax under the windows api. anything you're familiar with?

/g/ is fucking useless, in case you weren't aware.
>>
>>2956826
>run Windows XP again on a $10 dev board, but faster than it did in it’s era.
bro don't do this to me, don't give me hope
>>
>>2969285
The windows 64 bit abi uses R2 (RCX), R3 (RDX), R8, R9 for the first 4 arguments, so no stack needed in many cases. Return in R0 (RAX).
>>
This is about USB I hope it's right here.
I'm building a power bank solution based on IP2368. IP2366 does not behave any different. It works great but for one issue: It wont supply a dumb load 5V. The datasheet makes no mention of it. Do I have to do funny stuff with resistors on datalines? Does everything need an e-marker now? Would it then make sense to just slap a 'decoy' chip on the board next to the IP2368? Annoyingly I would then need to disable it for regular USB loads.
What do? I need it for a light.
>>
File: 20260107_024650.jpg (709 KB, 1816x1911)
709 KB
709 KB JPG
>>2969452
So I tried
>picrel
I figured in dead bug mode the CC2 is number 4 and CC1 is number 10. Both to ground via 5.1k.
Plugged it in and the IP2366 didn't seem to wake up. Checked on VBUS, nothing. Do modern chips just rely on everything now having emarker and dont support dumb loads anymore?
>>
>>2958589
>That's why most people outside the US actually learn foreign languages.
Yes, they learn English.
>>
>>2969470
Got it to work. 5k1 to GND on the controller side wakes it up and keeps it on. I would have hoped a push button in series would work to wake it up and current draw would keep it up, 50 mA or 100R on the output did not, maybe it just wont or needs higher current to stay awake.
As to why it didn't work on the sink side? Idk. Maybe the cable.
Or the fact that I was using a probe that wasn't connected...
>>
>>2969452
Neat, I just bought one of those 100W PD power-bank module PCBs from alibay, I plan to stack 5 26650 3.2V cells in a 3D printed housing for a big and reliable power-bank. What sort of power bank are you trying to make?

>>2969492
If I recall, 50mA isn't nearly high enough to get those things to latch on. Something closer to 0.5A is what I'd expect it to recognise, maybe to prevent it from draining from water in its USB C socket or something. Do some tests with more resistors I guess. You could always add an SR/JK latch with that button and your own current-sensing trigger comparator, if you're designing your own PCB. Probably would want a current sense amplifier too. Having a simple latching switch might be acceptable too.
>>
>>2953146
risc-v
>>
>>2969530
>What sort of power bank
Something very similar. I am not yet exactly sure how far I will go with the integration.
Must have:
Big ass capacity.
Ingress protection.
USB-C out.
140W.
Discharge overcurrent FET.
Direct XT out.
Should have:
Toolless opening and removable cells (I mean that).
Balancing disable switch or
Voltage window activated balancing.
Simple fuel gauge.
Bidirectional over current FET, charging and discharging.
Overvoltage lockout.
Undervoltage lockout.
Could have:
Integrated bicycle dynamo hub charger.
Manual source / sink switch or USB-A in and out for role detection.
Sensible solution for <50Wp folding PV panel connection.
ESP32 for monitoring.
Power path controller.
Probably a few things I forgot.
The purpose of the whole thing:
I'm terminally /n/ and /out/ fagging, all over the place on my bicycle with a dynamo hub. From an /ohm/ standpoint that hub is fascinating and I'm working on a solution. I want starlink. So I think I need up to 100W intermittedly or so I forgot. I also want to attach a set of lights to use when not in traffic but alone. I want to keep my flashlight charged (and in an emergency be able to pop a cell from the bank in). I want to keep my phone and a navigator charged. That's about all.
Energy budget is tight if PV isn't happening but I usually don't use much. Half a charge on the phone a day, torch lasts 2 weeks on a cell. Torch has integrated charger and USB-C. Navigator usually stays in the pack. The new lights? Idk.
50 Wp folding panels are feasible.
The dynamo hub is hard pressed to put out 10W and efficiency sucks ass but I am working on the 10W issue.
Some days I ride only 5 hours some 10 hours. Give or take it depends.
I got cells from cordless tools. So they're high amp cells. Some 18650 some 21700, which wouldn't fit the torch. Might buy some alternatively.
Yes I'm aware it's a bit of a can of worms to randomly swap cells but it's an emergemcy thing.
What about your power bank?
>>
>>2969541
One more should have: Override switch that ties the undervoltage FET gate to source and or or breaks the connection to the controller. So you can get some leftovers at your own risk.
>>
>>2969530
>50 mA isn't high enough
So I tried latching it again. It wont and that probably is a good thing even. I remember older power banks latched but they had polarized ports. In USB-C the CC line is vital for polarity detection which don't matter for VBUS and GND as those are symmetrical all the way but perhaps it's for conformity with the protocol that assumes source and sink get to communicate.
I figured this one might be interesting to you as it might the 'eval' board you have... you said 100W... I think this one is a 100W one.
So as you can see I loaded it 1.5 A / 7.5 W and it wont latch.
Note how the CC pins are exposed very conveniently on the e marker FETs. The yellow wire carries the 5.1k R, touch it to GND and the output comes up to 5V. The output can be hooked up to conveniently on the MLCC next to the output.
So it seems a dumb 2 wire cable won't cut it. Too bad. Gonna do the whole circus with the CC shit and all that at the sink and use the right cable.
>>
File: 20260107_150046.jpg (3.37 MB, 4032x1816)
3.37 MB
3.37 MB JPG
>>2969567
fuuuuck
Oh yeah also sure you can daisy chain 1S protection as long as each FET can widthstand the whole pack voltage and you can live with the extra resista
>>
File: file.png (151 KB, 470x470)
151 KB
151 KB PNG
>>2969541
>Toolless opening and removable cells (I mean that)
Yeah I'm going for removable cells too, it's kinda tough to find battery spring connectors rated at enough amps. But toolless opening is less of a big deal for me. Seems like waterproofing and tooless opening are hard to reconcile.
>ESP32
Note that these have pretty bad quiescent current, consider an NRF chip.
>100W

For my one I bought 5 26650 cells for pretty cheap from work, they're LiFePO4 so the energy density is kinda shitty but it means I should expect years without having to swap the cells. The main purpose is powering my USB C soldering iron and benchtop power supplies on the go. As for features, I trust this module to have everything I need, I'm pretty sure it does active balancing too. Pic related, the protection balance chip is a BM3451, with an SW6306 as the main chip, it also does H-bridge conversion but the datasheet is chinese. I got the board with two A ports and two C ports, but no DC jack input. I'm pretty sure the boards with the DC jack input can be charged from a more arbitrary voltage, which might be a feature you'll want for your bike charging setup.
Waterproofing isn't a requirement for me, but it might be a nice feature to add. Though I'd have to add a gasketed door in front of the ports, since I'm not designing my own board for it.

>>2969567
>I remember older power banks latched but they had polarized ports
Ah yeah, I am remembering from the days of USB A power-banks.

>>2969568
I'd have figured those L1 L2 connections on the side are for individual cell connections for voltage monitoring, but I may be wrong.
>>
>>2969568
Those cell holders look skookum as frig.
>>
Should I invest in an ultrasonic cleaner? Feeling like a retard using alcohol and q tips desu senpai.
>>
>>2969650
>>2969660
>The cell holders
They're just generic 18650 holders, I believe several mfg make them. I find them nice, they have a good place where to put your thermistor and the contact springs appear solid. I will drill copper clad for them and score the isolation by hand once I have made my mind up regarding a few things and found the time.
>>2969650
The ESP32 current draw:
I haven't read the datasheet but seen enough ESP32 applications to have an idea about their energy requirement. I believe it is a non-issue but thanks for the headsup I'll look it up. But we're surely talking mW, perhaps uW even in deep sleep. So it doesn't matter. I mean I have a balancer planned even.
>The current rating
I'm not worried too much. Again I didnt read the datasheet. My plans are 6s or 7s and 140W. So I'm looking at 5, max 6ish A full chooch. I'm sure those spring contacts can handle. I will test how much they drop.
>Waterproofing and toollless opening.
I believe it's not that hard regardless of wym 'waterproof'.
But even more so WYM waterproof? I don't plan on having it submersible. But rain and splash from all directions in all orientations. I simply plan on 3 features:
Sealed connectors. Not much surcharge.
O-ring arpund the lid or opening.
Where opening and case meet add the typical gutter structure you find in all sorts of spray proof stuff. You know, where any projected ray can only make it in at an angle that makes it go past the seam but instead find a labyrinth that leads to a drain. Locking could even be entirely external, haven't thought about it yet.
>DC jack
I trust most of those boards to simply use their buck boost when VBUS is detected. I believe they generally do not care about source advertisement. If there is energy they grab it. So adding a DC jack is as easy as the two wires on MLCC. Now if they do care about source advertisement, I wonder if it does any harm to advertise old school, 5V, and then just send it anyways. I think not. (...)
>>
>>2969716
(...)
>The datasheet
It's always chinese, the west has fallen.
>More arbitary voltage
AFAIK it's virtually the same on the USB. Plug a 2 wire cable in, perhaps a 3 wire to advertise something, and then feed it whatever, 2V, 27.3V... anything not in the standard and it will likely take it.
>The L connections
As the name implies they connect to the inductor. The others to Vbatt and Vbus. The chip has no kind of BMS functionality. I connected at the MLCC bexause the board disconnects it via FET and I want to test it's behaviour, not VBUS in general.
>LiFePo
Check if you get away with 1s more. Also check if your board has a mechanism to set number of series elements and charging cutoff voltage. The product of which is that to which it wants to charge.
>>2969699
Ultrasonic cleaner is a very generic name. They are usually characterized by energy density and they can do a lot of damage. They are known to damage various components like quartz, MEMS, powder metalurgy... I have a medium strength one and was stupid enough to try it on my glasses. They came out opaque and stripped of all the clearcoat I didnt know they had. The opacity is due to countless of cracks in the lenses.
I would try heat and time only first if u lazy. Just put methanol on a hotplate with a PID, dunk it, close it, think of pressure buildup, let it sit. Rinse in clean meth. What's the ultrasonic really gonna do?
>>
>>2969716
>6s or 7s and 140W
The 68 is 100W 5S max, the 66 is 140W 6S max. Never seen 7S in a power bank, but considering 140W goes up to 28V it does make sense. Damn I wish there was a power negotiation protocol that could work with raw battery voltages so long as they were within load spec.

>Sealed connectors
Yeah, that's the big advantage of rolling your own boards. For my one I am considering a hinged door in front of the ports (well, a flap of printed TPU as the hinge) with a TPU gasket.

>I believe they generally do not care about source advertisement
I'm not so sure about that, if you connect a 19V 1A supply will it draw just 1A from it to charge?

>>2969722
>Check if you get away with 1s more
The BMS chip is 5S max. It does allow to change the cutoff and balancing voltages though, there's a DIP-switch array for configuration of all that.

Anyhow, looking closer at my board I see it only has one DC-to-DC converter, the H-bridge buck-boost. With gating MOSFETS between it and the USB ports. So it can only output one USB voltage at a time, I won't be able to have a 5V peripheral and a 20V peripheral plugged in at the same time (e.g. soldering iron and vacuum pump), which seems like a problem for a device with two A ports and two C ports. Mabye I should design a custom power-bank board. If I'm feature-creeping, I might as well also do some sort of meme DC power negotiation method too, this time with PP45s instead of 7W2s. Anyone wanna program ESP32 CAN bus for me?
>>
>>2969729
>WYM protocol working with raw voltages? Just use no buck boost and put a jack on your pack.
>Rolling own boards
While that might be what I end up doing you can aswell:
Change the connector with another 12 pad.
Use a extension pigtail with a sealed panel mount and plug or solder it.
Get a breakout board with sealed and wire that.
Etc.
>TPU
My printer is really crappy it sure doesn't do that, I'll just design for O-rings. And also flat panels whwre possible and use fiberglass, alloy, whatever.
>Connect 19A
Well, as I said, I am in a testing phase. Datasheets in 2025 are often confidential even and if not very much lacking compared to back in the old days, where they even would show the die and explain all layer thicknesses and doping profiles. KEK. So it's one of the things I want to test but obvs. the more potential for damage the later i put the test on my list. But I am confident, that above some threshold and below what the FET can widthstand or some OVLO it will take. anything. Probably need to smooth so. it can regulate.
>19V 1A what will it draw
It depends on the setting for the charge current. I doubt the thing is programmed or configured to charge at 0.76A or roughly . 25 C. Or maybe it goes up. to 1C idk.
But I imagine you feed it 20V limited to something equivalent to below whatever charging rate limit it has. Then I imagine it would hit that limit and pull the supply low. It begs the usual question: Should one care to get maximum power? The bicycle part is the circuit I'm worried about and it definately will need to load match. But I too am curious what will happen. I'll test that. But an ideal current limit is not a realistic source. Maybe I'll just define source impedance to test.
>The BMS is 5S max
The thing with LiFePo is the lower voltage. 1 more S can match a possivle configuration. It's the primary limiting factor. Everything else can be dealt with.
You haven't even determined yet if it's balancing. (...)
>>
>>2969736
(...)
If it's not even a single cell protector could do the trick in a very ugly way.
If its not then it's not even much of a loss to use a standalone solution. If it does need to be happy and commhnicate with the buck boost keep it happy with some resistors. I doubt it.
Are you certain the DIP switches configure the BMS? Or maybe both? I believe you can not have a sensible charging profile if the Buck Boost doesn't know it's job, so either both listen to some switches or they communicate that.
So if you look at the pack as a black box, with internal BMS, the total voltages and currents matter and you can set something on the board that is effectively right, even if the label is wrong.
>Only one voltage at a time.
Yes most things suffer from this. You plug something in and it negotiates gigavoltwattproduct. The chip does that. You plug something else in and it negotiates 5V 3A. The chip is now forced to reduce to 5V and provide 6A. It throws the fiest load off, changes to 5V, negotiates with the first load and both ports online. Some chargers have series discharging buck. One provides the maximum voltage negotiated, one just lets that through, others negotiate something and provide that.
>A and C ports
It will default to the fallback. It will also do that if only 1 cable does not have emarker / VConn thing.
>Scope creep
Story of my life.
>ESP32
You said bad.
At work we needed an interconnect in a device once. Amplifier output sat opposite to PSU and when the amplifier was redesigned for 40dBm IIRC the original wiring didn't do. My emtry for a prototype was 2 breakout boards that wend onto the Amplifier and PSU, with mechanically locking USB C and prefabricated really nice USB C wires, all used in violation of the protocol. It was internal
The stuff was just nice and had the rating
They took a design that had a long ass PCB like a ruler with board to boars connections on either end. Sad.
>>
>>2969736
>Change the connector with another 12 pad
Don't fancy myself desoldering those USB C connectors without hot air.
>extension pigtail
I've heard those often don't have proper CC connections, also it would be pretty bulky and just increase contact resistance.
I'd definitely like to design a board for this purpose regardless, as it gives me some practice dealing with BMS chips and allows me to bypass the shitty design and documentation of this chinky module.
>My printer is really crappy it sure doesn't do that
It's not hard to do if you have a direct-drive extruder and a filament drier. More than for seals, I plan on using it to make the power-bank impact resistant. I also bought some 72D TPU from CC3D that's much more rigid, but it's still probably not rigid enough to hold my battery contacts in constant compression without creeping.
>load match
I didn't even think about that, you'd probably want an extra MCU doing some sorta MPPT calculations. Depending on how the IP2368 handles charging current, you may be able to just talk over the CC lines and tell it to charge using X amps of current and do the MPPT without needing an additional DC-to-DC converter.

>The thing with LiFePo is the lower voltage
No I mean it has a BM3451 IC, it has I/O pins to connect up to 5 series cells together. Yes I could add an extra balance circuit to a 6th or 7th cell, but it would mean the quiescent current draw of the balancer wouldn't be the same for all cells, and the BMS chip would need a different power rail compared to the control chip. But looking at the datasheet again, it's a BM3451 TNDC-T28A, which balances at a 4.19V per cell threshold. So uhh, not very useful for my LiFePO4 cells actually.
>>
>>2969738
Yeah the DIP switches just configure the power bank SMPS control chip, not the BMS. RIP. I'll have to leave a review for the aliexpress listing warning people of this.
>Some chargers have series discharging buck. One provides the maximum voltage negotiated, one just lets that through, others negotiate something and provide that.
Seems kinda shitty, I know some wall-chargers turn off power and renegotiate on replugging something else, but I bought a 140W GaN one that doesn't do this. I'm fairly sure I've used power-banks that don't either, but I'm not certain. Ideally I think it would have an H-bridge buck-boost converter for each USB-C port, and a buck converter for each USB-A port. Maybe buck-boost for the A ports too, if you want to support QC4. I know there are PMIC chips that act as multiple switching controllers all at once, so it's probably worth hunting about for a power-bank IC that can do that too.

>>Scope creep
>Story of my life
AAA I HATE IT
I think I'll cool my head off with an analogue audio project for a week.

>You said bad
It's bad if you've got a watt-hour of capacity or less. 10 watt hours and it might be an issue, depends on storage period. The DC power negotiation protocol is intended to be used for 5-50V 0-50A, on things like deep cycle batteries and ATX power supplies and such. Hence why using an ESP32 to talk CAN isn't really an issue. Plug in, battery says it can provide up to 30A, and its voltage ranges from 11-13V or so, with no voltage or current regulation. Soldering iron load says it will draw up to 3A at 13V and to activate the MOSFET, and the battery complies. LED strip says it wants a constant-current signal, battery can't do that so it stays off, same for amp that wants exactly 12.0V, etc. I wanted to use 7W2s so I bought like $60 of them, but the allure of bidirectional battery charging guides me to andersons.
The power-bank is really too small for this kind of protocol, but it might still be handy to have that option.
>>
File: 20260108_085720.jpg (3.4 MB, 4032x1816)
3.4 MB
3.4 MB JPG
>>2969738
So I'm just testing this.
Got a 10K pot so I can simulate realistic source impedances and also extreme cases.
10R current shunt.
Datasheets say my FETs are good to 40V, IP2368 can take 30V, wants less than 25V and more than 4.5V.
Starting at 5V and 10K and no advertisement.
Nothing.
Turn the 10K way down:
The board starts to charge. It will indicate normal charging. It draws a continuous 20mA, and pulses the charging functionality on and off (not the inductor, the actual charging) and go from said 20mA up to 80mA and back again. 1s on 2s off. Switching frequency looks like only 3kHz. Same behaviour at 6V. The voltage across the board breaks down from. 5.3V (remember the 20mA standby) to 4.3V or so. So I figure if it undercuts the DS limit of 4.5V after a time it UVLO and tries again.
So it can do. meaningful charging at very low power levels. And it wont even jhst give up and flash an error code but pretemd its charging the whole time, even when its recovering from suspected
UVLO.
At 7V through a 10R and the 10K pot all the way to minimum (it's not zero power goes up 50% when shorting) the charging commences steadily with the voltage across the board at 4.4V, drawing 120 mA in total.
Last datapoint: Shorted 10K, PSU at 7V, so only 10R left. It now draws 150 mA and the voltage remains pinned at 4.4V
So from this I deduct that, when supplied from a load with a current lit below the boards configured limit (1A i to battery I have confirmed) it regulates so that it just barely violates it's 4.5V lower limit. Below that there's probably an RC relaxation oscillator happening somewhere.
So all hypothesis confirmed, I guess:
It takes without advertisement.
It will take any voltage within the allowed window, not only discrete values.
When facing high source impedance it pulls until if drops 4.5V or so. Perhaps this happens again at 9V and the other discrste values from protocol.
Bonus fature: It just keeps trying, even below that and it does meaningful work still.
>>
File: 20260108_095812.jpg (1.33 MB, 1816x2713)
1.33 MB
1.33 MB JPG
>>2969744
>It's not hard to do
The printer in question
>>
>>2969748
Oh, neat. 4.5V seems like a sensible threshold, considering USB chargers will try to output 5V, but I suspect some USB chargers will start hiccoughing before going down that low. Try adding resistive dividers to the D+/D- pins of a USB C port, assuming it even looks at those. That might trick it into trying to draw more or less current. I suspect 4.5V isn't a very good MPPT level for your dynamo either way.

>>2969752
Like hell that thing is rigid enough to do anything. I tried a smaller rotary tool much closer to the gantry of my ender 3 with reinforcing tie-rods, granted it's running on V-rollers and still had bed-springs, but the flex was too much even for precise 0.7mm PCB drilling operations. What's the stepper in the background doing?
>>
>>2969755
>4.5V is sensible
>considering USB chargers
with USB chargers, unless they are dogshit unregulated china slop house butner people electrocutors, I would expect to see the standardized voltages and currents along with advertisement and negotiation on the output anyways.
This is still about the scenario where: Any DC source in - > charge. Judging by how it's operating you could probably even charge of any >4.5V DC source that is limited to >2mA, if you added a large cap. The cap would just charge through whatever exceeds the 2mA quiescent current and once it hits 4.5 the charger would kick in for a bit. It's what I believe is happening anyways with the chargers cap.
>MPPT level
The dynamo. is everything but a purely real source and it likes to go to 70... 80... 90V when open and fast. But I can check the series resistance regarding matching that. It's the other stuff I'm working on.
>Rigid enough.
I think it works quite well, with the zip ties, in the capacity I am using it.
>Smaller rotary tool
I gave this cutter almost no tip at all.
>Stepper in the background
It once provided motion capability for aome control loop testing and is tied to that stand ever since and until it's needed.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.