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

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

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


[Advertise on 4chan]


File: butchered pico.jpg (79 KB, 640x853)
79 KB
79 KB JPG
Previous thread:>>2802510

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
>>
Wanna try making an audio effects processor. Would an stm32 or esp32 do the job or are they not powerful enough to do it with low latency?
>>
File: PIR815.png (299 KB, 370x419)
299 KB
299 KB PNG
are all the through hole,3 lead PIR sensors the same? got some off amazon and thought my problem was signal duration, turns out that all 3 just trigger falsely nonstop and crash my program. I have a wireless manufactured unit that works great because of all the extra buffers and comparators. i found pin 2 on the 8 pin boy goes high with the LED/motion. am i good to solder that to my esp with a pull down resistor. just power both with a 9v, but then how stop it from blasting at 433mhz.
>>
>>2827142
ESP32 has a lot of RAM, DMA, and I2S, but no vector or DSP instructions I think. Some STM32s have more RAM than the ESP32, plus vector and DSP operations, so do some research about that. All STM32s should have DMA, and most should have I2S I think.
>>
File: image_123650291(2).jpg (427 KB, 1170x1542)
427 KB
427 KB JPG
>>2827191
nvm just went for it. sensor works better but 10x movements in a row still make esp restart. good enough for me tho.
>>
>>2827142
What kind of audio effects? If it’s Z transform stuff then they can do it easily. If you’re doing delay/echo stuff, then it should be alright. If you need a live continuous 48kSps STFT, then you’re pushing it, especially with the inverse transform afterwards and any shit you might be doing in between. Even an STM32G7 might struggle with a really complicated chain of effects, though you can probably simplify such a chain mathematically.
>>
>>2827109
i can fix her
>>
>>2827142
Have you tried op-amps first? analog stuff is fun if you have an oscilloscope.
>>
>>2827415
Thanks for the advice anon. Basically I wanna make a multifx pedal so I'd want it to be able to do some fairly complex stuff like reverbs, IRs, synthesis, etc.
Also ideally I'd want it to be able to do long delays and live looping so I'd probably run into problems with ram. Is it a dumb idea to memory map a decent sized spi flash chip and use that as ram?
Would it make sense to store the compiled code for each effect on an external storage like an SD card then load each one into ram and execute when needed? Also would freeRTOS be the best choice? Baremetal scares me
>>2827471
Yeah I've done a couple of distortion pedals before, good fun
>>
File: 1-keyboard[1].jpg (46 KB, 700x700)
46 KB
46 KB JPG
okay anons I basically want achieve something even if its not worth it, just because.

I have a laptop keyboard, I bought a fpc connector adapter to headers, which were something I have been meaning ot buy and found a reason.

Okay, I am wanting to connect the 24 pin to esp32, right now I have a esp32 mini kit (mh-et live, esp32-wroom-32) I have library called blekeyboard and does work, but the problem I am running into is what library or what do I ned to keymap my keyboard? I was lucky enough actually that someone keymapped it for stm32F103, so I have keymap I just need to redo the pins. My first approach was to use keypad library since I can map keys there from two pins, but IDK whats row, and whats column based on the other users keymapping.
>>
>>2828147
>Is it a dumb idea to memory map a decent sized spi flash chip and use that as ram?
Yes. Better off just finding a RAM IC instead. Probably SRAM as it's much easier to use and you probably don't need particularly high speed, but DRAM is an option.
>Would it make sense to store the compiled code for each effect on an external storage like an SD card then load each one into ram and execute when needed?
MCUs with DMA can often run off instructions directly from external memory. No clue how that's not deathly slow since it's serial not parallel, but it works.
>RTOS
I'm not familiar with how they work so I couldn't tell you. Extra layers of abstraction could both hurt and help you. I'd probably try to do it bare metal for a singular effect or fixed architecture of effects. But if you need something to run varied effects architectures, bare metal will probably end up being significantly more time consuming.
>>
>>2828147
>memory map a decent sized spi flash chip and use that as ram?
I don't think any MCUs let you do memory mapped write accesses to flash (would be slow as shit anyway).
>Would it make sense to store the compiled code for each effect on an external storage like an SD card then load each one into ram and execute when needed?
That sounds really complex. Why would it be so much code that you need to do it? If your effect asm is so huge it won't be fast enough to execute either.
>RTOS
Just adds more complexity and won't magically solve your problems. It might be useful because it comes with a lot of shit preloaded, like drivers or being able to use it without lots of configuration if your platform is well supported.
>>
https://pastebin.com/QEKvZWD4
terrible code much?
>>
>>2828423
Is that a bottom half ISR?
>>
Whose fault is it that platformio writes a compile_commands.json with unnecessary flags that prevent clangd from loading it?
>>
I have been thinking to put an esp32 cam to record an abandoned house in middle of nowhere but I will have 2 major problems, how to properly power the microcontroller for some days and to send data to my pc... already accepted that probably some random people will find and break the cam
>>
>>2828434
>compile_commands.json
Just use a makefile.
>>
File: 1708189584264237.jpg (170 KB, 1920x1280)
170 KB
170 KB JPG
>>2828437
a 20Ah power bank lasts 3 days from my calculations

