← Home ← Back to /diy/

Thread 2928655

200 posts 70 images /diy/
Anonymous No.2928655 >>2929363 >>2929405 >>2940438
/mcg/ - Microcontroller General: Serious Devboard Edition
Previous thread: >>2909001

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
Anonymous No.2929363 >>2929370
>>2928655 (OP)
I want to sink 10, maybe 15 mA from uart mcu pins that i cannot determine the type of because it's embedded into something and non-reachable so i can't look up the specs. Is this current acceptable for uart connections on most mcu's? The sink is to drive a serial isolation optocoupler. The signal is 5V and outputs some data every second at 19200bps.
Anonymous No.2929370 >>2929372
>>2929363
Probably not on newer MCUs. An older type like the ATmega328 (arudino uno mcu) would be able to but newer types would likely see a significant rise in Vol when trying to sink 15mA. You might see 1v when you should be seeing under 100mV. The exact voltage rise would be dependent on the mcu and may or may not be acceptable depending on the characteristics of you optoisolator. Also, I would be careful putting 5v on a digital input if the mcu is unknown. Newer types would may run on 3.3v rather than 5v and there is no guarantee that the pins would be 5v tolerant. Since 19200bps is very slow by modern standards, I would buffer the output with a transistor. I imagine the LED on the optoisolator is connected to 5v through a resistor and you want to connect the cathode to the mcu pin to turn it on when the pin is low? If that is the case you can go with normal non-inverted logic and connect the tx pin on the mcu to a bjt inverter. pic related
Anonymous No.2929372 >>2929390
>>2929370
>I imagine the LED on the optoisolator is connected to 5v through a resistor and you want to connect the cathode to the mcu pin to turn it on when the pin is low?
Yes that was my plan.

But this pic inverts the signal right?
Anonymous No.2929390 >>2929392
>>2929372
Yes the output on the isolated side will be high when the mcu output is low. If you don't want this you can invert the logic on the mcu. If you can't change the mcu firmware, you can add another npn to invert the signal. Since your baud rate is only 19200 the difference in propagation time will be negligible.
Anonymous No.2929392 >>2929399
>>2929390
What are you retarded? Just put a pull-down resistor on the phototransistor instead of a pull-up. It’s floating, it doesn’t have to be common-emitter.
Anonymous No.2929399
>>2929392
Good point. With 5v logic a 0.7v drop can be tolerated.
Anonymous No.2929404
Should work. Thanks guys
Anonymous No.2929405 >>2929437 >>2929443
>>2928655 (OP)
Do you have the sauce for the banana dev board or a high resolution pic? Here's some CRT porn in exchange
Anonymous No.2929437
>>2929405
Nvm found it
Anonymous No.2929443 >>2933043
>>2929405
I’ve never been able to find a source file for the WTFduino, but I’m pretty sure it’s just a 328P nano.

That CRT doesn’t look to have a front electrode to dissipate the charge from the phosphor. Man I want to make a vector display. Good thing we have laser galvos. Or maybe I should feed a component/VGA signal into a laser galvo to make a raster display? I should look into that.
Anonymous No.2929451
man, the (tr)usdx HF transceiver is insanely impressive for an ATmega328P. I think they’re doing I and Q decoding AND voice input and output. Somehow. I don’t see any mixers or filters on their circuit.
Anonymous No.2929798 >>2929807 >>2929819 >>2929887 >>2929923 >>2936278
I just spent the better part of somewhere between 4 and 6 hours figuring out a relatively simple and stupid bug in some code for a pair of STM32s trading a pair of bytes and ACK signals over UART.

NGL I kind of feel like shit about this, and how often things like this happen to me. Is embedded dev actually just like this? Does it get better? Is there some magic trick to not think like a fucking retard? Or is the best course of action about 50g of acetaminophen and a bottle of everclear?

I only do this as a hobby and I'm not that experienced, so I have no real context for whether or not struggling so badly for ridiculous amounts of time on what end up being relatively simple single-line problems is an everybody issue or just a me issue. I've heard plenty of joking about it, but I don't have a clue how much of that is exaggerated for comedic effect.
Anonymous No.2929807
>>2929798
Is it something where an oscilloscope would have helped?
Sometimes just not being completely blind to what's on a wire that makes a big difference, and it can be easier to hook up than a printf debug on something with no console.
These cheap handheld ones are only like 80 bucks or so, and well worth it.
Anonymous No.2929819
>>2929798
I made an app dev debug something for weeks because my firmware had a trivial bug.
Anonymous No.2929887 >>2929910 >>2929923
>>2929798
Are you using debugging via GDB or otherwise through your IDE? Printf “debugging” doesn’t count. Being able to step through clock-cycles and see what values are in your registers and on each pin can be very useful for tracking down spurious bullshit. Or so I’m led to believe. Doing this on two MCUs at once may not be easy, but it should be doable.
I think CNLohr wrote some sort of development environment that made compiling and uploading code to STM32s really damn fast for more rapid prototyping, but I don’t know if it includes debugging.

While I wouldn’t recommend asking an LLM to write a program for you, asking an LLM why your code has this buggy result may steer you in the right direction.

You could also take the ASIC+analog pill and avoid anything you have to program. Most projects can be greatly simplified with the right hardware, and even if the microcontroller can’t be taken out of the equation maybe you can use an existing codebase for it, or make the programming far simpler. Why solve a problem today in software if you could have solved it yesterday in hardware?
Anonymous No.2929910
>>2929887
>I think CNLohr wrote some sort of development environment that made compiling and uploading code to STM32s really damn fast
"make"?
>asking an LLM why your code has this buggy result may steer you in the right direction.
lol
Anonymous No.2929923 >>2929924 >>2929990
>>2929798
>Is it something where an oscilloscope would have helped?

I already have a DSO. I'm not a complete novice here, though perhaps only just barely this side of it. That's part of the problem. I feel like I shouldn't be fucking up in ways this stupid at this point, at least not for this long.

>>2929887
>Are you using debugging via GDB or otherwise through your IDE?
GDB via the STM32 extension for VScode. Which actually was what ended up being part of the problem: It didn't occur to me that the peripheral registers have no way of knowing whether they're being read/written by the MCU itself or by the debug...meaning that flags that are set/reset on register read are flipped "at random" when the debugger pauses the MCU and checks register values.

IDK, I guess I'm mostly just looking for confirmation that either failing this hard is semi-normal or that I am, in fact, retarded.