as for remote access, thats impossible without something external to facilitate it since it only works as a server, and you cant just expose it to the internet
it will boil down to you having to use something like a raspberry pi to tap into the stream and pipe it where you want it to go, but at that point you can just as well use a camera module for the pi and be done with it
>>
>>2828147
I've always used freeRTOS on microcontrollers.

A pattern (long/short/solid) of blinking lights
could indicate the state of the pedal or the interface,
and maybe it'll be a modal interface so you can reuse
a touch slider for n different parameters.

With freeRTOS the blink is one task with a vTaskDelay,
and you don't have to litter your DSP code with repeated
calls to a ui() function that checks the time and updates the
GPIO if needed. But maybe you know that the dsp() takes
<100ms because it's doing something to small buffers
filled/emptied by DMA, so a main loop { ui(); dsp() }
can probably do both tasks at the right time.
>>
>>2828453
>embedded devs need an entire thread to blink a LED
I'm dying.
>>
>>2828379
Very helpful thanks anon
>>2828407
>That sounds really complex. Why would it be so much code that you need to do it? If your effect asm is so huge it won't be fast enough to execute either.
Yeah fair point, not too sure how big the compiled code would be but I'd also like the option to store wav files for playback and maybe some granular synth stuff so I'd probably want an SD card or something similar anyway right?
>>2828407
>>2828453
Yeah I'm thinking an rtos would make things easier cause I want to have a fair few knobs and buttons and a screen to display info.
Would this make sense:
>one thread handling the audio code and running and switching the effects
>one thread for the display screen
>one thread monitoring knob/button inputs
Apologies for the noob questions
>>
I'm planning on making a self-driving mower for my property (it's big).
My plan is to train a neural net by recording myself on the mower with the following inputs:
>direction/compass
>accelerometer (speed)
>gyroscope (possibly - because I might want to detect inclines)
>camera
Does anyone know of any HATs that might provide direction, accelerometer and (optionally) gyroscope? GPS might be nice to have too so that I can ensure it stays within boundaries (but we have a natural long-grass boundary I'm hoping I can train it on).
For collecting training data, I was hoping to just use a battery powered ESP32 or something. Would these have enough processing juice to run a decent quality camera?
>>
>>2828771
Any reason to use a neural net instead of a simple hand-written algorithm, alongside something like ardupilot? Or is it to detect obstacles to avoid / things to mow, where adding these in manually would be too time consuming? Either way you'll almost certainly want a hard-coded way of tracking what's been mowed, and probably also a rough path of waypoints, and just use the neural net for telling the conventional navigation system when to make perturbations to its nominal path.

There's definitely openCV available for ESP32s, look into that.
>>
>>2828785
>Any reason to use a neural net instead of a simple hand-written algorithm, alongside something like ardupilot? Or is it to detect obstacles to avoid / things to mow, where adding these in manually would be too time consuming?
It's to detect obstacles. I'm on acreage, so the idea is to lock it in a given perimeter with GPS (later on) and just let it do its thing.
The outputs of the net would just be:
>direction
>velocity
>blades on/off (not sure how to collect this yet, but might just do a button while I'm mowing or something)
I feel like this should be pretty feasible to train if I get quality data from my own mowing.
Might make a good project for others in a similar situation too.
>>
>>2828785
>There's definitely openCV available for ESP32s, look into that.
Is that faster than fucking snail's pace?
>>
>>2828771
an accelerometer doesnt measure speed you drongo. it measures forces in x y z. what you need is an encoder or something to get the rpm of the wheels to infer the speed over ground. but a high precision gps receiver can do that for you, as well as give you direction/heading, presuming you got a satellite lock.
>>
my iron just came in
anything interesting to fuck around with? I was thinking about fixing my chinkshit headphones
>>
File: IMG_1681.jpg (1.84 MB, 1170x2050)
1.84 MB
1.84 MB JPG
>>2827375
Took out the 9v and everything fit pretty good inside the sensor. Beats printing a new case.
>>
>>2828862
good enough for facial detection, runs at maybe 5fps from images i've seen, which is probably fine for most uses

>>2828877
you can integrate the acceleration to find out your speed, combine that with gps data for correcting drift and you'll have a good enough estimation without ground measurement. ground measurement is definitely easier though, and the vibrations of driving about might cause much more drift in the inertial navigation than on a fixed-wing drone.

>>2828928
>fixing my chinkshit headphones
good luck, they often use awfully fine wire, sometimes it's enamel insulated, sometimes it even has strands of nylon or some shit alongside it for strength that prevents solder from beading up properly.
>>
>>2828877
>>2828995
Re: Acceleration
Yeah, I was planning on just adding/subtracting inertia for speed estimate, but...
>vibrations of driving about might cause much more drift in the inertial navigation than on a fixed-wing drone
That's a good point. I've ordered a cheap ~$10 GPS module and an I2C Magnetometer/Accelerometer, so I'll see how it goes.
But may need to adjust my plan.
>drongo
dont call me that when im not one
>>
>>2828877
>but a high precision gps receiver
Any recommendations for a module btw?
This might be easier than other approaches and I'd only need it for collecting training data.
>>
>>2828999
I think Andreas Speiss did a video recently about getting very high accuracy results from GPS modules.
>>
>>2827109
Should I be using a single "current time" variable that's constantly updated in the main loop for all of my timing if statements instead of just calling millis() in each of the conditions? This might be a dumb question, I don't know how much impact it actually has
>>
>>2829316
Just use a timer/counter running off the main clock with a sensible pre-divider, query that whenever you need to know how much time has elapsed. If it’s too small you can update another variable whenever the timer overflows, that should be minimal overhead, especially if you’re using a 16-bit timer.
>>
File: img-2024-07-27-03-47-47.png (583 KB, 1024x613)
583 KB
583 KB PNG
Can you use the PWM pin to control the speed of DC motor?
or is the voltage too low, and I need motor driver?
Not necessarily for RPi only.
>>
>>2829423
No. Use a MOSFET and a diode, or a dedicated motor driver.
>>
>>2828771
Cross-board replying to
>>>/g/101579054
.. because it's a dead thread.
>I'll ask you what I have started to ask myself. Do you really think you can out engineer, out program, out build, essentially outperform dedicated teams working full time on this issue? Not even commercial tractors are using MV+NNs yet.
I used to be like you once upon a time. But SLB changed my attitude completely.
Dreams are only dreams until realized. And realizing this dream only requires dedication (and an in-depth understanding of electronics, engineering, programming and machine learning).
If you want to be like me, get shit done and learn how to easily out-compete these big firms, I'd recommend watching this.
https://www.youtube.com/watch?v=MGb7S3I2DTY
>No offense, but even thinking about using an ESP32 for this kinda shows you are out of your depth. At minimum the device that will run the mower should also be used to capture any training data.
For data collection, I don't think it'll really matter. Tilt/Height/Angle of the camera will matter, but I want to experiment to see if I can train the network to either a) be relatively flexible about this or b) have these as an input parameter.
NN's have far more impressive feats under their belt than driving a mower. I suspect the corporate sector is worried about safety/risk/reliability - which is less of a concern for me. If I end up with a mower that goes rogue and draws dicks on the neighbor's pasture, so be it. With the increasing leaps in AI/ML, this is just something that we, as humans, have to learn to live with. We will not be able to compete with our lawn mower overlords.
>>
>>2829423
PWM yes, but not straight from the pin. Very easily overloaded. The frequency must also be high enough for maximum stability.
Even if you're using an absolutely tiny motor that won't overload the pin, you at least want a flyback diode unless you want to fry it. Inductive loads like motors create voltage spikes.
>>
>>2829492
>PWM
Not him, but wouldn't that only be a control signal used to control a circuit in the motor itself?
>>
>>2829492
Flyback diode not needed, a PWM output pin on an MCU will pull and push current, so it will eat up any inductive spike just fine without blocking current. Same reason you don’t need one when using a half bridge or H bridge.
>>
>>2829500
>wouldn't that only be a control signal used to control a circuit

PC fans have PWM inputs, regular motors dont

>>2829510
>it will eat up any inductive spike just fine

inductive spikes occur when you shut off power to a coil
often generating -40V or similar
very few chips or transistors can survive that
>>
>>2829448
Even for low voltage stuff like 3.3V small vibrator?
Also wouldn't a MOSFET effect the PWM signal?
I'm trying to make haptic feed back thing, the closure you're the faster it vibrate.
What's wrong with pic?
>>2829492
Well, same question.
Small vibrator motor does that kind of spike?
Flyback diode?
>>
>>2829448
So like this?
>>
>>2829627
Ignore this
So like pic related?
>>
>>2829640
>So like pic related?

a cr2032 is limited to 20mA or so, so is probably 10x too weak to drive a motor
why the resistor in series with motor? just to waste power?
you wired the diode correctly so you're not 100% retarded
congratulations
>>
>>2829652
>why the resistor in series with motor
Ah, force of habit, I was testing with LED and forgot it.
Ideally I'd be using this small coin motor, but it's operating voltage is very narrow.
So I though would build my own vibrator from dc motor.



[Advertise on 4chan]

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

[Enable Mobile View / Use Mobile Site]

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