Just for reference: Picrel for what ended up being the root of the problem. I couldn't figure out why the timeout for the first byte always worked fine, but the second wouldn't time out. USART_WaitForAck() would always return true (transfer received in time) even with impossibly short wait times...unless the receiving MCU was held under reset and not responding at all, at which point it would time out as expected. I eventually set the receiving MCU to just never send the second ACK and measured how long the timeout actually took, which was suspiciously close to 65535µs. Turns out, when I wrote the TimeoutSetup_uSec() routine at the core of the delay, I had implicitly assumed that the counter would be stopped at the start of that function. But, if the delay is long enough that it can be called again BEFORE the counter hits the set AutoReload (maximum/top) value, setting another, lower AutoReload value will cause the counter to dodge the original and the new timeout value won't be hit until the counter overflows.
Anonymous No.2929924 >>2929990
>>2929923
(cont'd.)

It just seems so fucking obvious now that I see it. Yeah, other problems took up a portion of the near full day I spent on this (like the debug clearing flags, or that it's not pointed out in the datasheet that the overrun detection bit being set practically halts the entire USART peripheral, or any of half a dozen smaller code bugs), but saying that just feels like cope.

Anyway, thank you for coming to my blog, have a nice day.
Anonymous No.2929990
>>2929923
>>2929924
I didn't try to understand your problem (tl;dr), but it's common that shit close to hardware, especially timing related stuff, can be hard to figure out. It simply drains a lot of time and energy. I'd recommend to have good ways to debug, like using a scope to view what happens on the UART, or making sure gdb shows real values (it often lies to me).
Anonymous No.2930572 >>2930577 >>2930611 >>2930775
Bought a ESP32 and decided to run some tests with a 4-digit 7-segment display. I wired it and uploaded the sketch from this
https://microcontrollerslab.com/esp32-74hc595-4-digit-7-segment-display/

It works fine for any number up to 5555, but entering any number higher than that into the serial monitor causes errors. Random numbers, symbols that aren't even numbers, and blank screens. I looked through the code and I didn't see anything wrong with it, and I swapped out the 74HC595, resistors, and wires incase there was any fault there.

Is my ESP32 just borked in a completely retarded way?
Anonymous No.2930577 >>2931163
>>2930572
>It works fine for any number up to 5555
how certain of you of this statement? that would be a very strange bug, as theres nothing very special about numbers higher than 5555.
does 7777 work?
Anonymous No.2930611 >>2931163
>>2930572
have you tried another code or ide with that board?
Anonymous No.2930775 >>2931163
>>2930572
Probably shitty code. That does not sound like a hardware problem. If you write the code yourself, not only will you understand why it works, but also understand where to look if it doesn't work.

Or ask an AI to do that for you, jeez.
Anonymous No.2931163 >>2931203
>>2930577
Because the moment I noticed the bug I went through the numblers. First by the thousandth state, then the hundrendtg stat, finally the tenths, I didn't dive into the single digits because literally ever single numble above 5555 glitched out.

>>2930611
Yeah, I ran a basic blink sketch on this board multiple times with zero errors.

>>2930775
I spent all of Friday night and half of yesterday going over the code and see zero issues. The code should work. The board should work, in reality nothing works.

I pulled out my Fluke and tested every resistor. They resistors I used were 220 and rated at ±1 but actually read at 217.3Ω. I sat down and did the math and that variance should not in any way effect this. I switched out the 74HC595 with an honest to God Texas Instruments 74HC595. I replaced the 7seg4 with three different ones I had in my bench stock and got the same results ever time.
Anonymous No.2931203 >>2931216
>>2931163
Those symptoms are not indicative of any issue in hardware, it’s definitely in the code, even if it isn’t obvious. Assuming you’re not in a workflow that has GDB available, try putting some printf() statements at various points in the code. Try to send 5556 to the screen and check key variables for overflow or corruption. Displaying binary values as decimals requires division by 10, and most
Microcontrollers don’t have hardware division, so memory might be a problem. If you don’t calculate the last digit and leave it as 9 all the time, do you still get the bug?
Anonymous No.2931213
>ardushitto code written by retards
kek
Anonymous No.2931216 >>2931228
>>2931203
it was in the code
Anonymous No.2931228 >>2931232
>>2931216
Was? You fixed it?
Anonymous No.2931232 >>2931247
>>2931228
yah, I am a retard
Anonymous No.2931247
>>2931232
Explain the problem so we can learn. And laugh.
Anonymous No.2932795
I wrote a little something to monitor sensor data and display a history. Now I'm wondering, are there better libraries for this? It's an ESP32, so I might even do it in micropython which could make use of the time information.
Anonymous No.2933043 >>2933058
>>2929443
>front electrode to dissipate the charge
You mean the aquadag coating? This tube was a 1930s demo piece so I'm guessing that aquadag was either not a thing back then or they didn't bother because it was just a demo tube.

>Man I want to make a vector display
If you want to use a CRT it's pretty simple if you're willing to work with high voltage. Picrel was my setup before I dismantled it. I plan on coding an mcu to connect to the drive circuitry so I can play pong on the CRT in the near future so I may post here if I get around to it.
Anonymous No.2933058 >>2933180
>>2933043
>aquadag
Yeah, though I didn’t know it stopped short of the phosphor. Guess the electrons can still move to it after striking the screen. Bet if they put an ITO layer under the phosphor too you’d get less static buildup.
>MCU for pong
Cmon man, pong is the perfect project for a diy analogue computer. Can probably make it in 40 ICs or so.
Anonymous No.2933180
>>2933058
>Analogue computer for pong
To be fair I find this idea appealing and was initially going to go down that route since I prefer hardware over software but I have my hands full with other projects at the moment and it should probably be possible to write the program for it in a single day. I've already prototyped one deflection plate amplifier and it works fine at low frequencies. I didn't have any high voltage BJTs so I had to improvise and use IRF740s (not suitable for use in their linear region, I know) but even with those MOSFETs the deflection plate drivers are probably more than fast enough for pong. I've built up another amp to go with the first one so I can have independent control over X and Y deflection but I haven't tested the second one yet.
Anonymous No.2933911 >>2933956
Micropython, I kneel. Why didn't I try this before? It's so much easier in the field than getting my laptop with esptool, platformio or the Arduino IDE.
Anonymous No.2933956 >>2935746
>>2933911
What is it?
Anonymous No.2935481 >>2935565
How did ARM manage to make the MRC and MCR so completely retardedly over-complicated and unintuitive? Every time I'm trying to wade through their shitty docs and try to match these psychopathic IDs I want to kill myself. Fuck ARM.
Anonymous No.2935565 >>2935593
>>2935481
Take the RISC-V pill
Anonymous No.2935593 >>2935686 >>2935745
>>2935565
RISC-V has a similar mechanism, but instead of a tuple of 5 names, each register has only one name. One potential mistake they made when they defined the ASM language is how each register has an actual name, instead of specifying it as number. Now you need an updated toolchain each time you want to access a newer CSR.
Anonymous No.2935686 >>2935693 >>2935748
>>2935593
Super-H?
Anonymous No.2935693
>>2935686
Seems to have a very low number of system registers, not like ARM ("it must be extensible until the heat death of the universe and even after aliens enhance our brains to think 6-dimensional") or RISC-V ("I will design it to be extensible with random shit until I leave the industry")
Anonymous No.2935745
>>2935593
> how each register has an actual name, instead of specifying it as number
On Isreal Inside(tm) I’ve stopped using RAX and, instead, use R0. To prepare for amd128 which is in the works, which will, again, double the register file cardinality.

Do likewise, gents.
Anonymous No.2935746
>>2933956
It’s taking a toy language, making another, superficially similar language, but one that hardly does anything that the original one does making it more of a toy. The only thing left is some of python’s worthless syntax. And by worthless, I actually mean that it’s a blight on the industry.
Anonymous No.2935748
>>2935686
Super H is a reasonable choice, however ARM already stole one of it’s main features: code density. In ARM this manifests as the Thumb and Thumb 2 instruction sets. Without that, the roles of SuperHitachi and ARM would be reversed and we’d be living in a utopian society.
Anonymous No.2935795
>ARM has 4 instruction set encodings
Or was it 5?
Anonymous No.2935852 >>2941253
What's a good j-link clone?
Anonymous No.2935943 >>2935948 >>2936154
I'm trying to build a tachometer to use with a nodemcu, the issue is I want to use interrupts to count the pulses, but when the edge falls, it triggers hundreds of interrupts.
I tried a low pass filter and it still didnt work
Im having this issue with both optical and magnetic sensors

I do not have an oscilloscope
Anonymous No.2935948 >>2935952 >>2936051
>>2935943
RC low-pass filter followed by a schmitt trigger. And twist your wires together, maybe even add a ferrite, since automotive environments can be electrically noisy. Could add some dead-time before you re-enable interrupts too.
Anonymous No.2935952 >>2935953 >>2935954 >>2935955
>>2935948
>RC low-pass filter followed by a schmitt trigger.

that wont work very well, as OP has found out
3 things that will work
- integrator (diode, cap, resistor) followed by schmitt trigger
- non-retrigerable monostable, such as a 555
- SR latch

for more, do google image for ''switch debounce''
not having a scope means you should go with a method that doesnt use RC time constants as you'd be adjusting them blindly
Anonymous No.2935953
>>2935952

forgot one:
since you're using a 'puter, you can debounce in software
wont work if you insist on using interrupts, tho
Anonymous No.2935954 >>2936514
>>2935952 (You)

forgot one:
since you're using a 'puter, you can debounce in software
wont work if you insist on using interrupts, tho

or maybe it can
after you get a first interrupt, disable that interrupt for the next 15-20 msecs, creating a dead zone just like a monostable would
Anonymous No.2935955
>>2935952
>integrator (diode, cap, resistor)
>diode
Those sensors generally don't have push-pull outputs in the first place, so the diode is probably superfluous. It should pull the output down fast, and the pullup resistor and cap will make for a slow rise.
Anonymous No.2936051 >>2936182
>>2935948
weird thing: I connected the same sensor to an arduino uno and the interrupt works correctly, but the same setup on the nodemcu makes it trigger like 4k times when it should trigger once
digging around online, this seems to be a weird issue with the nodemcu, apparently it is too fast and if the step rise is too slow, it registers several times. still, over 4k is way too many times
Anonymous No.2936145 >>2936182 >>2936285
wassup my niggas I am back
the news are:

-I have finished the PCB design: i just need a review and then order prototypes.
-for some reason i don't fucking know what's the problem with my bill of materials n shit.. i can't order this thing on JLPCB
-my depression got way worse so I may not be working on this a lot but i'll try my best
-my new goal in life is to get in a nursing home and live the rest of my life sedated until either big oof or euthanasia

btw the repo is still here if u wanna fuck around (maybe you'll find out) github com/hydrastro/owo
Anonymous No.2936154
>>2935943
as the prior anon said, use a schmit trigger. ESP interrupts need sharp edges. Had my fair share of problems trying to use those cheap rotary encoders
Anonymous No.2936182 >>2936252
>>2936051
Sounds like it’s spending too much time in the 25-75%Vcc range or so where logical 1 or zero isn’t defined. You need a Schmitt trigger or a few microseconds of delay before you enable interrupts again. A low-pass filter will only make the problem worse, but might still be a good idea to remove some noise if the other methods don’t work fully. You may also be able to improve the response speed by using a lower-value pull-up/down resistor on the sensor.

>>2936145
I may check later if I remember, but are you using the JLC fabrication toolkit addon for KiCAD? And adding the LCSC PART # or whatever in KiCAD’s BOM tool as the extension instructs? You also have to watch out for SOT-223s and other asymmetric footprints, they often come out off-centre by default.
Anonymous No.2936252 >>2936322
>>2936182
>but are you using the JLC fabrication toolkit addon for KiCAD?
uuuhh no
didn't know it existed lmao

>And adding the LCSC PART # or whatever in KiCAD’s BOM tool as the extension instructs?
not really
though I have all the parts in a list on DigiKey

>You also have to watch out for SOT-223s and other asymmetric footprints, they often come out off-centre by default.
wtf why? damn that would suck
i'll try to check things out

thanks!
Anonymous No.2936278 >>2936322
>>2929798
>is embedded dev like this
if you only know how many times I've been in the lab after 3 weeks of dispair only to realise all my problems stem from a single most stupid mistake.
It doesn't get better.
Example: The company pulled an old prototype back out. I was told to set it up and get it running. It had some combined multicore MCU FPGA unit on it. That thibg was somehow modified and some of the boot jumpers were on the prototype board but it wasn't clear which etc. The thing also had SD and two partitions. Flashing firmware would work in that usual way: Flash to the secondary partition, boot into there, if that works copy to primary partition. Reboot from there.
So I just configured some stuff for it ran it through buildroot set some boot jumpers and hoped for the best.
No boot. Try things, eventually boots. Erratic behaviour. Absolutely clueless.
Turns out I confused the mapping for the two partitiond and the SD. So when I went to change something and flashed it something that may or may not be from earlier booted or not and if it booted it would copy something from somewhere to primary and the whole boot jumper situation didn't make it any better.
Such a trivial mistake and I went stupid levels of deep into what is happening. And it ends up being duh.
It just bever gets better.
Every day is the same.
Leave your RS232 in the lab, a colleague needs one real quick but with a modification, modifies your adapter, doesnt tell you, you look dumb again.
New PCBs delivered, nothing works. Everyone looks dumb. Why? Is there a mistake in the new production files? Check everything for two days while someone probes everything to find out whats wrong.
A colleague is like 'that feels slimmer than usual'.
Fucking PCB place simply FORGOT two internal layers.
It's an endless series of events like this.
Anonymous No.2936285 >>2936313
>>2936145
hmmm maybe my clearances are too tight? 0.1mm

idk
Anonymous No.2936313
>>2936285
Also i'm not sure that I placed the SD slot in the right direction
whatever i should just kms
Anonymous No.2936322 >>2936368 >>2936389
>>2936252
>DigiKey
You are trying to get JLC to solder it all for you, right? They have a list of parts that they stock that are basic parts and have no fee associated, mainly passives and jellybean parts, plus a few “preferred extended” parts that also have no fee associated. Ensure as many of your components are from one of these lists as possible. Then for a small fee per part they can get stock from the main warehouse of LCSC, because they’re the same company, you’ll likely have to do this for more specialised parts like MCUs and motor drivers and such. This can all be done as you generate the quote. Parts in other LCSC warehouses need to be ordered in before you generate the quote into your personal parts inventory, and there’s a significantly higher fee for this. I imagine the same applies for getting parts in from other vendors, DigiKey included, but I’m unsure of the ordering process.

LCSC has a really shitty parametric search function (JLCPCB’s search is even worse, which is where you see the basic/preferred extended labels) so I sometimes find myself using a 3rd party webtool for browsing their parts instead. There’s a hackaday article about it.

Also note that while SMD parts are cheap to get soldered for you, THT parts are not. If finding SMT versions of parts isn’t feasible, I’d recommend just leave them unpopulated and solder them yourself once they arrive.

>damn that would suck
After it confirms the BOM and placement files it asks you to confirm the component placements with a view of the parts on their footprints, so it just takes a minute to scan through that and pick up any issues. If you miss something they’ll probably email you and ask if it’s correct, but I wouldn’t bet on that unless you’re paying extra for inspection. They emailed me about footprints they thought were backwards, they weren’t though.

>>2936278
>FORGOT two internal layers
Not getting that flying probe test?
Anonymous No.2936368 >>2936373
>>2936322
You are trying to get JLC to solder it all for you, right?
yes
>They have a list of parts that they stock that are basic parts and have no fee associated,
ehhh FUCK
i just found this out when I finished the PCB
but i guess i can find alternative components
>Then for a small fee per part they can get stock from the main warehouse of LCSC
yeah I mean apart from common passives I am using few ferrite beads and few oscillators ad specific frequencies
then i also have some mosfets

and the "main" things which are the DAC, the MCU (esp32-c6-wroom) and some amplifiers from texas instr/analog dev.

then i have: rotary encoders (through hole), buttons (soldered), switches (i forgot lmao), usbc port, SD card slot

most of the things are surface mount when possible

my idea was to have the whole PC assembled by them
i have zero soldering experience though I do have a hot hair solder available and I can order shit and try to do stuff
what should I do? do people let JLPC manufacture everything? or do they also get their hands dirty?

by the way.. when I was choosing the parts on Digikey I was always making sure there where in production and in large quantity in stock!


anyways, thank you a lot, your feedback is really helping me!
Anonymous No.2936373 >>2936458
>>2936368
THT rotary encoders will be very simple to solder with a soldering iron, no hot-air necessary. Assuming you have good thermal reliefs. I’d want things like rotary encoders and other parts that might need to match up to a faceplate to be through-hole anyhow since surface-mount alignment is never perfect. There’s also the matter of strength for parts that have humans applying force to them.

I’m not sure about the WROOM module, using castellated vias on a module that itself has solder on it may mean it has to be hand-soldered, which isn’t as trivial as a through-hole encoder. Well I’d go through the quote and see what they charge to solder the ESP32 and decide for yourself if that sounds reasonable. The alternative is to put the ESP32 chip itself on the PCB, alongside its supporting components.

>c6
Based RISC-V enjoyer.
Anonymous No.2936389 >>2936458 >>2936502
>>2936322
>test
idk but they mounted everything on there. 3 digit ICs, a huge ass ceramic filter etc.
why would yomeone be 'getting that test'
why would the customer pay for the supplier to make sure their work is okay
the contract says you get delivered what you ordered, if that's not the case there is no fulfillment
if the reliability is that low it's in the suppliers interest to test
Anonymous No.2936458 >>2936469 >>2936502 >>2936536
>>2936373
>THT rotary encoders will be very simple to solder with a soldering iron,
nice
>Assuming you have good thermal reliefs.
i have no idea what are those

> other parts that might need to match up to a faceplate to be through-hole
the buttons are surface mount... because through holes would have eaten out too much space on both sides of the board.. and the design is already pretty small

>Based RISC-V enjoyer.
hell yeah. the software part of this thing will be fun to do

>>2936389
on jlcpcb some components are wrong
in picrel you can see the SHIT i am talking about
Anonymous No.2936469 >>2936500 >>2936517
>>2936458
idk about jlpcb or any other chink supplier for business
i use those for my private project
but i'm plenty sure boss would rip me another one if I ever put something like that in a product
and if they have certifications and what not theres definately someone who is going to doubt it
idk if they know how NDA work
>had traumatic flashback today
just to add one to the list if what makes embedded so painful
we run the products in the lab alot without the enclosures lid because youre probing and modifying and what not all day anyways so why ever replace the lid
one day we had a fault that bamboozled everyone and also seemed to be sporadic and was impossible to reproduce etc etc.
long story short:
the lid coupled some noise from one location to another fucking things up and all that
just one of those youre chasing the fault for a week and at the end you look very very dumb went through all the datasheets, measured everything, called apllication engineers and so on and someone goes 'huh... if I put the lid on and press down in thos corner it changes, aint that odd? '
Anonymous No.2936500 >>2936502
>>2936469
>but i'm plenty sure boss would rip me another one if I ever put something like that in a product
if you ever "put" those intersectinc capacitors?


>idk if they know how NDA work
what do you mean?

btw this is my own project, open source, done entirely be me

hmm maybe you are relpying to the wrong person? idk
Anonymous No.2936502 >>2936536
>>2936500
idk this is an imageboard in the style of furaba for a reason but if we wanna (You) alot:

Someone, I suspect (You), was like
>>2936389 (You) #
on jlcpcb some components are wrong
in picrel you can see the SHIT i am talking about
here
>>2936458
and that sort of sounds like they (You) are suggesting for me to use JLPCB or something similar at work.
But placing an order there would probably be the last day I have work because a) that would mean leakimg company secrets and b) that would. also. mean I unironically intend to incorporate items of dubious origin into critical infrastructure which might make the customer (state) a wee bit mad.
Anonymous No.2936514
>>2935954
>since you're using a 'puter, you can debounce in software
this is the way. sample on a timer interrupt and debounce/filter inputs.
>wont work if you insist on using interrupts, tho
tying interrupts to real-world noise is a good way to produce interrupt storms
Anonymous No.2936517 >>2936520
>>2936469
>idk about jlpcb or any other chink supplier for business
Somehow foxconn's customers get by.

I haven't used jlcpcb yet but I figure I might on a personal project to see how it goes.

Any of you have suggestions for quick-turn fab and assembly shops that will sign an NDA? They don't have to be cheap if they're fast and good.
Anonymous No.2936520 >>2936672
>>2936517
for private projects they are good I also can recommend pcbway, excellent speed.
Regarding work I could only name some. that are national / local to me and so most likely of little use to others. It's hit and miss, we had a time at work where every non critical mini-project, time and quality wise, would go out to a different new supplier, only so we could evaluate service, speed, quality etc.
Anonymous No.2936536
>>2936458
Thermal reliefs are the gaps in your ground plane around pads that make the pads easier to solder.

I ordered a bunch of RISC-V chips myself, the CH32V series, but I’m too retarded to figure out a toolchain on my frankenstein’d arch install.

>>2936502
No I think the was confused and was assuming you were already using JLC. As for NDAs, I doubt the chinks have time to reverse engineer every damn project you put through them, especially if you don’t tell them to upload the firmware too. But I guess it wouldn’t be a YouTuber sponsorship read without some sort of caveat. Still wouldn’t use them for important production runs, just prototyping.
Anonymous No.2936560
First time posting in this board.
Stupid thought went through my head and idk where to post it: What if I made a 68k computer?
Anonymous No.2936567 >>2936578 >>2936643 >>2936671
OK, I thought for a moment and typed up this

CPU:
>68060 @ 50MHz
Memory:
>2MB Flash ROM
>16MB RAM expandable to 128MB
Video:
>8MB of VRAM
>OpenGL 1.x 3D acceleration?
>Resolutions of up to 1080p
>16.8mil colors
Audio:
>8 stereo PCM hardware channels at 44.1kHz
Storage:
>microSD support
I/O:
>4 USB2 ports
>HDMI ports
Expansion:
>4x 16-bit ISA slots
>2x 32-bit PCI slots

Thoughts?
Anonymous No.2936578
>>2936567
24bit colour * 1920 * 1080 = 50Mb = 6.2MB
You probably want at least twice the VRAM for a single framebuffer so you can write to one frame while the other is being displayed. It's a pretty esoteric project in general, I wouldn't even know where to begin. Are you going to design a graphics card?
Anonymous No.2936643
>>2936567
>Thoughts?

years worth of effort for little gain
because anything you wanna do with it, you'll have to write the code for it
every tiny little thing
a keyboard routine, with roll-over, which is no easy feat
RS-232 code
video code
audio code
a monitor, editor, assembler, compiler

but before any of that, months of building and debugging the hardware
which is gonna be so slow, even Pong will lag

or you can skip all that BS and go straight to coding applications with a $5 ESP-32 board with 10x the power
Anonymous No.2936671
>>2936567
It would be fun if you have no other hobbies and don't plan to have any other hobbies. But what software would you run on it? If you ported a unix, it would just be a slow unix machine.

I've always thought it would be fun to have a really loaded big box Amiga around but I got over it some time when Bill Clinton was still president.
Anonymous No.2936672 >>2936703
>>2936520
I've heard of people sending board files out by 5pm friday west coast time and getting boards back from China on Monday. Not for cheap. Not sure if they could get them assembled or how long that would take. Would be nice to have a known good supplier dialed in like that - that's how you hit 2-3 week cadences.
Anonymous No.2936703 >>2936709
>>2936672
Yeah I did that a few times in uni. You know. Fuck about with your lab partner all semester, last week for the project: Oh shit oh shit.
PCBway does their thing, meanwhile code shit. Have chatgpt document it all. Done.
Anonymous No.2936709
>>2936703
Yeah PCBway is a little lower end than I was thinking but might work. I was thinking who can send by overnight courier for reliable Monday delivery.
Anonymous No.2936836 >>2936943
Is it possibleon 328p to configure phase correct PWM in such a way that ONE of the two signals is inverted?
My manual says to set the COMnx1:0 bits to achieve the desired non-inverted or inverted output.
So setting COMAx1:0 to 3 (set if count > ref)
and COMBx1:0 to 2 (clear when count > ref)
should lead to the desired behaviour, right?
Like say BOTTOM was 0, TOP was 1024 and I set both compare regs to 512 I'd get a 50% differential signal?
Anonymous No.2936943 >>2936950 >>2941933
>>2936836
Me again.
It's a chinese board. Took it out its bag and soldered it straight to board without testing (tested another one from the same batch).
TX light is on. Serial seems gibberish but might be encoding / rate issue.
Upload stuff:
Input/output error
not in sync
resp=0x00
Awesome. Not sure if I can get it off the board also I am absolutely sick of working on this shit. What do? How to nuke the ROM? Anything else im overlooking?
Anonymous No.2936950 >>2936960
>>2936943
If you don’t have a USBasp, use an Arduino as ISP, where you program an arduino to be an ICSP programmer that you connect to the 6-pin header on the target you want to program. Then you burn the bootloader. FYI you’ll probably need to add a capacitor from the programming Arduino’s reset pin to ground once it’s programmed.
Anonymous No.2936960 >>2936962
>>2936950
its all so tiresome.
USBasp
but another ome from the same batch programmed fine via usb
Anonymous No.2936962 >>2936987
>>2936960
same batch
behaves normal
this board got fucked up in no time
it was supposed to be an improvement over the last proto but whatever
Anonymous No.2936987 >>2937039
>>2936962
your mistakes were:
>not just putting the mcu and supporting components on the board directly
>trusting chinky arduino clones enough to not test each board first
>not mounting the icsp header
>using hacky usb serial bootloaders in the first place
Anonymous No.2937039 >>2937046
>>2936987
well it works now
regarsing the ISP id just solder wires when needed
pls give me a rundown how to use 2 nanos in a fashion where i get around that serial on the underside of the board
Anonymous No.2937046 >>2937219
>>2937039
>pls give me a rundown how to use 2 nanos in a fashion where i get around that serial on the underside of the board
Just follow any Arduino as ISP tutorial:
https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/
Pic especially related. All the same data pins (D10,11,12,13) still go to the ICSP header on the target. The only difference when using a Nano instead of an Uno as the source, is that you probably need a capacitor from the source's reset pin to ground. 1-10uf should be good, only add the cap after you've written the sketch onto the source arduino. If you plan on doing this a lot, I'd recommend soldering a ribbon cable to the host machine with 2x3 IDC connector on it.

The missing IC is the USB-to-serial converter (and the voltage regulator, in case you're running on 7-15VDC input). Without the IC you can't program it via the USB port, or send serial messages over the USB port.
Anonymous No.2937219
>>2937046
I got a lot of boards, uno nano mega due
so. if you say use uno for it ill use uno for it
>missing IC
heh
I sure know what a USB serial converter is and what it does. I mean after all thats what you see when you plug an arduino into your computer.
The reason it's 'missing' is because I desolered the whole lot and generally speaking desoldering things with many pins and lots of masse with just iron and air leads to things like picrel. At least you get a free ch340 and linear reg. Would probably cost more than a chink nano if you bought them like that.
Anonymous No.2937938 >>2937956 >>2937981
Hiya!
So I have a 328p on a board and it functions as a source for PWM, either phase correct or up counting depending on mode of operation.
My development process requires me to gradually hike the PWM up after making changes to a board, because an unpredicted element or any error and the whole thing will break.
I can also not allow glitches here. It's a high EMI environment once the PWM is on.
Low or zero value PWM is inconsequential. Accidentially high duty is bad.
I want to hack something on to my board that lets me speed this up without having to reprogram.
My thoughts how to do this are as follows:
I will run code to adjust the PWM once in the setup() function and not update it during runtime. This is to make sure EMI does not fuck with the reading. I will place a row of jumpers that encode the desired setting. The jumpers will pull down as to defeat EMI and loose jumpers. A jumper being placed leads to the duty to increase. So again: This is meant to lead to a safe design, where a loose or forgotten jumper is not catastrophic.
I have plenty of open pins on the board.
So assuming I want 8 bit resolution I plan to reserve 8 pins (17, 18, [22,26], 28) for this, first set them to input, active pullup, delay, and then read each pin and shift it into a byte. When done pass this byte to the register like OCR1A.
Then main empty while(1)
What could go wrong? Is there a better way to do this? I want discrete steps and a low impedance environment. Again: I think a pot is too risky. I might even make entire 8 bit jumpers and key and mark them as to not make mistakes.
Anonymous No.2937956 >>2937962 >>2937962 >>2937963
>>2937938
>those pins
I’m not sure what pinout chip you’re using, but shouldn’t it be a full port? Like PB0-7 or PC0-7. That way it’s trivial to read all the pins at once e with a port read, and just save that to the timer/counter register. But I’d ensure your reset button/switch is actively pulling to a rail in normal operation, and only being pulled weakly via resistor when it is being reset. I assume all output pins turn hi-Z when reset is a logical high.

Instead of jumpers you could use a pair of hexadecimal rotary selectors.

For safety I’d tie LEDs to the jumpers/switches so you know they are in the right state when you toggle them. Or even better, have the MCU spit out the jumper setting somehow and ask you to confirm before it goes into the main loop. It could confirm with parallel LEDs, or with a digital output to a computer (galvanically isolate your signal), or to an I2C screen if you want. You could even just set the PWM value by comms from a computer and do confirmation the same way right afterwards. Ethernet comes to mind as it’s inherently isolated at both ends, but do whatever.

You’re the EDM anon aren’t you?
Anonymous No.2937962 >>2937963 >>2937964 >>2937995
>>2937956
I'm thinking a bit like this:
void setup() {
int pinsInputPullup[] = {17, 18, 22, 23, 24, 25, 26, 28};
for(int a = 0; a < sizeof(pinsInputPullup)/sizeof(int); a++){
pinMode(pinsInputPullup[a], INPUT_PULLUP);
}
char A = 0b00000000;
for(int a = 0; a < sizeof(pinsInputPullup)/sizeof(int); a++){
A &= digitalRead(a);
A << 1;
...
OCR1A = A;
}
>>2937956
>but shouldn’t it be a full port?
Luckily I'm dealing with an MCU and not some ASIC here. So I get to do whatever I want in the software, right? And the thing is on the board now and some lines taken. Why 'should' it be a port? I get it's convenient and saves a few cycles KEK. This runs once and the ALU idles after setting up its PWM.
>use a pair of hexadecimal rotary selectors
I dont have any. Also why hex?
>have the MCU spit out the jumper setting somehow and ask you to confirm before it goes into the main loop
I should also note that there is a requirement where this gets done today and doesnt consume any amount of ressources, as such there will be no shopping and not much effort.
>galvanically isolate your signal
Same issue: No transformers. Optos might be too slow for serial but too much effort and potential pitfalls anyways.
>set the PWM value by comms from a computer
the lack of isolation is why I am currently stuck in a cycle of unplug MCU, take to desk, upload config, plug back in. The very cycle I'm looking to speed up.
>Ethernet
See above. It's obviously a nano. Not writing and debugging drivers that abuse an ethernet port in such a ways today. I should mention my programming sucks and is slow.
>You’re the EDM anon
You're the EDM curious anon. Latest purely qualitative measurements imply we do now have bipolar behaviour. KEK. It's not intentional but rn it looks like that. And the measurements check out when compared to each other. Obviously the voltage on the output side can only remain the same if no charge leaves through the gap or go up if charge is transferred into the output ...
Anonymous No.2937963 >>2937995
>>2937956
>>2937962
...
The output does exactly that. Dampened oscillation for ~ 3 periods during the discharge. The current waveform or first derivative thereof mirrors that.
I wonder where that comes from. With the last board I sometimes felt like it's trying to do that. But there was no inflection points, not even real saddle points. Now since the inductor has a core (but same inductance), the power is up by quite a bit and the coupling cap is several times greater. I suspect one of those changes did that.
Only remaining question is: Is that really beneficial, or not and what's exactly going on.
Anonymous No.2937964 >>2937981
>>2937962
Just assume I put the ~ there to account for the pullup logic
>inb4
Anonymous No.2937977 >>2937995 >>2938012
>wanted to create a simple remote control
>chatgpt told me to get an STM32 Nucleo and CC1101 RF module
>ok done
>ask it to walk me through setting up a simple blink program to get going
>need to create 4 different files with hundreds of lines
what the fuck did i get myself into? i dont remember arduino being this difficult
Anonymous No.2937981 >>2937983
>>2937938
SHIT! There only really is 3 pins on that side. Well I guess its going to be a 3 bit setting.
Cant be fucked. After all thats 9 power levels and if something is wrong I get to see that on the first, generally.
Also >>2937964
not ~
its !.
Like I said my programming sucks.
Anonymous No.2937983 >>2937987
>>2937981
int pinsInputPullup[] = { 17, 18, 19};

for(int j = 0; j < sizeof(pinsInputPullup)/sizeof(int); j++){
pinMode(pinsInputPullup[j], INPUT_PULLUP);
}

uint8_t A = 0;

for(int i = 0; i < sizeof(pinsInputPullup)/sizeof(int); i++){
A &= ~(digitalRead(i));
A <<= 1;
}

What am I doing wrong? It looks like pins 18 & 19 come back 0. I've confirmed they are all being pulled up.
Anonymous No.2937987
>>2937983
Solved.
>my programming sucks
mistakes were made.
Naturally I wanted to
A |= digitalRead(pinsInputPullup[i]);
Also A<<1 on top of the loop as it doesnt hurt on the first time but would double the result on the last round when it's at the bottom.
Now, with 2 random leads shorted to GND, it goes:
00000000
00000001
00000011
nice.
Anonymous No.2937995 >>2937999 >>2938012
>>2937962
>Why 'should' it be a port?
Because it tickles my autism, and makes it easier not to program it wrong. Which might be pretty useful judging by the subsequent replies. But your method is more free to the rearranging of pins, so I guess you’re not making a new circuit layout and are somehow using existing pins to add these jumpers?
>why hex?
Because an 8-bit binary number is the same as a 2-digit hexadecimal number. With 8 pins you get the full 256 different combinations. Decimal selector switches on 4 wires each would only give you 100 combinations, plus you’d need to do the decimal-to-binary division.
>Optos might be too slow for serial
Just use a slower baud rate. Or even just flash a single LED at the set duty-cycle and measure it with a photodiode (read: another LED) and your oscilloscope, or even just look at the brightness with your eye. That will be enough to avoid sudden increases of duty-cycle.
>bipolar
Is the voltage going low enough to get a spark jumping in the opposite direction? Hmm, maybe going without the capacitor is the way forwards…

Also you’ve successfully convinced me that ECM is the better way to go if I just want subtractive machining of metal parts on the cheap. That still needs reverse feed-rates for short-mitigation though, so I’m waiting to see what your sucky coding (your words not mine) can do about that.

>>2937963
Mutual capacitance to the inductor core? What core material are you using anyhow?

>>2937977
Shoulda used an ASIC, like an HT12E.
Anonymous No.2937999 >>2938000 >>2938003 >>2938447
>>2937995
It aint pretty but it works. That goes for the hard- aswell as the software.
We had a little explosion along the wax and half the time went into fixing that.
Guess I shouldn't always use the transformer soldering gun.
Works as advertised. Placing the jumper adds time to the on period as youd expect from binary, 1T, 2T and 4T or combinations of those.
>the explosion
I always thought those glass diodes were nothing but MELFs on a stick? And I thought the appeal with MELFs is the deterministic failure mode? Anyways I had a glass diode go short. B170 or whatevs I just used any. It blew a trace under a cap, what a bitch to find and fix it was.
Anonymous No.2938000 >>2938003
>>2937999
fun time debugging this shit
Anonymous No.2938003 >>2938007
>>2937999
That's why you should always route pads for each of the unused GPIO pins, at least whenever there's room. Some spare GND and VCC too, though in this case GND is covered for you. You never know when you're gonna need extra pins.

Also not liking that solder blob bridging that trace on the left there.

>>2938000
Brutal, what caused the diode to blow?
Anonymous No.2938007
>>2938003
Well I spilled a whole lot of solder across the entire board. It fell off the tip. So I used a big glob of flux and flowed everything out, so I thought. Must have forgotten a few spots. So just a random short on the power for the DC-DC, not the high power section but not the digital either. I think that's literally the best outcome. On the high power section god knows how big the hole would have been, on the digital it would have gotten the regulators and such, maybe. The DC-DC power: Just that diode that I thought would fail open beyond 1A but it failed short.
>Pads for extra stuff. Yeah good idea but then again soldering gun goes brrrrr.
>not liking sold... - ACK
soldering gun goes BRRRRRRRRR
Anonymous No.2938012 >>2938013 >>2938014 >>2938078
>>2937977
Can someone explain this shit? Pic related works as expected; LED is on when button is released, and turns off when button is pressed.
When I invert the highlighted if to say != BUTTON_RELEASED, the LED just stays off regardless of the button being pressed/released. What the fuck?
>>2937995
>Shoulda used an ASIC, like an HT12E.
I don't even understand how to use that. My goal is a programmable 318MHz remote control to open a garage door.
Anonymous No.2938013 >>2938015
>>2938012
Oh. The button electrically shorts the LED to ground when it's pressed. Why the fuck
Anonymous No.2938014 >>2938078
>>2938012
Well what happens if you yet it to equal and stick the negation onto button released?
But I guess it wont work. You'll probably have to look into how button released works internally.
Anonymous No.2938015 >>2938078
>>2938013
LMAOOOO
better safe than sorry huh
Anonymous No.2938050 >>2938054 >>2938078 >>2938112
Are there only enthusiasts here or there are actually people who work as embedded developers?
Anonymous No.2938054 >>2938098
>>2938050
>here are actually people who work as embedded developers?
Yes.
Anonymous No.2938078 >>2938120 >>2938138
>>2938012
There were other weird issues where my code wouldn't flash and I had to unplug & replug the dev board for whatever reason(took me way too long to figure out). But I've got a good starting point now: I put the dev board on a breadboard with a button and LED, and all works as expected. Plus, I set up UART for bidirectional serial console communication so I can actually debug shit and send commands to the board without wiring up a bunch of buttons. Working on the CC1101 but crimping duponts is a pain in the fucking ass so I'm waiting for the female to male jumpers I ordered.
Does anyone know if there's an "adapter board" for a 2x4 pin layout to a 1x8 breadboard-compatible layout so I have something a little more rigid?
Thanks for reading my blog posts!
>>2938014
>>2938015
Turns out that button is a RESET, it's only labeled B1 on the board for whatever reason.
>>2938050
>there are actually people who work
lol
lmao
Anonymous No.2938098
>>2938054
did until spring this year
no one on the team had a very specific position like 'embedded' developer. Everykne was just development engineer and the tasks reflected that. I mean we had guys who werw more or less on one or another side of things and they'd do the respective tasks. But in reality when you're responsible for a few products you get all sorts of work, some hw, some fw, some sw, general design and integration and testing things, compliance and what not.
Anonymous No.2938112 >>2938134
>>2938050
I'm not working for much longer lmao
Anonymous No.2938120 >>2938121
>>2938078
>I set up UART for bidirectional serial console communication so I can actually debug shit
You’re using a nucleo board, its built-in programmer is also a debugger that can pause the MCU and read out its registers, use GDB for this if you want proper cycle-by-cycle debugging.
Anonymous No.2938121
>>2938120
>its built-in programmer is also a debugger that can pause the MCU and read out its registers, use GDB for this if you want proper cycle-by-cycle debugging.
Thank you! That's great to know.
Anonymous No.2938134
>>2938112
You're just feeding them while they can't stop laughing and assume you're literally retarded because no mstter how many times they fuck you over you still support them.
Anonymous No.2938138
>>2938078
>CC1101
Can't get it working. I can initialize it and put it in RX mode, but it just picks up constant garbage instead of an actual signal.
Using CC1101_ReadStatusReg (with 0x30-0x3B addresses):
PARTNUM (0x30): 0x00
VERSION (0x31): 0x14
MARCSTATE (0x35): 0x01
RXBYTES (0x3B): 0x00
TXBYTES (0x3A): 0x00

Configuration registers:
FREQ2/1/0: 0x0C 0x2E 0x8B
Anonymous No.2938447 >>2938463
>>2937999
I’ve been thinking about a bootleg reverse g-code alternative for clearing short-circuits. If a short is detected by a comparator or whatever, an arduino could then pull a pin low to tell the mainboard to halt it’s g-code execution, and another pin to stop the EDM machine from pulsing. Then the MCU would send its own step/dir commands to the Z driver to move upwards, until the short is cleared. Then it would move downwards either until it reaches its original position or until it detects a short again and has to move upwards. When it’s moving up the EDM pulser is disabled, when it’s moving down the EDM pulser is enabled. Once it gets back to its old position with no shorts, the pin goes high again and the mainboard resumes g-code execution.

I was reading a GitHub post and the guy was saying you want variable feed-rate with feedback to your spark voltage, for ECM I guess you could do the same, but I don’t believe Marlin or GRBL have the capability to do adaptive feed-rates. Maybe LinuxCNC can. I think GRBL can do g-code halting, I suspect Marlin can too but I’ll have to look into it.
Anonymous No.2938463 >>2938466
>>2938447
What you described neither needs G-Code, GRBL, a stepper controler, steppers or any of all that since you're describing a ome axis machine 'sinker EDM' or 'ram' where the reversal of movement is trivial. If it's working in the - Z direction reversing to clear shorts means +Z.
>variable feed rate
Yes you can do that. Especially since that is a very common feature on all sorts of CNC machines, where the UI often includes a rotary encoder or pot that can be used to overwrite speeds and feeds.
But the case where this actually is non-trivial, idk if it was ITT, an earlier one or an entirely different one, but I have alluded to that before, is 2D movement, like it is commonly associated with WEDM or any other EDM process that actually requires a toolpath. Suddenly clearing a short is non-trivial and requires at least understanding of the current movement vector at the time of the short occurring or actual memory of the toolpath leading up to the short.
Luckily this has been solved by Roland of the G-EDM project, who rewrote GRBL do do exactly that.
Anonymous No.2938466 >>2938469
>>2938463
My suggestion would still work fine for side-milling so long as the tool has no concave geometry. Not for a slitting saw, but yes for an end-mill. Sure it would be inefficient to go all the way up out of a deep cut to clear a short instead of just backing off a quarter mm, but it should work. Hope it wouldn’t get caught on the way down again.
>Yes you can do that. Especially since that is a very common feature on all sorts of CNC machines, where the UI often includes a rotary encoder or pot that can be used to overwrite speeds and feeds
No I mean adaptive speed changes, where the machine detects the load on the cutting bit and adjusts the speed accordingly via some sort of feedback loop.
>G-EDM project
Oh I should look into that.
Anonymous No.2938469 >>2938480
>>2938466
I don't think you're getting what I wrote. It is a standard feature on NC controllers to have an input for adjusting speeds and feeds on the fly. The input is a defined interface, it does not care if an actual rotary encoder or pot is connected to it, only that whatever is connected to it acts or looks like it and thus conforms to the interface.
Anonymous No.2938480 >>2938531 >>2938531
>>2938469
>The input is a defined interface, it does not care if an actual rotary encoder or pot is connected to it
Ah, I see what you're saying. I assumed there'd be a separate input for a manual control compared to an automatic control. Because the automatic control is part of a feedback loop, it should increase the feed-rate until the voltage passes a threshold. If it's just expecting a potentiometer then you'd need an external error amplifier, which is ok, but then if you also want to be able to automatically set a different voltage threshold for roughing and finishing passes you need a DAC. Anyhow, does GRBL or Marlin do that?

Hope that GEDM project will be applicable to ECM.
Anonymous No.2938531 >>2938654
>>2938480
>>2938480
I omdont want to offend but I think you're a bit all over the place with your thoughts and also more concerned with what could be done instead of what is sensible to do.
Like having two MCUs and have one take control from the other and hand it back without having a real interface and protocol for that... it doesnt make too much sense.
Meanwhile the speed overwrite input: It's just that. Input that overwrites speeds. And its got a nice interface, you know, voltage, or pulses.
>you need a DAC
you never really 'need' anything digital. Yes there's reasons why we like to do things digital and avoid analog as much and as long as we can.
Also switch that either puts another R in series or parallel with that signal source or biases it by various means if one really insisted on jogger rigging something like that onto a preexisting input of that kind.
>Does controller firmware do that
Yes absolutely. Besides the fact that you can always write a simple M code, marlin for example is already equipped out of the box to toggle a digital pin on any board that you have a HAL for.
But if you ask me: Just use the S parameter? I dont expect you to have an actually rotating spindle. And your gap voltage is probably the best analog. So instead of not using the S parameter at all just define it as an proportional to gap voltage. If you insist on a hacky solution feed a diff amp of that and the gap voltage into the speed overwrite? Tada theres your thing.
Anonymous No.2938654
>>2938531
>I think you're a bit all over the place with your thoughts and also more concerned with what could be done instead of what is sensible to do
I’m just spitballing for now, trying to see what is doable, then narrowing that down to what’s sensible, then narrowing that down into something I should make. My aim is <0.1mm accurate parts made of metal for cheaper and quicker than getting them milled or 3D printed overseas. Wire and sinker processes are useful for specialised geometries, but I’m just after bulk roughing out of billet, so a square-nose cylindrical end-mill is probably the way to go for me. EDM seems both more difficult/expensive to make, while being slower and more prone to tool wear.

>S
Ahh, that’s a very nice elegant method with a pulse frequency output that’s easy to turn into a DC voltage. If I have to use Marlin or GRBL it’s worth keeping in mind.
But that G-EDM project looks promising enough I probably won’t have to use stock GRBL or Marlin, and I think I have all the stuff lying about to get it working, sans the screen. Wish it had better documentation, but it’s a relatively new project so we’ll see.
Anonymous No.2939743 >>2939771
Is there any way to use the counters in a 328p so that there is an output that is centrally aligned to an edge of the other output?
Like imagine one output toggles but just before every falling edge the other output turned 1 and back to zero after the falking edge. So it's like the phase of one outpur was aligned to the edge of the other.
Anonymous No.2939771 >>2939775
>>2939743
Maybe if you could use a single timer with one compare channel in phase-correct-PWM mode and the other output toggle-on-rollover mode, but I suspect you cant have two different waveform outputs in a single timer. Worst case you just synchronise two timers I guess. There’s probably a smart way of synchronising timers with interrupts but I never tried.
Anonymous No.2939775 >>2939848
>>2939771
I think I have now settled on just cycle counting and probably hard coding a few modes. The thing is I dont need anything besides the setup and then the timers. So for the time being I can just keep cycle counting indefinately without ever handing over or overly complex flow.
And afaik... idk 4 cycles for a noop? I think it was something lile that, I need microseconds so that should be well within reach and precise to some digits too.
>inb4
yes single micros not multiples of 4 plus minus
Anonymous No.2939848 >>2939942
>>2939775
I would have just delayed the other output (assuming trailing edge) and sent the output through a pulse stretcher using some discrete logic.
Helps if you have access to a 2x freq clock.
Anonymous No.2939942 >>2939954
>>2939848
the board is as is I can only change software at this point.
>which is better:
i could make a simple blocking delay function that takes one argument, uS, multiplies it and loops through as many noops and call this at several points in an eternal loop
Alternatively I could reset a timer and block using a while(timer register < xxx) {}
and reset the time every time
that way it wont ever overflow and I dont need to add previous elapsed time
Which method to prefer and why?
I'm bad at programming and I think I'm experiencing paralysis by analysis
Anonymous No.2939954 >>2939974 >>2940048
>>2939942
Is, in the arduino environment, this
void loop() { do stuff}
any different from
void loop() {while(1){do stuff)}}
?
I have just written my stuff using delayMicroseconds which is bad as it again has a resolution of maybe 4 uS but i wanted to get out of paralysis quick
I've then caught a glitch. See picrel.
I was concerned over arduino related stuff like watchdogs or similar fucking my shit up.
So I tried while(1) to prevent it from ever handibg back and I havent been able to catch another glitch which doesnt mean there is none.
Glitches would be bad.
Anonymous No.2939974 >>2940007
>>2939954
I'm now also thinking:
no interrupts might be a good idea anyways but also:
Is there anything in an otherwise empty 'sketch' that could trigger interrupts
Anonymous No.2939985
schematics for burst emitters ?
jammers also plox
Anonymous No.2940007
>>2939974
This seems to work oksi
[code]
void microsecondsDelay(uint8_t uS) {
uint8_t count = uS * clockCyclesPerMicrosecond() / 4;
uint8_t i;
for(i =0; i asm volatile ("nop\n\t"); }
};
[/code]
[code]
PORTB = 0b00000000; //Idle
microsecondsDelay(1);
PORTB = 0b00000010; //Charge
microsecondsDelay(1);
PORTB = 0b00000110; //Connect gap
microsecondsDelay(1);
PORTB = 0b00000100; //Discharge through connected gap
microsecondsDelay(1);
[/code]

I figure a nop is 1 cycle but the loop itself is more like 4 cycles because the incrementing and comparing and all that? idk? is it? it looks kinda good and I'm just going with the inaccuracy as long as I get the precission.
Like yeah sure figuring out count every time takes some cycles too.
Anonymous No.2940048 >>2940127
>>2939954
> glitch
Interrupts disabled?
Anonymous No.2940051
>ardushitto
Anonymous No.2940127 >>2940219 >>2940349
>>2940048
Yes I have disabled interrupts for the critical part. I'm curious regardless, suppose you did not, what is there in an otherwise blank 'sketch', when n there is no comms and nothing, to trigger interrupts?
Anonymous No.2940219 >>2940226
>>2940127
The USB serial bootloader
Anonymous No.2940226 >>2940240
>>2940219
wouldnt that onyl trigger shit when comms are happening?
Anonymous No.2940240 >>2940242
>>2940226
Only happens at boot / power-on-reset, regardless of whether there's serial comms, not sure if there's actually an interrupt going on but it sounds likely.
Anonymous No.2940242 >>2940245
>>2940240
Mhm shitty situation, since I need to be sure and I have nothing to trigger on pulse length x
id have to make a counter
Anonymous No.2940245 >>2940354
>>2940242
it's only there on the boot period anyhow
if you're worried just wipe the bootloader and use an icsp programmer instead, bootloaders were a mistake anyhow
Anonymous No.2940349
>>2940127
You wouldn't have to ask this if you didn't use arduinos ridiculously shitty framework.
Anonymous No.2940354 >>2940479
>>2940245
nah thats ok first thing I do is bring everything to a safe state
then set everything up
and only before entering the loop all safeties come off
the one I caught did occurr in the main loop
Anonymous No.2940438 >>2940479 >>2940490
>>2928655 (OP)
hello mcg, stupid question since i am new to this.

how are chips attached to eval boards like picrel? does it have to be soldered if you want it to stay fixed in place?

if the latter, could you not just solder on some wires yourself and skip the eval board altogether?

i have the chip, but not the board.

https://www.mouser.com/new/infineon/infineon-xensiv-pas-co2-5v-eval-board/
Anonymous No.2940479 >>2940490 >>2941373
>>2940354
There might be other interrupts coming from arduino functions though, like analogRead, delay, or serialPrint. You should avoid these and directly address the registers if you're unsure.

>>2940438
What do you mean by "chip"? The IC? The metal can? Or the surface-mounted BGA(?) board that contains the IC and the metal can? The lower board that the surface-mounted board sits on looks to just be a breakout board for prototyping, so you should be able to do without that.
Anonymous No.2940490 >>2941373
>>2940479
I did not use any of those and only used direct port manipulation and register read writes. Idk how to use all that I only work with the 328p and AVR reference. Thanks for the heads up, all spunds like I expected.
>>2940438
You have many options. In production, if all the products are configured the same, it is not uncommon to solder directly. So either you have 1mm holes for the 0.64mm pins and mount it THT or you can even save yourself the pin headers and aolder vias to vias directly. Depends on if and what there is on the underside and if you can have a cutout in the board etc.
It's also possible sometimes to mill the contour of a board like that so the outer vias are disected. You then have really nice exposed features to solder SMD style.
You can ofc always mount a female header of varying quality or use ribbon cables. This depends on space, the need for customization or replaceability, shock and vibration rating, current rating and RF performance. You can sometimes run two grounded pins on either side of your RF pins, it sometimes helps.
Anonymous No.2940941 >>2940944
Alright MCG I am reusing a vacuum pump that has an air pressure sensor and a mini dc pump (yb370) I originally used it to vacuum seal filament bags, and SMT pick up tool once in a while, however I wanted to make some changes to work with a foot pedal and a solenoid.

What I have got right now is a 5A pwm controller that has a resettable fuse.
>https://www.amazon.com/dp/B091SHPR6L

2v025 solenoid 12v
>https://www.aliexpress.us/item/3256805024070436.html

air pressure sensor hp203n (reused)
arduino nano
OLED screen
lm2596 or mp1854n 12v -> 5v for motor and nano usb powered
logic level shifter for hp203n operates at 3.3v

Now my question is, how should the motor behave? Should I just have it continuously running even when air flow is block (picking up smd chip with blunt needle) or would I want the motor to stop when it reaches a certain negative pressure, and turn back on when it loses *insert epsilon value* kpa/pa?

To me it seems option 1 would wear the motor out or ruin the motor while at the same time maybe not, while option 2 also seems like it would ruin the motor and the reason for that is because the pneumatic connectors I currently have suck apparently since I cant hold a seal when suing any of them.

pic not mine just found online.
Anonymous No.2940944 >>2940950
>>2940941
just run its what units sold as lab equipment do to
and it makes sense
vacuum pumps are designed to reach a certain vacuum at which the lack of gas to pump will automatically let them shed load. Usually mmvacuum pumps are rated to run under those conditions indefinately. You see unlike a pump providing positive pressure vaccuum has a limit and the work doesnt get harder, it gets easier.
Anonymous No.2940950 >>2940956
>>2940944
>vacuum pumps are designed to reach a certain vacuum at which the lack of gas to pump will automatically let them shed load.

When I powered the motor directly it was 5v @ 0.7a this probably explains when it dropped to 5v @ 0.4a when I blocked the tube.

the pwm controller seems to have limited the current to 50ma and would shoot up to 200ma when I blocked the tubing, I guess I would just discard using the pwm controller and just power it @ 5v then?
Anonymous No.2940956 >>2941020
>>2940950
Yeah, vacuum pumps (and your household vacuum cleaner) use less current when blocked.
But a pump like in picrel is not long for this world, so you want to minimize the on time, and also minimize heat buildup.
Anonymous No.2941020
>>2940956
Well from your comment and the other one, it sounds like I should just grab the old pcb that was controlling it, and modify what I can, the manufacturer didnt put any markings on the main IC, and it a pain in the ass so many of the pins are on ground, some pins I manage to figure out but damn I wish I could look up IC by pin placement, and ic-type or whatever ssop and others like that are called.

Anyways thanks, I was hoping to power this from a power supply but I cant seem to find out if this non used solder points P+ and P- are meant for another version of the vacuum pump that can be directly powered from a power supply, but I guess I will find out.
Anonymous No.2941253
>>2935852
just get a j-link edu, if you only use it from your private network.
Olimex also has a cheap open-ocd debugger.
Anonymous No.2941367
i want to turn wireless debugging on to use Shizuku on my Android phone WITHOUT using any wi-fi connection ("wireless debugging" requires this and i can't find any way to bypass this without root and i don't want to root rn) or any device to set up a local hotspot.

apparently, this isn't possible, so the next best option is to get a the smallest, most portable router for a local hotspot.

is this $4 USB pocket wifi modem i intend to use unSIMmed the best option or could i get a cheaper microcontroller to program a start/stop local hotspot routine?

>second phone
don't have one.

>captcha: KMSWR
Anonymous No.2941373 >>2941476
>>2940479
>>2940490
late reply, sorry

>surface-mounted board that contains the IC and the metal can
this sounds about right

picrel is the underside (14 mm wide)

if i buy the breakout board, would i *have* to surface solder the "chip" for it to remain in place? would it be viable with some jank alternative like electrical tape to make it not fall off? rigidness is not too important.

i only have breadboards, so option 2 would entail soldering free wires directly onto the "chip" which then go to the breadboard. but that sounds risky given the size. will an inexperienced solderer not just mess that up and damage the sensor?
Anonymous No.2941476 >>2941506
>>2941373
Pressure-based mounting might work if each pad was connected to with something compliant (e.g. pogo-pins), but just taping down one board onto some other surface, even with solder bumps, likely isn’t going to work at all, at least not reliably. Soldering wires onto the pads is the other option, but if you tug on the wires it might rip pads off, and the pinout doesn’t seem to describe what those central pads are for.

Have you already bought the module without the breakout board?
Anonymous No.2941506
>>2941476
>Have you already bought the module without the breakout board?
yes. i made a mistake

>Pressure-based mounting might work if each pad was connected to with something compliant (e.g. pogo-pins)
seems unlikely to be the case here, so i think wire soldering is the best option then. i'll probably do it with some female dupont headers. thanks

getting this thing to work will be an excuse to get into soldering, i don't mind desu
Anonymous No.2941507 >>2941527 >>2941529 >>2941593
I'm a software engineer but just finished an arduino course and now want to build a digital wrist watch. I'm trying to pick out hardware, and the Cortex M0 looks promising as a core. I've narrowed the MCU down to either STM32L0 or TI's MSPM0L (both ultra low power devices). I'm slightly preferring the TI because it's smaller (I'd eventually like to minitiarize the watch as much as possible), newer (although this might be a bad thing), and looks like it has better docs (STM's website is a mess but maybe I'm just too stupid to navigate websites properly). Additionally, as a software guy who's completely comfortable working with code/bits/memory/etc, I found the "hand-holding" of Arduino IDE a bit patronizing, and it seems like there's lot of that in the STM32 ecosystem (although I'm sure there's ways to cut through all that). Would choosing the TI chip be retarded? ChatGPT is pretty strongly pushing me to the STM32; not sure if that's actually the best choice or just the midwit consensus from the internet hivemind.
Anonymous No.2941527 >>2941567
>>2941507
do you really need a 32-bit chip for a wristwatch?
it's not a smartwatch, is it?
an msp430 might be a smarter choice

the stm32 ecosystem is wide, if you learn one stm32 then that's a skill you can apply to a lot of different parts for different applications, but yeah people do have some opinions about their bloated hal
Anonymous No.2941529 >>2941567
>>2941507
>Would choosing the TI chip be retarded?
I've never had MSP430 be easy to use unless you're running Windows and have the official TI debug thingy or maybe a hacked up launchpad board.
STM32 you can hack up a GCC toolchain and use a $5 clone STLink to talk to the chip.
It's been more than 10 years, but I remember that MSP430 had some goofiness where the contents of the interrupt vectors worked like a password for accessing the chip, and if you didn't have it right it would erase the flash, including the part of flash that contained factory calibration for the RC clock. There's security and then there's paranoia. (I was able to sort of recalibrate against a 60hz zero crossing detector)
I didn't hate MSP430, it was an okay architecture and even kind of fun, but it was too annoying to work with when I was no longer being paid to do so with someone else buying the tools including an IAR compiler. On the other hand, my STM32 experience let me use a Bule Pill board with no problem.
One anecdote is when there was a bug in the Mac version of the debug driver, TI fucking held the patch back because they insisted on their development package being all the same version number and they weren't ready to make a new version even to fix a bug.
Yeah, this was the TI of 10 years ago, but I haven't seen much excitement for them since then. I did eventually get one of those old MSP430 wristwatch kits a few months ago, but way too much other stuff to do for now.
Anonymous No.2941567 >>2941569 >>2941573 >>2941678
>>2941527
>>2941529
I did consider the msp430, but it seems like TI has bet its future on ARM with the mspm0c/l/g. I'd also rather work on ARM because it provides an easier pathway to BLE if I ever want to support that (with nrf52 or something like that). Since ultra low power consumption is basically the same between msp430 and mspm0, I don't really see a compelling reason to go with msp430 unless it's vastly simpler (but sounds like it probably isn't).
Question then becomes which vendor do I choose, TI or STM? I think TI looks interesting, but I could easily get annoyed if they force me into using shitty tooling. There definitely seems to be a strong "bare metal" STM32 community, so I would have a lot of resources to help me figure that out which I may not have on the TI side. STM32 definitely seems like the safe choice, but the only thing holding me back is that the STM32L0 is 25mm2 in area vs 16mm2 for the mspm0. And as an American, it might be better for my career to be on an American platform vs European, but who knows.
Anonymous No.2941569 >>2941605
>>2941567
>ultra low power consumption is basically the same between msp430 and mspm0
Oh that's impressive. I bet they'd sell a lot more to hobbyists with an open toolchain and open-source hardware for the programmer, but TI doesn't seem as into that as Microchip or STM.
>TI or STM
I'd go STM. While they don't encourage people programming it bare metal, plenty of people do, and there's lots of 3rd party development environments to choose from. The programming hardware is also dirt cheap. People clone those chips too, with things like the GD32. I think you can also use the same programming hardware and software for their smaller STM8 chips, probably for ST's ASICs with an ARM core inside (e.g. motor drivers, power management chips, etc.) too.
Anonymous No.2941573 >>2941605
>>2941567
>an American platform vs European
Nobody with any sense calls STM32 a "European platform".
Anonymous No.2941580 >>2941605
So the recommended method to handle multiple SPI slaves is to share the SCK, MOSI, and MISO pins, and use a different SS pin for each. But then you go into the datasheet of an MCU like the 328P and find it only has one hardware SPI SS pin. What the hell is the point of that? Do the tarduino libraries just bit-bang SS synchronously to their SPI hardware communications calls? It’s not that big of a deal since there’s no DMA, but it feels kinda silly. I could also apparently use the USART hardware as SPI, though I doubt existing libraries would know how to work with that. If you do set some random GPIO to be SS, what happens to the actual hardware SS pin? If it’s set as an output pin, does it toggle alongside your software defined SS pin?
Anonymous No.2941593 >>2941605
>>2941507
>arduino course
>asking chatgpt fort advice
Is there a better general, board, or website, where I don't have to see this clown shit?
Anonymous No.2941605 >>2941626 >>2941708
>>2941569
Thanks for your help. I'll probably go with STM32 and see how that goes. This stuff is complicated enough as it is, I'd rather not trail blaze on a relatively new platform.
>>2941573
I never claimed to have any sense, but STM is definitely a Euro company. Probably doesn't matter, but if I ever want to sell electronics in the USA, it could be easier to get government gibs if I used TI.
>>2941580
The datasheet labels PB2 as a "slave select pin" which is only applicable when SPI is enabled as a slave. When SPI is configured as a master, I don't believe there's no special relevance to the PB2 pin (maybe aside from some arduino lib internals). And yes, you need 1 pin per slave (any gpio pin works) and need to manually pull it low before transmitting SPI, but I'm sure there are libs available to make this more ergonomic. I'm a noob, so maybe get some verification on all this, but that's my understanding.
>>2941593
Sorry to offend you, fren.
Anonymous No.2941626 >>2941683 >>2941708
>>2941605
>When SPI is configured as a master, I don't believe there's no special relevance
That's probably how it works. The SS pin only matters for a slave device. Otherwise any old GPIO can work as a select.
I've been doing some 68HC11 stuff lately, it seems to be the same, and that era was the OG of SPI.
Anonymous No.2941678 >>2941679 >>2941708 >>2941763
>>2941567
> bet it’s future on arm
No, msp430 is just their 16-bit platform.
If you are coding it in assembly, this is the one you want. It was designed for that.
If you’re loading python on it, you’re going to want something with x1000 more power, and that’s going to be a 32-bit arm based core(s).
Although, you’d still be able to get more compute done on the 16-bit MSP 430 than the ARM.
“Loading python on it” is code for “doing anything other than machine-level programming”
… and ARM really sucks for low level stuff. And has gotten worse. I think you can find ARM cores that potentially have around 1200 instructions now.
Anonymous No.2941679
>>2941678
>… and ARM really sucks for low level stuff. And has gotten worse.
Lolwut? You want to use python instead?
Anonymous No.2941683 >>2941684
>>2941626
> been doing some 68HC11
Sounds interesting. Using real 68hc11s or is it a second-sourced core?
I see 8051 cores being used to glue analog radio to I/O sometimes, running at 50 MHz/1 clock/cycle…
… more than anyone really needs.
Anonymous No.2941684 >>2941765
>>2941683
>Using real 68hc11s or is it a second-sourced core?
Why would I use core shit when there are plenty of 68HC11 chips in user-friendly DIP packages?
Anonymous No.2941686 >>2941708 >>2941763
I have thought about a digital dumb watch that has a calendar snooze. I dont really care about the heart beat feature. Also maybe have it tell you when it’s going to rain. What else.
Anonymous No.2941708 >>2941762 >>2941763
>>2941605
>>2941626
Ah I see, you’re right. You can set the SS pin as an input or output when in master mode, and as an output it works as any regular GPIO pin without being connected to internal SPI hardware. When used as an input it actually acts a bit like an SS pin of a slave device, if it’s pulled low it interrupts the transmission process.

Damn this is the kind of stupid question that GPT or whatever would probably help with. I should investigate running deepseek or whatever locally. Maybe an American model too so I can ask it about what happened in Tiananmen Square.

>>2941678
>> bet it’s future on arm
>No, msp430 is just their 16-bit platform.
I don’t see how that’s a contradiction. MSP430 is their 16-bit MCU series thats often used for low-power and has been around for decades. MSPM0 is their ARM M0 core 32-bit MCU series that they’re pushing hard because it’s more powerful and can have just as low a quiescent current.

>python
Ok I get that they disincentivise writing for ARM chips in assembly, and they may even not have very good documentation for those who write C without their bloated HAL, but there’s still a long jump between using their HAL and using Python, your superlative is unfounded. The MSPM0 ARM chip isn’t even supported by micropython. HALs should still compile down to be about as memory and clock efficient as bare C, and pretty close to assembly, while Python is nowhere near as fast or as dense.

>>2941686
Ionising radiation detector, be it ion chamber or SBM21. Also make it collect time information from outside, be it wifi, GPS, those radio broadcasts in some countries, whatever works. Ideally it automatically handles daylight saving time.
Anonymous No.2941762
>>2941708
> ARM M0 core 32-bit MCU series that they’re pushing hard
Not sure why. I just spent a bunch of tine researching the M0s. These are chinese arm slop cpus they’re selling. They even left chinglish in the data sheets. I doubt TI even fabs them, None of them have FRAM, and the ADCs are very different. In fact, *everything* is different. So different that, after reading the migration guide, you basically have to throw everything away and start again.

> because it’s more powerful and can have just as low a quiescent current
That is not clear. They both do around 80μA/MHz but the msp430 does more useful stuff in 1.3 μΑ low power mode, and they both have multiple LP modes.

The average M0 user is not likely to be sophisticated enough to effectively use those those modes anyway and will likely use 100 times the amount of power transferring all the data internally as yaml.

If you need 32 bits for a watch, that’s your problem, not mine.
Anonymous No.2941763 >>2941767
>>2941686
Yea, I'm doing the dumb watch thing too. Putting a nice digital display into a fake nautilus case for phase 1 of the project. Would like to hook up the crown to some type of rotor control to set the time, but we'll see. Any ideas on how to do that? Btw, hoping to get 5+ years of battery life on this with a coin cell.
>>2941678
I mean I could code it in assembly, but not sure I want to. Like >>2941708 said, C should be just fine, no one is talking about python lol. Question, are STM32 HALs mostly just a collection of macro definitions? On Arduino, looks like a lot of the "digitalWrite" etc methods actually incur a runtime memory/perf cost, but if this HAL bloat is really just zero-cost abstractions in the pre-processor, I'd be much more amenable to it. Would still need a register level understanding of everything, but wouldn't mind importing some HALs to make life easier.
Anonymous No.2941765 >>2941849
>>2941684
> core shit when I have DIP?
Good point.
MSP430s also have DIP, I didn’t see any M0s in dip (might exist, who knows)
Anonymous No.2941767
>>2941763
> zero-cost abstractions in the pre-processor
You have to look at the generated machine code.
There is a bunch of shit written by retards that do processor checks and case statements in the code and they’re not just #defines.

In almost all cases, it’s easier to init the cpu, ports and peripherals in machine code.
Anonymous No.2941849 >>2941906
>>2941765
The only DIP ARMs in a long time were a couple of NXP chips, and they were low pin count too, no 40-pin monsters.
You could probably put a QFP on a breakout board, but at that point you might as well take the Blue Pill and add the crystal and some jumpers.
Anonymous No.2941906
>>2941849
Carriers are the way.
I think now the epoxy packaging (and the process to make *any* chip) is the bulk of the cost for high-quantity production parts)
Anonymous No.2941933
>>2936943
select old bootloader
Anonymous No.2942247 >>2942290 >>2942314
I have a question, I am reusing a pcb to control a vacuum motor and that turns it on / increase pressure limit. To turn it on its a button press that shoorts gnd pin to another pin,if I wanted to simulate this on a esp32 cant I just solder wire too the non ground pin and then have esp32 make that pin from low to high or high to low to think the pin go shorted to ground or would I need to use djt/transistor whatever according to my google results to achieve this?
Anonymous No.2942290
>>2942247
Generally, yes if both are using the same power supply.
Output pins have a fan out rating that lets you know how many inputs can be driven with that output.
You might want to put a resistor between them though, just in case.
Anonymous No.2942314 >>2942329
>>2942247
To be safe I'd use a logic transistor to pull it down instead. That way you don't have to worry about power rail timings or voltages. By logic transistor I mean either a small-signal Nch MOSFET with a low enough Vgsth to turn on easily from the ESP's 3.3V signal (probably also a resistor from gate to ground), or a small-signal NPN bipolar transistor with a series base resistor. All of these methods assume a shared ground rail, which is usually a safe assumption.
If everything is on the same 3.3V supply then using a GPIO should work fine. If you keep the button in place, ensure that the MCU can never pull high hard, only ever with a pullup resistor (if not just go hi-z by setting it to an input and using the existing external pullup resistor), to ensure you don't get the fault condition whereby the ESP is pulling up while the button is pulling down. A series resistor is a hacky workaround, as it might not result in the signal being pulled low enough.
Anonymous No.2942329 >>2942354
>>2942314
> fuck around with transistors
No need with TI’s “little logic” line. Use a buffer or inverter as appropriate, or use the line level translator series in picrel.
Anonymous No.2942354
>>2942329
We want something that actively pulls down like a button, regardless of what voltage a resistor is pulling it up to, and actively pulling up is detrimental if he's keeping the button in place for manual use. You could get a level-translating buffer with an open collector output, but a transistor is both easier to wire up and cheaper. Especially if you get a logic transistor with built-in resistor(s).

If you use no transistor or logic and wire the MCU pin directly up to it, you also get the benefit of being able to sense whether the button is being pressed. I'm designing such a PFET power latch button circuit as we speak.
Anonymous No.2942736 >>2942865
Man, my DHT11 is giving me false readings half the time. I’m using an ATMega328P’s internal 8MHz oscillator so it could be that the clock isn’t accurate enough, but I measured a tone output and found it to be within half a percent of what it should be. Guess I’ll flip it back to a crystal oscillstor and see if that helps. Damn “one-wire” sensors are stupid.
Anonymous No.2942865
>>2942736
Clock stabilisation was not the issue. Hmmst.
Anonymous No.2943149 >>2943155
I was thinking about implementing a humidity/temperature lookup table for a sensor with interpolation, but then I realised I’d be much better off just calculating a sufficiently matching polynomial.
Anonymous No.2943152
Anyone ever messed with ESP-NOW protocol?
Anonymous No.2943155 >>2943186
>>2943149
That’s fine as long as you don’t want to recalibrate it over time and/or different temperatures, and your μC has ultra-fluffy things like hardware multiply.
Interpolation is an add and right shift p.
Anonymous No.2943186 >>2943307
>>2943155
Well I’ll be collecting humidity-temperature values together, so it would be a bilinear/bicubic interpolation that takes temperature into account anyhow. I’m pretty sure the curve will be pretty simple, like an exponential or logarithm or whatever, without inflection points. The sensor varies its capacitance with temperature and humidity, and I’ll be measuring it’s capacitance as the C in an RC oscillator. I’ve got a datasheet for a very similar part with a dense lookup table in it (though it doesn’t go into the high temperature range I plan on using the device in), but besides that I can only do some pretty coarse humidity calibrations myself. Using sealed containers and saturated salt solutions. So it will be important to get an idea of the trend from the datasheet values, normalise them if needed to my values, and extrapolate them to the extremes.

I don’t actually know how I’d compute a Taylor polynomial for a 2-variable system.
Anonymous No.2943307 >>2943315
>>2943186
> I don’t actually know how I’d compute a Taylor polynomial for a 2-variable system.
Last time I did something like that I just made a guess-and-check loop converging the chosen coefficients towards making tests on the curve against data points more accurate (maximally accurate, in fact).
Took less time than finding my old textbooks and whatnot.
Anonymous No.2943315
>>2943307
Sounds like something I’d do, I passed a physics paper using euler’s method for my integrations after all.
So if I understand, I not only have X, X^2, X^3, and Y, Y^2, Y^3, but XY, X^2Y, XY^2 terms to guess through, right? Seems like the extra dimensionality will hurt, but I’m thinking I can match just an X cross-section with X terms, just a Y cross-section with Y terms, and then use the XY terms to make the rest of the graph fall into place.
Anonymous No.2943333 >>2943368 >>2943394 >>2943446
I have a specific thing I want to create, a multimedia knob with 1 in and 2 out. one to my headphones and one to my speakers. I want to quickly be able to switch outputs, control volume, and mute, ideally with as few buttons as possible: spin the knob to control volume, press it to mute, and press+turn to switch outputs.

what do I need to study to know how to make this? where do I start?
Anonymous No.2943368 >>2943394 >>2943397
>>2943333
The easiest thing to do would be to make one that does this as an analog device.

If you want to make it digital, and you’re using a PC
obviously you can make something that emits keycodes over usb that can do everthing,
My keyboard already has a big volume dial and mute on it.
Anonymous No.2943394
>>2943333
>>2943368
Doing it all digital would mean a USB device that does both audio and HID. You might be able to program that all on one MCU acting as a virtual hub, but I’d probably use an actual hub IC and wire it up to a TI USB audio codec and a shitty USB MCU running the keybinds.

If you don’t mind two cables, having the HID device on USB and the audio stuff on 3.5mm would be easier. You could change volume and maybe do the other fancy stuff without any USB interaction, but then you’ll have PC volume control be seperate to the device’s volume control, which is suboptimal.
Anonymous No.2943397 >>2943419
>>2943368
>My keyboard already has a big volume dial and mute on it.
that's how I arrived at this idea in the first place, I got a keyboard with a volume dial and a mute button in the center. it was super convenient until the volume dial stopped working, it's a common issue with these keyboards. the "fix" is spraying under it with contact cleaner which does work, but only for a few weeks.
Anonymous No.2943419
>>2943397
Surely you can just replace the potentiometer / encoder? Assuming it can’t be disassembled and chucked into an ultrasonic cleaner.
Anonymous No.2943446
>>2943333
This is trivial to do on Linux with an off the shelf knob programmable via QMK. Just did it today with my new GMK26. I wrote a script that toggles between any number of sinks exposed by PulseAudio.
Anonymous No.2943886 >>2943889
I'm building a kind of not really joke alcohol dispenser and I have a bunch of peristaltic pumps driven by servos.
My lame ass idea is that with the servos I can accurately control dosage of the various liquors.
What shitass microcontroller on a board is up to the task of handling like 16 different servos, and some actual valves that I haven't yet determined what to use. Also shit like 6 switches one for each drink output and maybe some lights.
I have in the past used a stm32 on a different project. It may be wise to for this if I want to do anything with rs485/can
Anonymous No.2943889
>>2943886
What sort of servos are they? Common RC servos can't do continuous rotations, I'd probably use cheap stepper motors. As for driver pins, I'd consider just having one driver and using relays to multiplex which motor is being controlled by the driver, assuming you don't need to meter out multiple fluids at once. Or even use a single main motor, plus an additional motor to rotate a camshaft that engages the motor into just one pump at a time.