[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself


View post   

File: 12 KB, 377x225, MF BOOB.jpg [View same] [iqdb] [saucenao] [google]
2571738 No.2571738 [Reply] [Original]

Previous thread:>>2557052

Here we discuss microcontrollers, SBCs and microcontroller 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 or mouser'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

>> No.2572458

fuck me, mcg is slow this time. lets get the ball rolling. what are you all working on? either for work or at home for keks.

im currently trying to use a low res lidar to map out a surface and provide feedback to a PLC.
>hard mode
the PLC doesnt have a serial IO. guess im bit banging custom serial comms as well

>> No.2572459

Is there a way to add a wifi antenna to the esp32 that doesn't have the antenna connection?

>> No.2572504

>>2571336
Do you think this code is too complex, or too simple?

>> No.2572507

>>2572504
Its not the easiest to understand just because they've tried to do a lot in an example which should have really just demonstrated how to do basic SPI TX and RX

>> No.2572630

>>2572458
I'm putting a mpu6050 and hmc5883 on a pen for either handwriting recognition or just recording. It's been done many times but never good enough: https://www.mdpi.com/1424-8220/22/20/7840 has a review. I had lots of trouble with esp32s2 CONFIG_ESP_CONSOLE_USB_CDC took a while to find and the output starts later and ends sooner than the way other dev boards do it. I just switched to esp32c3 which works much better. I get backtraces now and wifi can connect and I only had to change a couple things in the build system. I'm hoping to make making my training set convenient enough that I'll actually do it.

>> No.2572631 [DELETED] 

>>2571738
https://youtu.be/HzKmtm2MI64

>> No.2572670

>>2572504
>>2572507

This is hilarious because I've been doing AVR SPI in pure assembly for years and i always seemed totally simple. Set a few things like CPHA and CPOL once, then the master simply sends bytes. if the slave doesn't reply then the master's byte is returned.

out spdr, r26 ; this goes out

loop:

sbis spsr, spif ; wait for it to complete

rjmp loop

in r27, spsr ; clear the flag
in r27, spdr ; read the return byte

>> No.2572678

Total noob here. I killed an arduino by connecting the vin pin to a motorcycle's electrical system, and the usb to my laptop at the same time.
Was the culprit here the fact that the motorcycle runs at higher than 12v (like 13.5 I think)? Or was it connecting the usb and the vin pin at the same time?
I guess my question is: after I replace the arduino, can I use the 13.5v supply as long as I don't connect the usb at the same time?

>> No.2572680

>>2572670
>port I/O
DMA exists for a reason.

>> No.2572690

>>2572678
arduino can handle power coming in Vin at the same time as USB is connected; it has diodes to use only one source. Maybe your voltage was too high. I think the spec is 9-12 but I could be wrong, and even so, it doesn't magically die at 12.01 volts.

Do you have to connect bike power? ground is all you should need for data, GPIO, whatever

>> No.2572701

>>2572690
Eventually it will need to run only off bike power. I guess I'll throw a voltage regulator on the vin pin to be safe.

>> No.2572709

>>2572680
not on an AVR it doesn't

>>2572678
>>2572690
The Uno has an LM358 acting as a comparator to switch a P-channel MOSFET to allow/disallow USBVCC from entering the MCU. The condition is if [(Vin - 0.6V)/2 > 3.3V].
On the Nano, Vin goes directly to the regulator (no diode) and just uses a schottky diode between USBVCC and 5V.

I can't see anything wrong with either implementations, the leakage current through the schottky diode shouldn't be enough to do anything strange. The only situation I can see where you'd have trouble is if you were using a USBasp for programming, as that bypasses the schottky diode, and the only protection on a standard USBasp is the manual jumper to say whether VCC is connected to the header at all.
I was thinking that if the USB power from the 5V regulator were slightly higher, it could backfeed into the laptop and draw more current than it can handle, and destroy the regulator, but that doesn't seem possible.

That said, the maximum voltage of an AMS1117 is 15V, and if you fed it a battery with an alternator and spark plugs and stuff on it I can see it maybe spiking above that. The presence of spark-plugs could also be an issue just for radiated noise, it's possible that you had issues by the laptop itself acting as a bigger antenna. I'd try again with proper grounding and shielding, and chokes clamped on any ingoing and outgoing wires. Like CNC plasma cutter precautions, but less extreme.

Consider an optical USB isolator, I think they exist.

>> No.2572710

>>2572709
>AVR
Low performance. SPI master controls how fast it goes, port I/O is completely reasonable, but may lead to disappointment for something that really needs to be fast, like displays.

>> No.2572802

>>2572709
AVR XMEGAs have DMA.

>> No.2572837

I have successfully made my own pcb/device using an Atmega328p programmed via icsp using an Arduino. Now I want to ditch the Arduino IDE entirely, and program other Atmega flavored mcps via icsp. Whats my software and toolchain?

>> No.2572893

>>2572802
I've never seen anyone use an Xmega. For the cost you'd be better off with a SAMD.

>>2572837
Either AVR-GCC + AVRdude + your text editor of choice, or VScode + platformio. I think you could use GNU debug with either, but I've never delved down that rabbit-hole.
If you want to use the more modern AVRs (e.g. mega4808, tiny1614) you'll need to make yourself a simple serialUPDI programmer.

It's also an option to use Atmel Studio or MPLabX, but for those you're basically forced into buying Microchip's official programmers like PicKits or the Atmel Ice, or something compatible by a 3rd party like BlackMagicProbe. IIRC all the official ones are out of stock. I think the shitty PicKit 3 or 3.5 clones from alibay will do AVR-ICSP, but for UPDI you'll need an ICE. This is all from >1 year old memory, expect mistakes.

>> No.2572974
File: 29 KB, 1282x504, crystal.png [View same] [iqdb] [saucenao] [google]
2572974

When specifying a crystal for an MCU how do I choose the right capacitors?
https://www.mouser.co.uk/ProductDetail/Diodes-Incorporated/FY0800057Q?qs=gZXFycFWdAM05C0ssV6MDQ%3D%3D
This crystal has an ESR of 80ohms and a load capacitance of 20pf.
Am I right in saying that I have 2 shunt capacitors either side of the crystal and they are to be a maximum of (35pf - 20pf /2) = 7.5pf each.
If I got 5pf capacitors would that be correct?

>> No.2572983

>>2572974
Cx = 2(C_load - C_stray)
for noobs making pcbs themselves c stray is usually pretty high something like 6-8pF. c_load is the "load capacitance" stipulated on the crystals datasheet. Cx is the cap you want to buy and place on each side of the crystal

>> No.2572986

>>2572983
I see, c stray is little to do which the crystal itself but with nearby things on the board.

Cx = 2(20pF-7) = 13pF
I'll go with 2 13pF capacitors

>> No.2572988

>>2572986
26pF capacitors I mean

>> No.2572993

>>2572988
c stray is more about the capacitance caused by intersecting traces and planes on the pcb, its a series capacitance with the caps on the crystal, so you need to offet that by using bigger crystal caps

>> No.2573007

>>2572670
That's the thing, I'd rather bit bang the SPI using a bunch of simple functions than use their complex bullshit (unlesss I needed DMA or other features)

>> No.2573017

>>2573007
>complex bullshit
The code literally uses 2 SPI functions. I looked at the driver, you can even get by using only 1 blocking SPI function. All the rest in the example file is about setting up the LCD, which doesn't get easier with bit banging.

>> No.2573041

Why the attiny85 costs the same as an atmel328? Doesnt make any sense

>> No.2573138
File: 110 KB, 499x500, 14776782_6[1].jpg [View same] [iqdb] [saucenao] [google]
2573138

Im thinking of making a digital chessboard that works like these laser keyboards, and Im wondering what the best solution for detecting finger position is. First idea was two ultrasonic rangefinders but their FOV is too low. The commercial products seem to all use an IR camera and a horizontal IR laser beam, but do you think I could get away with the same laser and just two cheap IR sensors to measure time of flight? I only need to measure one tap at a time as opposed to multiple key presses.

>> No.2573184
File: 228 KB, 1080x1301, VL53L0X.jpg [View same] [iqdb] [saucenao] [google]
2573184

>>2573138
1/2: measurements are ±25mm at 700mm distance to cover a 30cm diagonal board. Each square has 30mm sides. So it might work with two sensors if the baseline "b" is big and you can smooth the noise. Maybe there's a sensor with bigger fov or use 3 or 4 VL53L0X.

>> No.2573187
File: 136 KB, 877x1206, Screenshot_20230302-134812.jpg [View same] [iqdb] [saucenao] [google]
2573187

>>2573184
2/2

>> No.2573205

>>2573184
Those might work. Looks like they're more accurate than the sound sensors near the edge of their FOV too. I think if I tilt them in a bit I could compromise and have a 25cm board a half meter away from the projector while keeping the box only slightly larger than a regular chess clock.

>> No.2573208

>>2573138
How are you gonna track pie es that get obscured?

You need them on a glass table and have your sensor looking up at it

>> No.2573216

>>2573208
No pieces, just a projector in the unit. Gonna try making a rudimentary raster display with some mirrors, a laser pointer and my pile of junk electronics, and if that works okay Ill add two more lasers. If that doesn't work Ill just give up, buy a tiny projector unit from digikey and use a Pi + OpenCV for tracking.

>> No.2573312

So how to program two different MCUs on one pcb? Do you really put two USB connectors and two USB to serial converters? What if there's more MCUs?

>> No.2573318

>>2573312
>USB
That's the arduweenie way to program MCUs.
You use one connector for each debug interface, such as JTAG or SWD, preferably with some kind of pogo-pin and alignment holes connector. Even better, just use test point pads to program it during a bed-of-nails test.

>> No.2573321

>>2573318
>bed-of-nails
Huh? I googled it ans I'm pretty sure it's not what you meant.
Can you recommend one good and cheap way of doing it for a noob to stick to?

>> No.2573326

>>2573312
>USB to serial converters
Obviously you can skip this step by using serial directly. Using a proper debug interface is probably better.

>> No.2573328

>>2573312
>>2573326
Actually, just use one of the MCUs to program the other MCUs and have only one flash chip. Maybe that's less of a mess.

>> No.2573333
File: 34 KB, 495x271, custom-test-fixture-bed-nails-test[1].jpg [View same] [iqdb] [saucenao] [google]
2573333

>>2573321
>Huh? I googled it ans I'm pretty sure it's not what you meant.

If you got something like pic related, yes, that's what he meant. Obviously, not practical if you aren't doing volume production, but that's the normal way to do it if you don't have the manufacturer/distributor bulk program the chips before assembly.

For small scale stuff, either just use a dedicated programming connector for each chip and do them one by one. You can skip soldering a header and just use test pads and pogo pins if you don't need to leave the programmer connected for debugging.

>> No.2573339

>>2573333
How are these pogo pins holders called? Like obviously you don't hold 6 rolling pins in between your fingers, right?

>> No.2573350
File: 19 KB, 640x640, MFG_5433[1].jpg [View same] [iqdb] [saucenao] [google]
2573350

>>2573339

Not sure there's any encompassing name for all of them. There's different styles if you can't be arsed to make your own. Clip styles are convenient if you can put the pads on the edge of the board. Otherwise, you'd use one that just has the pins pointed straight out, and hold it down while it's programming. Some of this type also have little clips to grab onto holes on the board.

Use your imagination. Like I said, rolling your own is pretty common. Bare pogo pins are readily available and very cheap.

>> No.2573556

I need help programming an FM4-216-Ethernet development board. I can't get an IDE to work for it, I have no working example code, and I am trying to use the TFT display can't find it's TFT library.
I would appreciate any anon's support in helping me
>t. uni Computer Engineer student with a group full of EEs for capstone project where our sponsor chose a shitty board.

>> No.2573624

>>2573556
Reading the datasheets for the parts included on the board should do the trick, unless those parts are also chinky.
>library
Write your own, you're CS aren't you?

>> No.2573673

>>2571738
Im not so sure this is /mcg/ related but I cant see where else it should go.

Does anyone have experience with PLC's and using TIA to programme them? I'm trying to write an ultra basic programme that utilises the clockrate but I'm getting nothing from the system when I upload the programme.

The ladder programme is litereally just

---] [ --- [1hz] --- ( )
when I remove the clock it works perfectly, the wiring is correct, and the clock is correctly mapped. there was origianlly a second tag that shared the same name with the clock but it has been removed. the analysis shows the signal reaching the switch and then just stopping. The clock is enabled in the PLC settings tab.

>> No.2573685

PLC programming is completely different.
Maybe you could start a PLC/Ladder Programming general?

>> No.2573739

>>2573685
yeah, doesnt fit ohm or mcg, but a guy on ohm suggested here. Probably not enough interest for PLCs

>> No.2574238
File: 3.60 MB, 1725x1122, reset pinout doodle - Copy.png [View same] [iqdb] [saucenao] [google]
2574238

I've little experience with microcontrollers so bear with me please.
I'm working on rebuilding some ebike batteries and there's a problem.
The behavior is as such: it boots, runs, does what it's supposed to except after a few hours (2~3) it reboots and wipes all settings. This means I can pair it to my bike, but not keep it paired.
I've tried 3 different ones and they all exhibit the same behavior, so I've ruled out a burnt capacitor or some such. I've also double triple checked everything else, and found another person posting with the same problem. I'm rather certain it's an intentional software feature.

There is an texas instruments general purpose BMS (https://www.ti.com/product/BQ77PL900)) and an atmega324P acting as host chip present.
I'm hoping/thinking that connecting power to both at the same time is doing something the atmega doesn't like. I want to hit reset on the atmega whilst the TI chip continues to run to test.

The spec sheet says to send a low level pulse to pin 4, but I'm not entirely sure what this means or what this does, or where it is.
So first question: this reset pin effectively reboots the chip, correct? IE it does not wipe the code that's stored in its memory, just shut off/start again.
Second question: what exactly is a low level pulse? The sheet says minimum duration 2.5nano seconds. But nothing about defining a low level pulse. I would speculate this means bridging it to ground for more than 2.5ns but would like to be sure.
Lastly the PCB is caked in epoxy to waterproof it. I've found pictures of an unwaterproofed version online and have attempted to trace which pin on the connector is the reset, but am not entirely confident. If someone can tell with more certainty I'd be grateful.
Picture is what I got. The left is where I've been doodling and think it might be, the right is unedited. Sadly the picture is not clear enough to see the #1 dot indicator.

>> No.2574251

>>2574238
1. yes. it restarts it from the boot address in flash memory
2. yes. all you need to do is pull it low for a period of time. often a reset is tied to a physical push button. so the "low pulse" is like 1 second. it really doesnt matter. id recommend anything above 1ms though.
3. id say yellow. looks like its going past a cap and a resistor. a pull up resistor and a capacitor to suppress emi to stop it being accidentally reset.

as a fyi on 2. the reset pin is held to GND while the device is being reprogrammed. this could take multiple seconds. so dont get hung up on trying to make the pulse short

>> No.2574259

>>2574251
Thanks bro, appreciate it.
Was hoping it was going to be one of the orange ones because that part is accessible. The 5 pads near the yellow are under the black epoxy coating, which is going to take some doing to get to.
Here's hoping this works cuz otherwise I might be needing propietary software lol.

>> No.2574272

>>2574251
>>2574259
Yup, carefully ground away material with a dremel to uncover it and shorted it.
The battery displays the same bootup animation it does normally. Now I have to wait for 2~3h to confirm it doesn't re-reset.
Not massively hopeful but it's the last thing I can currently do.
Thanks again mate.

>> No.2574275

>>2574238
Actually one more question just to be entirely sure: I looked up if it were possible to read out the code on the chip somehow. Answer I found was that it's technically possible to read out if they didn't flip a security bit, but only machine level code which is functionally useless unless I wanted to transplant that exact same code onto another atmega324p.
That's correct yes?

>> No.2574277

>>2574238
>send a low level pulse
Some basic electronics knowledge is expected when dealing with microcontrollers, more than just watching a couple of YouTube videos.
>caked in epoxy
If that picture is what you have, it's called "conformal coating".
"Caked in epoxy" would be black shit poured all around it to where you couldn't see anything.
If you don't know where pin 1 is, get a data sheet for the chip and try to trace out out what connects to pins until you can find enough to verify which way around is which. Those five holes at the lower left look like they're for programming the chip.

>> No.2574278

>>2574272
>dremel
That would be a good way to fuck it up real good real quick. An emery board would be a better idea. And iit's best to expose the copper of a trace connected to the pin, not the chip itself.

>> No.2574281

whatever you do, don't try to draw a dollar sign on a 5 x 5 matrix

>> No.2574288

>>2574277
>>2574278
Keep on gatekeeping whilst not reading properly my man. You didn't even read the part where I mentioned my PCB to be caked (exactly as you describe) and the picture being from an identical part I found online.
I did virtually everything you described and arrived at solid answers, I just wanted confirmation which a kind anon was able to provide before you even entered the scene.
Dremel went just fine btw. Steady hand some patience good lighting and isopropyl get a lot done.

>> No.2574324
File: 1 KB, 640x400, doller.png [View same] [iqdb] [saucenao] [google]
2574324

>>2574281

>> No.2574354
File: 63 KB, 499x525, Screenshot_20230304_111019_Edge.jpg [View same] [iqdb] [saucenao] [google]
2574354

>>2574324
Stonks

>> No.2574370
File: 110 KB, 596x705, hall-sensors.jpg [View same] [iqdb] [saucenao] [google]
2574370

>buy linear hall-effect sensor
>https://www.amazon.co.uk/dp/B07ZZCWLY2?psc=1&ref=ppx_yo2ov_dt_b_product_details
>plug it in like pic related
>only get digital output through analog
>copy the code they have in the manual
>try a few different magnets
>it still only gives high or low
I don't understand what I'm doing wrong.

>> No.2574412
File: 2.95 MB, 720x1280, ASCII 33 34 35.webm [View same] [iqdb] [saucenao] [google]
2574412

>>2574324
Somehow this looks less controversial than my version.

>> No.2574414

>>2574370
Try really fucking weak magnets. Hall effect sensors are super sensitive.
Grab a non magnetized screwdriver and hold it against a rare earth to magnetize it a tiny bit, should be enough to be picked up

>> No.2574415

>>2574370
Some people on Amazon are complaining they got boards with a digital sensor installed instead of an analog one. Check the sensor itself (3-pin bjt looking guy) and make sure the model # is indeed KY-024 as opposed to 3144 HES or something else.

>> No.2574419

>>2574415
you may need a magnifying glass or your phone's zoom.

>> No.2574441
File: 49 KB, 566x537, 3144.jpg [View same] [iqdb] [saucenao] [google]
2574441

>>2574415
>as opposed to 3144 HES
RREEEEEEEEEEEE I swear to FUCKING CHRIST this is the 3rd time I've tried to order linear hall effect sensors and gotten a fucking digital switch instead!

Maybe this hobby isn't for me.

>> No.2574475

>>2574415
>>2574441
This is the stupidest thing I ever done saw.

>> No.2574483

>>2574441
Yet you will give Amazon more of your money. Deserved experience, I guess.

>> No.2574487

>>2574441
Amazon is a bad place to buy components and stuff.

Mouser and digikey have some modules like this but mostly individual stuff. The best place is probably unironically adafruit

>> No.2574509

>>2574238
Reset will wipe code in RAM, but not flash or EEPROM. Ideally the user settings will be stored in EEPROM, but if that isn't happening before it resets then yeah you could lose all your user settings. I'd try to connect an AVRisp to it and read off the EEPROM in AVRdude. You can also program any old arduino with the "arduino as ISP" code and use it instead of an AVRisp, just note that a nano needs to have a big capacitor tied from its reset pin to ground so it doesn't reset itself.
They could also be storing code in flash since I think AVRs can self-modify progmem, but that would be silly.

The dot looks bottom left (yellow) to me. Following the other traces going to that unpopulated 5-pin header, it looks like an ICSP header sans Vcc. Pins 1, 2, 3, 4 are MOSI, MISO, SCK, RESET.
So the header would be:
>RESET [unknown] SCK MOSI(?) MISO
I'd hope that the unknown is actually connected to ground, because then it would just be a matter of powering up the board normally and connecting some programming wires, it's probably the same header it was programmed via in the factory.

If the board is getting reset via noise on the reset line, then placing a capacitor from it to ground should prevent that, just as you'd do with an AVR as ISP. If it is an intended signal, then you'll have to dig into the documentations or whatever to figure out why it's doing that, if not just replace the firmware with someone else's. Another possible reason for resetting may be brownout detection, it may be there's a problem upstream with the step-down converter, maybe it's overheating after being run for 3 hours.

>>2574441
>chinks putting digital hall switch on board with LM393 comparator and threshold-varying trimpot
lmao chink'd

>> No.2574515

>>2574509
>lmao chink'd
Their website is in german.

>> No.2574518

>>2574515
They're just reselling chink shit.

>> No.2574519

>>2574515
they're just an aliexpress dropshipper, doesn't matter what language they speak

>> No.2574584

>>2574275
yeah most chips that arent 8 bit atmegas have a security fuse set. to unlock it you have to do a full chip erase, which will delete the program off the chip. if you do end up reading the code out its usually machine code or assembly instructions so you would have to figure that out. also youd be even more shit out of luck if they have the program in encryped flash. even if you get the code off the chip, it requires some key to decrypt it

>> No.2574615

Why would you buy any other microcontroller instead ESP32? It's cheap, is in stock, very fast, reliable, easy to code. There's literally no need to buy any arduino like boards, or stm32 up to F7 etc.

>> No.2574617

>>2574441
are you the same idiot who wont just get the parts from an authorised distributor? you deserve to get chinked. for the amount of money youve spent getting chinked you could have just got something from digikey for cheaper

>> No.2574622

>>2574615
bloat. if you dont need wifi or bluetooth theres literally no point. also, external flash for progmem is a security risk

>> No.2574632

>>2574441
now get some magnets and 3dprint some key mechs to make a sweet streaming keypad

>> No.2574640

>>2574622
>if you dont need wifi or bluetooth theres literally no point.
I don't need wifi or bluetooth but I need the fastest MCU for little money. What are my alternatives that can drive camera in the forest and are not ESP32?

>> No.2574644

>>2574615
Obviously they all have different performance characteristics, peripherals, architecture...

>> No.2574662
File: 568 KB, 626x492, tom scott when the kush hits content aware.png [View same] [iqdb] [saucenao] [google]
2574662

>>2574615

Yeah, man, an ESP will work great for my robotics projects. Using optical encoders is great with the built-in quadrature decoder that the ESP32 definitely has. And the programmable analog fabric really comes in handy for glue logic here and there...

>> No.2574672

>>2574615
If you don't use the radios, 50% of the cost is wasted, and it lacks other features (like DMA IIRC) instead

>> No.2574674

>>2574640
$5: RP2040 (pi pico) or any other riscv devboard
$15: Orange pi zero 2

>> No.2574689

>>2574275
I don't think it's that difficult to transcribe machine code into assembly language, which is human readable. Decompiling that into C isn't going to be that easy though. Who knows if they set the lock fuse, I'd guess they didn't since firmware updates may be a required thing for an authorised service person to perform. The ATmega324 is unable to enter into a mode where new firmware can be flashed but the existing firmware cannot be read. Just both, neither, or read-only.

>>2574672
I'm pretty sure it does have DMA.

>> No.2574699

>>2574640
most stm32f4xx have a hardware 54mbps camera fifo interface which can drive way more cams than a shitty 5 fps eps32 camera at 480p

>> No.2574701

>>2574689
you can still upgrade firmware with a lock fuse set. you just have to do a full chip erase and reset the fuse bits

>> No.2574783

>>2574674
> $5: RP2040 (pi pico)
Literally 1 FPS https://youtu.be/qLee7ThjOp4?t=405

> $15: Orange pi zero 2
40€, almost ten times the price of ESP32

>>2574699
>stm32f4xx
Resolution, quality and FPS are all worse than ESP32
https://youtu.be/hB0nYhx88OI?t=114

You should open the specs of ESP32 before you talk. It has 240HZ core speed, much faster than any alternatives hence better framerate. That's the best performance for the price hands down.

>> No.2574788

>>2574783
i know the specs of the esp32. but the framework is bloated as fuck. it gets changed so fucking often and every second day theres a new board/chip/version available. 240mhz isnt that fast anyway. the point you make about them being so cheap im on the fence about. i dont know if these guys have their own silicon fab or something, so im waiting to see what happens when stock runs out. im my experience, despite the 240mhz, they still shite. esp32 fags are the new age tarduinos, change my mind. pro tip, you cant

>> No.2574829

Is there an Arduino guide for experienced programmers?
I'm not looking for a guide which explains what a pointer is, but rather a guide which, for example, tells me to avoid using heap since heap fragmentation is a thing.

>> No.2574903

Fastled stopped working properly after I included the esp8266 webserver library.
When executing the exact same code, sometimes fastled updates the leds and sometimes it does absolutely nothing.
I managed to "solve" this by executing every led update 10 times.
Any idea why it only works sometimes?

>> No.2574961
File: 102 KB, 300x270, real-money.png [View same] [iqdb] [saucenao] [google]
2574961

>>2574783
40€
Sucks for euro shithole money, because in USA it's picrel. Keep in mind that includes USB host and RJ45 too.

>>2574783
>framerate
this is a microcontroller thread. The chips are used to blink LEDs, read sensors, and (maybe) do basic transactions over the internet.
if you wanted something for 3d, you'd get an iGPU/APU or a microPROCESSOR.
you might be looking for >>g/pcbg/

>> No.2574969

>>2574829
Sounds like what you're looking for isn't limited to Arduino and could be found in a Data Structures and Algorithms reference or text.

>> No.2574971

>>2574903
>Any idea why it only works sometimes?
RTOS

>> No.2574973

>>2574961
it also has native HDMI the port is just miniature

>> No.2575003

>>2574829
> no heap
Don’t use new(), malloc(), calloc(), etc.
alloca() will do the same thing, but use stack. Good stuff for pros only.
Also don’t use libraries that use the heap. You can redefine malloc to find these fuckers.
Allocate your storage directly after your function definition using PODs and that will usually use the stack.
If you need a large chunk of heap, just allocate it once at the beginning, and re-use it as necessary.

>> No.2575020

>>2574961
> let’s talk about microcontrollers
Thanks, a lot of the discussions are about SoCs which are more powerful than entire desktops in the 80s and 90s.

>>2574672
I’ve thought a lot about why the esps are so cheap, and i’m pretty sure it’s because they can do bluetooth and wifi easily and el-cheapo carrier boards don’t need things like expensive ethernet connectors.

Without good USB, PoE, RS232/422/485 support, and the fact that it’s all chinese sourced makes me want to avoid it’s weird architecture. There is just no point, unless you’re bored and want to play around with a cute little gadget.

>> No.2575075

>>2575020
> SoCs which are more powerful than entire desktops in the 80s and 90s.
They're still not used for gayming though, so why bring up le fps. Why jump straight to graphic, that's not a 'controller' thing at all. Ex; quadrature decoders and GPIO DMA and capacitive button sensing are controller things, floating point sma and igpu are not.

>> No.2575503

>>2575075
Atomic Pi SBC, repurposed x86 robot brains.
Runs Fallout 3 at 1024x600 medium settings 60FPS smoooooth

>> No.2575583

Ok I got solid advice once before. Can't find any info on this issue anywhere.

Have a esp32 board plugged into USB slot on front of pc.

Write a program to list sensor data. It writes with no error. Open the serial monitor. There's the expected data. Try something diff. Write with 0 errors. No data in serial monitor. Ok Write old working sketch, no data coming back. Try like a bunch of other crap and eventually Write that old working one for the 5th time. Suddenly it's working again.

Basically randomly my esp32 does not work and then suddenly it does. It's so hard to troubleshoot when I ad d more sensors cuz I can't tell if issue or if the writes are fucked up.

Is there something that could cause a working sketch not to work even if 0 wiring changes occur? Does my pc not deliver decent power over USB? It's killing me

>> No.2575586

>>2575583
Are you power cycling, resetting, or disconnecting then reconnecting the ESP32?
If not, then do.
Make sure it spits errors over serial in case you catch blips.

>> No.2575616

>>2575586
I will try that but sometimes I write to it. Unplug and plug back in and still nothing. I've even tried a diff esp32 and it almost makes me think my pc is underpowering it. When I had a small lcd screen it would flicker and go dim as if it wad struggling when the breadboard wiggled but hard to say if just weak connections or what

>> No.2575653
File: 38 KB, 608x255, ss.jpg [View same] [iqdb] [saucenao] [google]
2575653

How does one actually do this? My iron is bigger than the thing

>> No.2575656

>>2575653
>How does one actually do this?
A really small tip to your soldering iron, some x5 magnification, a steady hand, breath control and luck.

>> No.2575664

>>2575656
kek
>magnification
what, are youe eyes painted on?
>luck
what kind of dumb advice is that soldering has nothing to do with luck
>>2575653
3mm knife edge tip and precision tweezers is all i use for most SMD parts down to and including 0402. maybe a bit of extra flux if im feeling frisky

>> No.2575678
File: 349 KB, 1000x1000, emz-8tr-s4100_img1_3_3_2.png [View same] [iqdb] [saucenao] [google]
2575678

>>2575664
>he doesn't have a microscope for SMT rework

>> No.2575686

>>2575664
>>2575656
>have to buy new tips
Fucking shit now i need to wait 3 weeks for some tips to arrive from china

>> No.2575705
File: 20 KB, 533x446, sss.jpg [View same] [iqdb] [saucenao] [google]
2575705

Just bought an esp cam, i got this black mark, does it have a solution or can i get a refund from this?

>> No.2575721

>>2575503
Atomic pi is very high end.
We should be able to make a x86 “ibm pc” with vga, 640kb, serial, parallel, two ps2, and floppy/ide, and maybe isa and usb for around $1 nowadays.
There is a metric fuckton of software for something like that. Most cnc machines ran similar.
Of course, if running DOS, someone would have to write the usb driver but….

>> No.2575725

>>2575656
> breath control
I played this video game where, when sniping, you could take this drug to stop shaking. I forget what it’s called, but maybe you need that stuff.

>> No.2575729

>>2575664
>what, are youe eyes painted on?
Old age a-gonna get you too, kid.

>> No.2575743

>>2575686
Or you could get your sorry ass out of the house and to a store and have them the same day.

>> No.2575752

>>2574615
>not buying bulk ATTiny and a programmer
ngmi
Seriously, most of the time I2C, SPI and the odd digital here and there is all you need.

>> No.2575753

>>2575743
And pay triple the price for the exact same stuff, no thanks.

>> No.2575756

>>2575753
>exact same stuff
Protip - it isn't. But more importantly - how much is it worth to you to get your project done now vs in 1-3 months?

>> No.2575801

>>2572458
Barely related, I’m writing an Inkscape shell script for KiCAD SVG outputs, to produce G-code for my 3D printer turned-laser/drill.

Also month 2.5 of procrastinating my AVR reflow plate firmware. Because a chinky AMS1117 died and killed my AVR and MAX6675 module, and I’m afraid to risk my remaining module, even after swapping to a deadbug 7805.

And year 3 of trying to make an LCSC shopping list I’m happy with. No good ADCs available, pull the plug.

>>2575653
I did this to a wifi extender a few weeks ago, but had the benefit of the U.FL connector not being soldered on yet. I just put my T12-K tip, covered in solder, next to both pads of the passive until it came off with gentle pressure. I tapped the part off my iron against the table, cleaned up the pads, and used a D-12 tip and a flux pen to solder it pad-by-pad like you normally would. Surprised about how easy it was. Conical tips are ass for fine work though.

>> No.2575843

>>2575801
> no ADCs that I like
Instead of waiting around for the magic kingdom to make something that tickles your fancy, just build an ADC yourself like we used to with your TL331s.
Then you get exactly what you want. Just DO IT.
You should have everything already in your parts bin, next to the 358s, which you could also use.

>> No.2575857

>>2575678
>cant see 30cm in front of him
kek is everyone on this board living in a nursing home?

>> No.2575861

>>2575686
why didnt you get a multipack of various types of tips when you got your iron?

>> No.2575913

>>2575843
I need at least 1MS/s, for three channels. Instead I'll just get some local ones like these:
>https://www.farnell.com/datasheets/3005716.pdf
And use one for each channel. Feels kinda stupid but they're like $4 each so it's less expensive and more compact than anything else I can think of. Haven't fully read the datasheet, I hope those will work.

>> No.2575997

>>2575857
Try soldering a 0.5mm pitch QFP by eye and being certain there's no bridging

>> No.2576015

>>2575997
easy m8. slap on a bit of gel flux and use a K tip

>> No.2576046

How much can the pi zero w handle? Could I set it up to play video files and output audio?

>> No.2576120

>>2576046
>play video and audio

yes, at 1080p or lower.

>> No.2576170

Could I replace the oscillator cristal for a PIC16F887 with a square wave coming from a function generator?

The package of crystals I ordered is stuck in transit, and I really need to start working on this project.

If I use a 1kohm resistor in series and a low voltage (~0.01v) with an 8mhz square wave, do I have a chance of getting something usable? Or will I let out the magic blue wizard smoke?

>> No.2576179
File: 124 KB, 1031x552, Screenshot_2023-03-07_11-32-30.png [View same] [iqdb] [saucenao] [google]
2576179

>>2576170
https://ww1.microchip.com/downloads/en/DeviceDoc/31002a.pdf

that pdf also shows how to use a resistor and capacitor.

>> No.2576184
File: 49 KB, 1128x300, Screenshot_2023-03-07_11-36-55.png [View same] [iqdb] [saucenao] [google]
2576184

>>2576179

this seems to say you can use a normal digital signal

https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/39582C.pdf

>> No.2576293

im a complete noob when it comes to sbcs, where the fuck do i start?
im fairly experienced with various mcus (attiny, arduino, stm32), i finished plenty of projects with them, programming them myself. i have some experience with ubuntu and cli.
i find myself needing some more advanced hmi for some upcoming projects. i want to use something like a 10inch touchscreen, and mcus are too weak for something like that. thats why i started looking into sbcs.
i cant find raspberries anywhere for reasonable price (only €200+ for kits, fuck that). im looking into orange pi 3 lts on aliexpress.
Is it a decent starting point for someone like me? its a bit difficult to tell whats the difference between the 20 different orange pi variations. how difficult it is to program compared to arduino?

>> No.2576322

>>2576293
>how difficult it is to program compared to arduino?
totally different. If you know linux it will be easy. You install the OS, then it's an actual computer. You can use USB keyboard, mouse, and monitor and it's same as any desktop (sorta), or you can SSH in from another computer and it's almost as trivial.

>> No.2576325
File: 90 KB, 795x743, 3C300EA7-913F-4AA5-A6F8-2B51DBD22279.jpg [View same] [iqdb] [saucenao] [google]
2576325

>>2575913
> 1Ms/s × 3
If i make respectfully make a suggestion here: that is a lot of compute power.

I have noticed a trend, where people are implementing digital filters using, say, FFTs over huge swaths of RAM and tons of compute requiring cortex M7 class cpus.

If you’re doing something like that, please consider making an analog filter with an op amp or two, and maybe an inductor, capacitor or resistor. It’s going to be billions of times more efficient. Literally billions.

>> No.2576328

>>2576322
so is it a good idea to start with orange pi 3 lts? like i said, i cant find rpi anywhere for a decent price.
i also have some robotics projects on a backburner (i have a 6dof arm, mechanical and electrical side basically done, "only" the actual control and ik left). as far as i understand, something like orange pi 3 lts should be able to run an ik engine?

>> No.2576331

>>2576328
>should be able to run an ik engine?

I have no experience with that but the pi will be a real computer, and your choice of language and your robot speed requirement will be the determining factors. Maybe someone with experience will show up.

>> No.2576336

>>2576328
You can run inverse kinematics on an pi pico. Once solved, grinding out the numerical diffeq is not all that hard. It sounds like you don't need something as complex as a pi 3

>> No.2576372
File: 135 KB, 1517x523, FOC.jpg [View same] [iqdb] [saucenao] [google]
2576372

>>2576325
Nah I'm doing field-oriented-control of a brushless motor. That means sampling the current waveform of all three phases, putting it through the Clarke and Park transforms, combing that with the desired throttle levels, then doing the inverse transforms and feeding the output PWM values into the 3-phase inverter. Analogue multiplication on such a scale would be a lot more expensive than using an MCU, and probably less reliable too.

The electrical frequency of the motor will be 3.6kHz, so to get 1% accuracy on its position I'll want to be able to measure 360kHz, requiring a sample rate at least twice that, more if I want a non-insane anti-aliasing filter. I can likely relax those requirements somewhat (e.g. 2% accuracy), maybe oversampling a bit, but 3 × 1MS/s is a safe bet. Pretty sure the 133MHz clock speed of the RP2040 will be enough for all that on one core.

>> No.2576827

i am trying to use rtos for my next fartduino project and i am trying to understand delays, so when i do rtos delay, then it will let another task run during that delay, so if i do this

while(true)
{
analogRead(..)
vtaskdelay(1/ticks) // waits for 1ms
}

does this pose high or low cpu load? like comptuer resources wise how taxing is running a loop like (inside a task) that on esp32 or atmega328p?

>> No.2576841

>>2576827
You might want to research how an RTOS works. In this case it basically says "sure, okay, I'll get back to you in 1ms ms", and goes off to do other things. There's usually a 100Hz or 1000Hz interrupt that gets the RTOS to check what to work on next, and during all that time your task is suspended.
That 1ms you ask for isn't going to be accurate unless the RTOS supports having a more accurate timer, it's just a minimum amount of time before it gets back to you. But it's not going to be sitting there spinning waiting on shit. When there's nothing else to do, the RTOS can go into low power mode and sleep until the next interrupt.

>> No.2576843

>>2576827
also it's a good idea to make your code more readable by making it obvious you are trying to get milliseconds, something like this:
>#define MS (1/ticks) // this is one millisecond
then you can do "vtaskdelay(1 * MS)" and you don't have to explain what it means every time you use it.

>> No.2576845

>>2576827
>1/ticks
Wouldn't that always be 0, unless ticks=1?

>> No.2576849 [DELETED] 

>>2576845
"/" is floating point division

>> No.2576851

>>2576845
"/" is floating point division if ticks is a float, or if the "1" is replaced with "1.0". That's another good reason to put it in a #define because you only have to get that right once.
Quite a few RTOSes use floating point for sub-second times.

>> No.2576854

>>2576851
Why the hell would you use floating point for this? Not even desktop OSes do that.

>> No.2576867

>>2576843
I am just following tutorials and basically they say that rtos delay works like that
so instead of delay(5) it's vTaskDelay(5 / portTICK_PERIOD_MS)

>> No.2576885

>>2576867
And if you remember your high school algebra**, that's 5 * (1/period)
And I'll bet the period is actually just defined somewhere as .001, so the whole point is stupid because all that's doing is trying to make it an exact multiple of the tick count and also floating point at the same time. If the period was something other than 1ms then it would probably give you the wrong timing, so whatever you were copying from was probably not exactly right.
**You did pay attention during high school algebra class, right?
>>2576854
And that's why, because as long as you can do the float math, it is independent of whatever your tick unit size is. Using float on a CPU without float isn't as bad as it used to be. The big code is in text to numeric conversion, and also in doing multi-byte math on an 8-bit CPU. Having 32-bit multiply and divide instructions helps a lot too. Just shift the number over to normalize it, then multiply by the reciprocal to divide.

>> No.2576891

>>2576885
It just seems like bad style. I'd prefer simple integer-only math, needs less code no matter whether you use float emu or hard float. Make the API function take ms or microsecond, or at least offer a simple macro that converts them to ticks. Also I hate ticks. Give me a programmable timer, instead of molesting the MCU with 100 or 1000 useless timer IRQs per second.

>> No.2576901

>>2576885
it's not wrong, all rtos example codes i saw use it, even official documentation does it that way
not to mention i know it's not wrong because it works correctly for me

>> No.2576905

>>2576867
>>2576885
>>2576891
freertos by default uses a 100hz tick rate. when you call the delay function the argument to it isnt ms, its rtos clock ticks. if you look how that macro is defined we see.
portTick_period_ms = 1000/configtick_rate_hz.
plug in the default tick rate = 100. we have that macro reduce to '10'. so you cant ever have a delay, using default, below 10ms. why? because theres NO floating point. its all integer. so when you say delay(5/porttick_period_ms) youre actuallt getting delay(0). which just yields the task and queues it back up immediately after the next context switch. this is why its recommended to change the configtick rate to 1000. becsuse then each tick is 1ms and you dont need any macro conversion.

>> No.2576930

>>2576905
>because theres NO floating point
Wrong. The reason you can't have a shorter delay because the tick size is 10ms. Unless there is a finer time reference and it can set a chip to send a timer interrupt in only 1ms, it's just going to be sleeping or running another task for the other 9ms, floating point or not.

>> No.2576939

>>2576905
Or the OS could just use a programmable timer, and give you the best timer resolution possible with the hardware.

>> No.2576951

>>2576939
>the OS
This is an embedded device, anon. The whole reason for an RTOS is because there isn't another OS. There isn't anything to give it timing better than the 10ms tick.

>> No.2576954

>>2576951
>The whole reason for an RTOS is because there isn't another OS.
A RTOS is still an OS.
>There isn't anything to give it timing better than the 10ms tick.
A lot of hardware actually supports programmable timers.

>> No.2576955

>>2576954
not unless it's actually on the board, how do you have any idea whether this is an tarduino or some cadillac raspi?

>> No.2577127

>>2576891
You will make it, anon.

The idea of unnecessarily using floating point is hilarious. It’s a pythonism. Especially considering lots of common fractions are not representable without repeating in binary.

The way the timers work, is they take the clock frequency, and you give the timer a count, and when it reaches that count it, say, fires an interrupt.
(On SoC class systems).

On something like the original ibm pc, by default it was 18.2 times/second, or you could reprogram the PIC (with integers, as is native for everything) but the clock would be wrong.

It’s so easy to program it, there’s no real point to having a RTOS do it, and you might not even need an end-user clock/calendar representation.

Now, the division or multiplication should be done in the compiler, but it’s still highly unusual, since it obfuscates whats going on, rounds/truncates values and some μCs don’t have such integer divide/multiply instructions.

Originally, microcontrollers just ran in infinite loops, but today the would burn up. A desktop spends most of it’s time executing the HLT instruction (turned off, basically) until something wakes it up, like an interrupt.

Of course for high speed stuff, we still use spinlocks, when I/O is expected to return in a few clock cycles. This is why linux computed “bogomips” when it booted—to time the processor for busy-wait loops.

>> No.2577243

How good is STM32 F7-H7?

>> No.2577338

>>2576930
are you blind or just retarded? you literally just repeated what i said. and once again, theres no floating point division here. its all integer for converting """"ms"""" to ticks. the integer division will just round down as usual. to 0 if you try to go below the tick rate frequency.

>>2576939
>>2576951
>>2576954
it is programmable. just change configTICK_rate macro. you just also have to change any conversions should you use anything above 1khz. the tick rate is generated from the system clock, so it can be anything you want given your system clock is high enough to be scaled down efficiently

>> No.2577695

>>2577127
>The idea of unnecessarily using floating point is hilarious.
No, it's not. Why don't you just write desktop software if you think saving resources is bad.
>It’s a pythonism.
The fuck.
>Especially considering lots of common fractions are not representable without repeating in binary.
Then use fractions. Fractions aren't representable in floats either, you always get rounding errors.
>It’s so easy to program it, there’s no real point to having a RTOS do it, and you might not even need an end-user clock/calendar representation.
The RTOS should have native support for it, because waiting is inherently tied to scheduling and OS mechanisms with timeouts (like timed mutex locking). It's also important, because the MCU may not have that many timer IPs, and because unnecessary timer interrupts waste power and performance. A good RTOS should support tickless, period.
Not bothering with the other bullshit.

>> No.2577778

>>2577695
> “just use fractions: ‘from fractions import Fraction’ in your pycharm ide”
Ok kid.

>> No.2577783

>>2577778
Sorry, unlike you I don't use Python on MCUs. Also I know enough middle school math to do this.

>> No.2577796

Storing a number as a two-integer fraction is far less efficient or useful than using fixed-point, which is what anyone with actual sense instead of dunning kreuger would immediately recognize as the correct solution

>> No.2577799

>>2577695
>use fractions instead of scientific notation
let's see how high you can count with any precision

>> No.2578171

>>2575705
its dust. close to the image sensor

>> No.2578307
File: 385 KB, 3839x1047, wemospower.jpg [View same] [iqdb] [saucenao] [google]
2578307

>>2571738
I have a question regarding powering baby's first project.
It is a simple night light, wemos d1 mini based. Which of the three variants would you prefer? Is 1) too much stress on the D1? And are 2) and 3) feasible with the given 5V/2A phone charger?

>> No.2578348

I'm building a custom board using an ATmega32U4, and I can't write a bootloader to it. I'm using an old arduino uno I have laying around and AVRdude, but it's giving me device signature = 0x000000 and throwing up errors.

If I override with -F, it does seem to be writing to the chip, maybe? There's an LED attached to pin 36 (PF7), and it lights up in sync with the uno flashing it, but nothing is written and the chip still seems dead. The LED is also very dim, but I wonder if that's just because I overheated it while installing it.

I really don't want to desolder this board, man.

>> No.2578359

>>2578307
The ESP8266 chip featured on the D1 mini board has a maximum current per I/O pin of 12mA, as stated in the Electrical Specifications of the datasheet. So It's basically a requirement to use a transistor to switch an LED load. I'd then go for small-signal MOSFETs instead of 2N2222s, just because the lower saturation voltage gives you room for a current limiting resistor. Running a 3V LED off a 3.3V rail with no current limiting feels like a recipe for thermal runaway unless the COB has integrated current limiting.

Why have you used the reset pin to control the base of the transistor in the third example?

>>2578348
You're using the arduino as an ICSP programmer? Check that your MISO/MOSI are the right way around. Also try to use the arduino to program a different AVR.

>> No.2578400
File: 111 KB, 1259x700, 2n2222_12vled.jpg [View same] [iqdb] [saucenao] [google]
2578400

>>2578359
>maximum current per I/O pin of 12mA, as stated in the Electrical Specifications
Thanks will download it for future reference. The search for the Wemos D1 Mini only lead to schematics.
>small-signal MOSFETs instead of 2N2222
A quick search led me to the 2N7000. But I am not sure, why this is necessary. When looking at pick related, the +5V could be replaced by the 3.3V coming from the D1's digital output. with the same 4.7k resistor, this would lead to a current iB of 0.57mA, which is well below the 12mA. With a DC-Gain of 35, this would lead to around 20 mA at the led, which might be enough for a night light, which is only 50mm from the floor.
One thing, that bothers me, is that the 2N2222 refers everywhere on pic related to VCE=10Vdc. Do you happen to know, if this is the minimum CE-Voltage required? If this is the case, then my 5V supply is undersized.
>room for a current limiting resistor
Ah you mean for the leds? Or somewhere else? If 20mA is actually the flowing current, then I wouldn't worry. Especially since the LED will be triggered for 5-10 seconds at a time and then a longer duration of inactivity.
>Why have you used the reset pin to control the base of the transistor in the third example?
This was by accident. I just grabbed the nearest I/O-pin, which I thought would be able to control the base through pwm.

>> No.2578458

>>2578400
>VCE=10Vdc ... is this the minimum CE-Voltage required?

no.
it's just used as a point of reference for the gain measurements.
Max Vce is 40V, minimum is zero.

if you're using 4.7K on the base as a means of current limiting the LEDs, that's a bad idea.
coz you're assuming your transistor is gonna have the minimum specified gain of 35.
i can guarantee it's not gonna be 35; probably closer to 107.
so (1) lower base resistor to 1K, and (2) add some small resistor in series with each LEDs to limit its current to 100mA or less.

>> No.2578579

>>2578400
>The search for the Wemos D1 Mini only lead to schematics
You really should learn what MCU is on the board you're programming. It determines how much RAM it has, how fast it can execute instructions, what instructions it even has (e.g. hardware multiplication), and what features it has (e.g. a DAC, I2S, etc.)
>2N7000
It's not awful. Kinda shitty compared to more modern transistors like the AO3400, or even the BSS138. It's only rated for 0.2A of continuous current so it's a bit marginal to run both LEDs off one of them, maybe try to get a BS170 instead? That or go SMD like god intended.
>why this is necessary
Because a 0.4V collector-emitter saturation voltage is hardly impossible for a 2N2222. So when powering a 3V LED off 3.3V, it will be getting 2.9V. If that doesn't convince you, then again, running an LED with no current limiting feels like a recipe for thermal runaway. Read this:
>https://resources.altium.com/p/should-you-omit-a-current-limiting-resistor-for-led-if-youre-using-a-matching-voltage-power-supply
Furthermore, the saturation voltage AND forward voltage of the LEDs will have a negative temperature coefficient. Depending on temperature, the brightness of the LEDs could vary significantly, to say nothing of the risk of thermal runaway.
>Ah you mean for the leds
Yes.
>Especially since the LED will be triggered for 5-10 seconds at a time and then a longer duration of inactivity.
Might be fine actually.

>I just grabbed the nearest I/O-pin
The reset line is not general purpose I/O on an ESP8266.

>> No.2578647

>>2571738
Is it possible to read when the pins D+/D- (usb) are high or low on the rp2040

>> No.2578665

what would be the easiest way to read small resistance between 0 and 5 ohms with Arduino?
i can make a voltage divider where the other resistor value is know but the problem is that 0-5ohms is so small the arduino adc is not good enough to measure the voltage change

>> No.2578667

>>2578665
By the way i need it for measuring how hot a heating wire is, by measuring its resistance

>> No.2578670

>>2578665
Easiest? LM358.

>> No.2578682

I've got a pro micro that seems dead. It was working a few minutes ago, but I fat fingered the reset pins a bit and might've hit the 3.3V rail, and now it won't show up as a COM port. All it does is have a lit red led on it, if I short reset and ground nothing happens.

>> No.2578779

>>2578682
finger resistance is too high to matter. you wouldnt have done anything to it. probably the program on chip is broken

>> No.2578795

>>2572459
super glue

>> No.2578796

>>2578779
I mean I fat fingered jumper leads into the wrong hole for a split second. I think it's boned.

>> No.2578798
File: 24 KB, 474x332, th-1698423065.jpg [View same] [iqdb] [saucenao] [google]
2578798

>>2574441

>> No.2578814
File: 30 KB, 1001x658, file.png [View same] [iqdb] [saucenao] [google]
2578814

>>2578670
So i realized differential opamp probably wont work
I need to find out the resistance of the resistor on the left side (couple ohms at most) but since there is just that one resistor between power and ground, then it always drops the entire supply voltage across it, making me realize this won't work, since when the resistor heats up and its resistance changed, it's still dropping the exact same amount of voltage across it (all of it)

>> No.2578824
File: 38 KB, 1072x585, file.png [View same] [iqdb] [saucenao] [google]
2578824

>>2578814
i could add another resistor to make a divider like this
so that way i could calculate the voltage drop, when i know the resistance of one of the resistors, but the current is so high it would have to be very tiny concrete resistor like 0.1ohm or something

>> No.2578831 [DELETED] 
File: 30 KB, 435x270, rail-to-rail input op-amps (or full-swing op-amps).png [View same] [iqdb] [saucenao] [google]
2578831

>>2578824
>i could add another resistor to make a divider like this

dude, this is super simple.
you place a tiny resistor in series with the negative of the load.
the voltage across it is proportional to current thru load.
you use an op-amp to amplify that voltage as needed to give you a wide enough range for your 'duino.
the only tricky bit is you need an op-amp that can take in voltages very close to ground.
these are called rail-to-rail input op-amps (or full-swing op-amps).
your run-of-the-mill op-amp gets confused when inputs approach 1-2V of the power rails.
(pic shows an example where the sense resistor is close to V+, not ground, coz i'm too lazy to look for another one)

>> No.2578976

>>2578796
Got an ICSP programmer to read its ID?

>>2578814
Constant-current source in series with the unknown resistance, then feed the voltage across your resistance to a differential amplifier. By using a constant current source instead of another resistor, the output voltage will be directly proportional to the resistance. You'd set the current to something like 10-100mA, and the amplifier gain to something like 100.

>> No.2578978

>>2578824
You are slowly re-inventing a wheatstone bridge from first principals.

>> No.2578981

>>2578978
Nature

>> No.2578993

>>2578579
> no current limiting feels like a recipe for thermal runaway
You can protect your LED with a resistive element that has a positive temperature coefficient, like a small light bulb. Then, since your PTC resistive element generates light already, you can remove the redundant LED altogether.

The whole LED fad/meme is so over now anyway, it was played out back in the late 80s early 90s.

Thermal runaway… Lmfao… why bother with that shit?

>> No.2578995

>>2578976
ICSP shows 0x00000, I think it's fucked. Either that, or my ICSP is borked, but I don't have another board to test it on.

>> No.2579001

>>2578995
I was gonna say “now you know why you always have spares” but then I looked up the price… sheesh. Some of the TI explorer boards were cheaper

>> No.2579003

>>2578995
Save it to replace the CPU when you get hot air skillz.

>> No.2579006

>>2579003
For the 5 bucks a pro micro costs, barely seems worth it.

>> No.2579011

>>2579006
it's something to practice on later

>> No.2579026

I'm pretty decent at DIY in general, and while electronics is not my strongest skill, I've never met a challenge I wasn't up to.
However now I'm trying to plan a project for which the knowledge of what products are out there is essential, and that I don't have.

I want to set up four moisture sensors in planters, these would be connected to some sort of microcontroller powered by one of those small solar panels (don't need measurements at night anyway). The microcontroller would then transmit the data regarding to the moisture readings wirelessly to another microcontroller inside my house (ideally some sort of p2p thing, not WiFi). To this indoors microcontroller I'd hook up a small display to get the readings.

I know how I'd tackle the rest of the hardware (I'd 3D print a housing for the outdoors microcontroller, etc) but in regards to the electronics hardware, I don't even know where to start looking, there's a billion things out there and without the knowledge of what's available I'm struggling to start this project.

Suggestions? (Is my idea flawed btw?)

>> No.2579028

>>2579026
just to clarify, the planters are right next to each other, so I was planning to have a single microcontroller for all four sensors
also, if the sort of microcontroller that could do this is too powerhungry for a small solar panel, I could improvise a way to get power to it via a barreljack or something

I have done things with arduinos before, in fact I have an arduino uno sitting around catching dust right now, but other than that my experience with microcontrollers is limited, I'm more used to working with SBCs but that would probably be overkill here

>> No.2579036

>>2579006
> 5 bucks for a pro micro
I got scammed, I paid $20 each

>> No.2579041

>>2579036
Did you buy the real things instead of the chink clones?

>> No.2579054

>>2579041
> got real one?
I got it at sparkfun, i thought it would be better quality and that whole “reputable source” thing mentioned by other anons earlier ago.

>> No.2579055

>>2579026
> water sensor
Warning, if you’re doing this indoors, and you’re going to actually start watering plants automatically, make sure it’s intrinsically safe, so you won’t severely flood your house/apt

>> No.2579058

>>2579026
Probably a job for multiple RF modules, or just create a wifi network with the indoor micro that the outdoor ones connect to.

>> No.2579059

>>2579055
nah, it's outdoors, I just want to have a readout indoors showing the humidity status of the soil so I know when I need to go outdoors to water the plant. Want to eliminate risk of over/underwatering.

>> No.2579069

>>2579001
that's why you use a $1 USBasp

>>2579026
a simple 433MHz module should work fine for you, maybe lorawan makes more sense

note that people have had problems with cheap soil mosture meter modules, the ones with metal contacts corrode due to the current flowing through them, and the ones that use solder mask as an insulator and make capacitive measurements end up with the solder mask flaking off after a while. i'd try to get professional soil moisture sensors, that or try to make one.

>>2579028
if you have a microcontroller board without a power led burning a few mA constantly, and put it into sleep mode and shut off the sensors with a watchdog timer, you should be able to run it off a calculator solar panel + supercapacitor. even am radio energy harvesting could work, that could be fun.
if you intend on connecting it to valves though, that's where the significant power usage comes in.

>>2579006
the only reason to buy a pro micro over a nano or mini is the native usb hardware
the esp32s2 (or later) also has native usb hardware with much better overall specs, and should be close to that price

>> No.2579181

>>2579069
>esp32s2 (or later) also has native usb hardware with much better overall specs
not the fucking esp32 shill again

sorry, no wifi here.

>> No.2579215

>>2579181
Nah I'm not him, I prefer the RP2040, and I use AVRs for everything since I've got a bunch of ATtiny1614s I got for like 90c each. But if you care about price, you should consider at least the ESP or the RP2040. ATmega32U4s are basically unobtanium at this point, so any price you get for a dev-board is going to be indicative of that. If you get one for $5 or less, I'd question the legitimacy of their chips.

I use my ESPs without antennas so Xi can't spy on me.

>> No.2579256

>>2579215
>ATmega32U4s are basically unobtanium at this point,
Why

>> No.2579260

>>2579256
chip shortage. the fuck have you been living?

>> No.2579270

>>2579260
In the bunker, newfag
Chip shortage or did they decide all mcus need to run android with the newest nsa 5g uplink

>> No.2579272

>>2579260
Ain't no fucking chip shortage

>> No.2579276

>>2579270
>>2579272
go back to your containment board

>> No.2579291

>>2579276
Which one I've been in a shipping container this is my board
>>>/Plebbit/
Go home

>> No.2579348
File: 10 KB, 400x400, tegaki.png [View same] [iqdb] [saucenao] [google]
2579348

>>2578978
how would i implement it here though? i have a resistor with 12v permanently hooked up to it, controlled by pwm N fet and i need to measure the resistance by a micro with ADC that can only handle up to 3 volts

>> No.2579353

>>2579348
Maybe you should ask in /ohm/ where they talk about basic electronics shit.

>> No.2579357
File: 30 KB, 435x270, Precision high-side current sense amplifier.png [View same] [iqdb] [saucenao] [google]
2579357

>>2579348
>i need to measure the resistance by a micro

firstly, you cant measure resistance of a thing that has a current going thru it
you can calculate it knowing the voltage and current
you know the voltage, so you just need to measure current
to do that, you put a tiny resistor in series, read voltage across it, and amplify it to get a reasonable level that an ADC will like
you need a rail-to-rail input op-amp (or full-swing op-amp) like in the pic
use google reverse-image search to get more info
(if you're doing PWM, then you'd have to take a bunch of readings, and take the highest)

>> No.2579429
File: 795 KB, 1283x835, 1675684247834199.png [View same] [iqdb] [saucenao] [google]
2579429

can i get cameras for this thing or atleast an adapter somewhere to the connector thats on raspberries?
i think i saw something which seemed compatible on some phone or tablet i took apart but that was ages ago

>> No.2579567
File: 5 KB, 225x225, images(8).jpg [View same] [iqdb] [saucenao] [google]
2579567

>>2579348
I don't recommend doing that schematic unless you are trying to make a heater

Get a current measure sensor and run the 12v supply through it and use the MCU to read the output of the sensor.
I'm sure you could make one

>> No.2579825

>>2579567
>>2579357
these are two sides of the same coin. and neither should be used for measuring resistance
>shunt resistor
highly accurate
very responsive
can easily measure current at different points of a PWM
but...needs to be a like a 50 mOhm resistor with a decent power rating and a R2R opamp
>current transformer
non invasive
simple setup
but...its not as responsive or accurate for DC. these are usually used to measure power on an AC line.

so why not use them?
>>2578665
because op said he needs to measure the temperature of a wire. simple. use a thermocouple and attach it to the wire. measure the temperature directly.

>> No.2579829

>>2579429
> microcontrollers? This thing is twice as powerful as my PC

>> No.2579847
File: 52 KB, 408x706, q2.png [View same] [iqdb] [saucenao] [google]
2579847

didnt want to ask advice, feel that i could get a better response on where to start with this question. any advice would be great

>> No.2579857

>>2579847
You can maybe try in /sci/ because that pic looks like a math question?

>> No.2579914

>>2579847
Most of them have at least one wrong thing in them, for example, there are no square waves, fig 2 is the only simple sine wave, and none of them is a cubic polynomial. By the process elimination…

>> No.2579917

>>2579914
Still 4,5,7,9 to go.
then can't be 9 since a sine is the laplace transform of something with sharper edges iirc
then 2 is even not odd so it can't be 5 or 7
so just 4 could be it, can't do a convolution in my head but it looks plausible

>> No.2580050
File: 216 KB, 1224x616, 1673765819547681.png [View same] [iqdb] [saucenao] [google]
2580050

>>2579829
its not THAT powerful
still i thought if i have one i might try to see what i can do with this processing power and cameras. my only other board that has video inputs is a raspberry 2

>> No.2580065
File: 1.25 MB, 1080x2400, Screenshot_2023-03-13-18-20-50-297_com.google.android.apps.photos.jpg [View same] [iqdb] [saucenao] [google]
2580065

>>2572458
Waiting for components to make a 3 channel 3886 gainclone amplifier. In the meantime I'm making a nixie tube clock (yeah it's been overdone but fuck it)

Recently found an easy way to make pcbs at home, my wife has a cutting plotter to make vinyl transfers on children's clothes she makes. You can also cut stickers with it so I just cut the traces/islands out and put it on bare copper pcb material. It's really easy this way

>> No.2580071

>>2580065
I forgot to add that of course this only works with simpler/cruder pcbs. Once you get under 0,5mm traces the sticker material becomes too flimsy to work with

>> No.2580077

>>2580071
It's so cheap to get multi-layer PCBs from china for a few bucks now that it's barely worth the hassle to do it at home.

>> No.2580100

>>2580077
I get boards from the USA for a few bucks. OSHpark is all I need, I order boards for $0.75 sometimes.

>> No.2580227

>>2580077
True but shipping can be expensive if you want it fast. For more 'serious' stuff I order from china but if you want a small thing today and a breadboard won't do then this is ideal

>> No.2580289

is there anything special with SPI pins of pico/rp2040? I am trying to modify an SD lib to use custom pins but failing

>> No.2580301

>>2580289
Does it work with the intended pins? It may be that only certain pins can be used for SPI, I know the QSPI pins on those 32bit MCUs can’t be moved at least. Read the datasheet sections on port multiplexing and SPI.

>> No.2580311
File: 726 KB, 847x900, file.png [View same] [iqdb] [saucenao] [google]
2580311

>>2580301
I have pic related, rp2040 zero and if I am understanding the code correctly, the pins the library is trying to use are these so I can't use them

What I don't get is there are multiple SPI0 sck/rx/tx pins

>> No.2580316

>>2580077
> boards made in china
Yeah, why force them to reverse engineer your product PCBs when you can literally hand them the master artwork.

>> No.2580332

>>2580311
> multiple pins
I’m guessing they are reprogrammable

>> No.2580336

>>2580311
>>2580332
All modern chips do port multiplexing. There aren't enough pins for all IP blocks, so you have to choose which ones you want to use. Basically you need to map the pins to the function to use on init. What I don't get is why they overlapped SPI and I2C so stupidly.

>> No.2580350

>>2580336
>>2580332
Yeah, I was able to change pins to other pins of same type by setting SPI._mosi etc

After it started failing in some other place and after some debugging and googling, I figured out I will need a 32gb card

I think I can format my 64gb to 32gb and use FAT32 but I will just get a new one

>> No.2580385

Hello my friends. I am trying to simply flash an LED on a PIC16, but i have a problem. Basically, i have the LED on and when i depress a push button, the LED is supposed to flash at 4Hz. However, when i press the button, the LED gets very very dim, but i can see it flashing. The current limiting resistor i'm using is only 300ohms and i'm pretty sure my pins are configured correctly. I'm literally just turning the output pin high and low after a delay. Any idea what could cause this?

>> No.2580435

>>2580385
Could it be that your duty-cycle is so low that it looks really dim thanks to a high enough frequency, but some flicker is still visible? Or does the flashing happen at the desired 4Hz?

>> No.2580489

>>2580350
>I figured out I will need a 32gb card
Uh, how about you check whether raw read accesses work first.
>I think I can format my 64gb to 32gb and use FAT32 but I will just get a new one
FAT32 can do 64 GB, but cards larger than 32 GB are formatted with exfat according to standards requirement. Fuck Microsoft.

>> No.2580540

>>2572459
yes you can modify the on board antenna, just remove a bit of the solder mask and solder a sma connector on it, look it up on youtube there is a video of someone doing it

>> No.2580777

>>2580489
> need exfat for ≥ 32 GB
They (MS) probably had a bug where they accidentally used signed arithmetic. Pretty common.

>> No.2580827

Does anyone have any way to access the serial console remotely? (In the same network)

>> No.2580834

>>2580827
netcat or ssh

>> No.2580844

>>2580834
in an esp32?

>> No.2580846

>>2580844
Not sure what you're actually asking about. But if your MCU is connected to a PC, and you want to access it remotely, ssh or netcat is the choice to redirect serial output. If you want the device to be accessible by network directly, you can use a TCP stack (and then use netcat with a raw TCP connection). Or you can do it much simpler and create your own ad-hoc UDP protocol. In that case, you also could use netcat in UDP mode to avoid having to write software on the desktop. netcat is just a simple tool to access TCP or UDP with the terminal, so it's an obvious choice for this.

>> No.2580848

>>2580846
PS: sure, ESP32 is powerful enough to do this. There's pre-written software for this for sure.

>> No.2580853

>>2580846
>But if your MCU is connected to a PC
But it's not.

>> No.2581180
File: 114 KB, 1599x899, IMG-20230315-WA0005.jpg [View same] [iqdb] [saucenao] [google]
2581180

Anyone knows what causes this? I use DHT22 sensor and standard adafruit dht unified sensor library. It reads humidity and displays it both on the humidity and temperature field

>> No.2581286

>>2577796
Do people typically use a binary or decimal fixed point?

>> No.2581311

>>2581286
almost nobody uses BCD math unless they have a really good reason

>> No.2581316

>>2577796
Depends on the use case. For time keeping, just use ms or us resolution as the simplest and most efficient possible solution, and be done with.

>> No.2581321

>>2581180
what happens when you run this example:

https://github.com/adafruit/DHT-sensor-library/blob/master/examples/DHT_Unified_Sensor/DHT_Unified_Sensor.ino

>> No.2581322

>>2581311
I meant, when using fixed point, do people usually use divisors like 10, 1000, 1000000, or 8, 128, 8192?

>> No.2581325

>>2581322
Fixed point usually uses power of twos, because that's faster.

>> No.2581416

>>2580489
Raw block read & writes seems to be working. It is just high level SD card library not being able to work with 64gb exfat

Thanks for suggesting raw access anon, wasn't aware how easy it was. It won't be useful right now since I want a file system but might be in future

>> No.2581463

>>2581322
Some ibm ppc based processors have a FXU to do fixed point and decimal fixed point natively in 1 clock. The reason is you don’t want be computing money values with binary fractions.

Similaly, in the microcontroller world, we use BCD when we need to, say, update a 7 segment display or some other base 10 calculations that humans see. The routine to take the binary values and turn them into decimal will use the native BCD instructions.

Everything else is done native integers, or scaled integers where possible, or fixed point secondarily. If your μC doesn’t have floating point (this is an absolute nightmare to implement on an 8-bit mcu) you could theoretically implement/add a library but you can almost always get around it.

>> No.2581546

>>2581325
This is especially fast in instruction sets like ARM where you can shift be N bits. AVR just has a single bit L or R shift.

>> No.2581897

For rp2040, what is the fastest int size? Are they all same?

uint_fast16_t is actually 32 bit int so I am not sure. Does that mean 16 bit ints are slower and 32bit is the fastest one?

>> No.2581901

>>2581897
The native register size is 32 bit. If you use a 16 bit type, it may need to insert extra instructions to expand the 16 bit to 32 bits in some cases. But honestly, I can't think of as reason why uint16_t should be slower than uint32_t on that MCU?

>> No.2581902

>>2581901
>I can't think of as reason why uint16_t should be slower than uint32_t on that MCU?
that is what I am wondering, but why would they define uint_fast16_t as 32 bit then?

>> No.2581908

>>2581897
Since you’re doing it in C, you probably want portability, so I wouldn't bother with things that have fast in them, at least initially. Premature optimization is the root of all evil.

Your best bet is to go with the native register size except in cases where there’s a lot of data and the storage losses exceed the native size.

With smaller widths, you might get alignment penalties (non-32 bit aligned); microcoded implementations of smaller less-used widths with extra clocks, etc.

Always performance test.

>> No.2581926

>>2581902
Why not? It can be anything they want. Maybe there are some operations that don't require extra instructions if it's 32 bit (native register width) wide. But ARM can do 16 bit memory accesses natively, and most arithmetic is the same in 16 bit and 32 bit. I'd not use the "fast" types at all. If your code can afford the flexibility, just use a typedef, that you can change depending on the architecture, when it really matters.

>> No.2582007

>>2581321
Nevermind, it works now

>> No.2582031

>>2581902
I made a test.
https://godbolt.org/z/afav8Yovh
Change the typedef to see the difference in asm code. The uint16_t version needs 2 more instructions.

>> No.2582310

>>2580100
What the hell. I'm still in the through-hole-stage, got curious and I can for the love of god not find any service, which delivers 3 pcbs with dimensions of 100x100mm below 50€ in germoney.
Also this: >>2580316

>> No.2582361

folks so i bought this message recorder and it comes loaded with a mystery ic which i suppose is a pic and picrel which is the flash memory. i tried to hack it to alter its pitch but it was impossible. i should be able to do it by replacing the incoming clock at pin 6, right? its still infuriating how stable it is, other devices are hackable instantly, like by touching the pcb with your fingertips, this one is stable as fuck.

>> No.2582363
File: 154 KB, 1260x603, P25Q16H.jpg [View same] [iqdb] [saucenao] [google]
2582363

>>2582361
forgot pic

>> No.2582373

>>2574441
just smoov digical with capacitor. do like PWM. it work for you good.
>t. chink

>> No.2582435
File: 1.43 MB, 1166x886, file.png [View same] [iqdb] [saucenao] [google]
2582435

I am making a gameboy, pretty fun and somewhat challenging due to limited ram/rom size on rp2040 zero (2mb flash & ~260kb ram)

pokemon rom is stored on SD but I have a cache on ram. It keeps most commonly requested file blocks in the cache. seems to be working well

ram limitation is hard thou, there is not enough ram to store my gameboy rom cache and a full screen buffer (I only have buffer enough to render gameboy. it is transferred using dma and it transfers top and bottom half in a way that allows double buffering)

I will try to figure out store a full screen buffer using 8 bit colors and use a color palette. But i will need to learn how to program DMA first so I can transform 8 bit colors to 16 bit ones that the screen is expecting

I will be 3d printing a case as well

>> No.2582477

>>2582435
Cool stuff. If you're using an exisiting gameboy ROM you'll probably have a hard time since you're basically programming an emulator. If instead you rewrite the game to run natively on the RP2040 it would probably be a lot lighter on the hardware, not that such a rewrite would be easy. For emulation like that people often use FPGAs instead, that way they can basically recreate the entire hardware of a gameboy on the transistor level.

>> No.2582482

>>2582435
Always a good time. Check the datasheet for your screen, could be a way to feed it 8-bit color instead of 16.
It looks like one of the common ILI9341 screens though, and I'm pretty sure they only support 16 and 18-bit color.

>>2582477
It's been done plenty, there are Gameboy emulators already available for RP2040, ESP32, and certain STM32s.

>> No.2582489

>>2582477
>>2582482
Yeah I am using peanut gb
https://github.com/deltabeard/Peanut-GB
it is quite portable, and easy to edit. It provides you callback function that you just need to implement for your system

emulation part is not the bottleneck to be honest, it is updating the screen

>It looks like one of the common ILI9341 screens though, and I'm pretty sure they only support 16 and 18-bit color.
it is ST7789, which I think pretty much the same

I think PIO is the answer I am looking for, perhaps it looks like it can be used for SPI and it can probably also convert 8 bit colors to 16 bit but I am not sure. It is a bit beyond my programming level at the moment, so I will just stick to using 16 bit colors and regular DMA/SPI for now

>> No.2582504

>>2582489
The ST7789 has a little bit more going on than the ILI9341, with SPI you've got 12, 16, and 18 bit color modes.
May not be relevant for you, but maybe the 12-bit color mode could be useful. Given that it is a serial connection,115200 bytes per frame as opposed to 153600 is substantial. (that assumes 320x240 res)

Very cool, definitely share more as you progress with it.

>> No.2582513

>>2582477
>they can basically recreate the entire hardware of a gameboy on the transistor level.
Maybe this is pedantic, but this is not true - you can not create anything at the transistor level in an FPGA
They can only recreate digital circuits at the logic gate level, and FPGA gates are very different from CMOS gates since they're implemented as lookup tables. This is one of the reasons why FPGAs are much slower than true CMOS designs

>> No.2582587

Guys, i'm looking for IR solutions that can go as far as 2 meters, i found this one: https://wiki.dfrobot.com/Digital_IR_Proximity_Sensor_0_200cm_SKU_SEN0381

what should i get?

>> No.2582598

I need to order some parts from digikey, but the shipping is so expensive that I might as well just add another 15 bucks onto my order. What have they got that's generally useful to have around? I guess I could buy some solder.

>> No.2582607

>>2582598
they sell good breadboards (compared to amazon's crap)

>> No.2582666

>>2582587
any of the st vl53 series will work

>> No.2582789

>>2582598
they offer free shipping if you buy enough stuff if you haven't noticed. at least digikey.se. But a single breadboard won't cut it

>> No.2582792

>>2582789
Yeah, that's why I want to spend an extra 15 bucks. It's about 15 bucks for shipping, and I'm 15 bucks under the order limit.

Breadboards are eh, I don't do enough prototyping stuff. If they sold cheap arduinos or something I'd just buy a few of those, but they're 2-4x the price of china.

>> No.2582807

>>2582792
heat shrink kits
crimping tools
rolls of wire
specialty ICs
some developement kit

>> No.2582809
File: 39 KB, 1221x364, int.png [View same] [iqdb] [saucenao] [google]
2582809

>>2582031
you should have enable optimizations. But yea, 16 bit ints seems to be using 32 bit operations and convert results to back to 16 bit.

>> No.2582882

>>2582666
good call, thanks

>> No.2582902

>>2582809
>you should have enable optimizations
What a stupid beginner mistake. Anyway, I assume this matters not as much in expressions and tight loops, where the compiler can choose not to narrow a computation to 16 bits.

>> No.2583068
File: 754 KB, 665x604, file.png [View same] [iqdb] [saucenao] [google]
2583068

tried two different NES emulators on rp2040 (infones & agnes).

Performance sucks ass. First tried agnes, and it was unplayable. infones was a bit better bit still very slow

then I noticed on infones git repo
>The emulator overclocks the Pico in order to get the emulator working fast enough. Overclocking can reduce the Pico's lifespan.

interesting NES is more performance heavy even though GB supposed to have faster cpu. Wonder why is that

Also colors are all fucked up because I can't figure out what exactly my screen color format is. it says R5G6B5 but either it is wrong or wrong ordering or I did something wrong creating palette

>> No.2583071

>>2583068
any by overclock it almost doubles CPU frequency. how safe is that?

>> No.2583075

>>2583068
>retarded idea has bad results
I'm shocked!

>> No.2583136

>>2583075
rude

>> No.2583186

>>2583071
The RP2040 seems pretty forgiving with overclocking, I haven't seen any issues even at double the clock speed.
I wouldn't worry too much. It's not like it's running anything critical.

>> No.2583199

>>2583068
Should be RGB565, but it might be flipped to BGR.

The NES is old garbage, in the "hacked together shit" sense, it predates anything so normal and a Gameboy.
>The NES has a bunch of weirdness with dozens of memory mappers, usually serial input into a shift register to manipulate them, weird mid-frame scrolling behavior, reuse of the regular VRAM pointer for rendering the frame
>Quite a number of games on the NES rely on exact timings, otherwise graphical glitches or freezing will occur.
>[Homebrew NES game developers] frequently seem to have trouble syncing CPU and PPU cycles (which run at different rates), so there's that little gotcha
>The NES carts had far more mappers than their Game Boy counterparts.

In communities where fags make emulators for the fun and learning experience, it's generally agreed that the Gameboy is an easier system to emulate, for both the developer and the system running it.

>> No.2583290

>>2583071
I imagine it's just a thermal thing. Slap a heat-sink on it and it should be fine.

>>2583199
Is it possible to make a NES with actual ICs still being sold? There are definitely still 6502s or their derivatives you can buy, but the Ricoh 2C02 PPU seems less possible. Is there still even that sort of IC being made?

>> No.2583319

>>2583290
In short, no. The original Analog Nt, an "improved" reproduction NES, actually used chips harvested from original Famicoms.

But also sort of yes because china.
The original chips, not so much, but the entire NES has been available as a SoC for a long time, various iterations out of commie countries for over 20 years now.
They're actually called NOACs, NES-on-a-Chip. They're almost exclusively ASICs, big surprise.
It's neat garbage but really not what you're talking about.

>> No.2583352

>>2583319
>It's neat garbage but really not what you're talking about.
I mean, if it's logically identical who cares? No less authentic than an FPGA reconstruction, and probably a lot cheaper too. So long as it can take an actual cartridge, that is.

As for authentic clones, are there any consoles that can be made authentically from still available parts? PS2s are too modern to be made cheaply from MPUs, but anything older seems to have what I'd consider to be an archaic video processing method that's probably hard to find an ASIC for. Excluding the based Vectrex.

>> No.2583368

>>2583352
They're not logically identical, they're far from it, they're riddled with flaws, vary like crazy, and aren't well documented.
NOACs are a whole category of cheap garbage, and while they can be fun, there is not a one out there with widespread compatibility or high accuracy, even among the offerings that did include cartridge slots.
Many used ROMs that had to be modified/patched to work properly. Colors were bad, sound was bad, speed was never right.
Even into the early 2000s they were really awful pieces of shit, but like anything else they got ever so slightly better over time.
The current generation isn't completely useless, and can certainly handle the majority of popular titles, but are exclusively available under a blob of black epoxy in Chinese-made products. There's nothing to "do" with it really.
They've even been used in plenty of handheld or plug-and-play videogames with bespoke titles, like the Oregon Trail Handheld.

If you want the equivalent, but better and /diy/, get an FPGA. There are plenty of "NES on a FPGA" projects, it's a classic endeavor for a certain category of nerd.

>> No.2583478
File: 220 KB, 356x304, file.png [View same] [iqdb] [saucenao] [google]
2583478

>>2583199
The color issues were due to endianness, I was calculating the color palette wrong by not factoring little-endian into play. Figured out after rendering a single color and editing it bit by bit and seeing how it changes on screen. Swapping bytes fixed it.

My camera was not able to capture colors correctly but it looks fine and correct to eye

>>2583290
I will ignore the performance issue for now, until I get some heat sinks, then I will start overclocking it

It is also annoying I don't have enough ram to store all NES rom data and not enough ram for it. I don't want to flash my pico everytime I want to change nes/gameboy rom. Hopefully my ram cache approach will work in future for NES as well

For now I am waiting for another/smaller screen. After that I will try to solder my PCP and design a smaller case for my gameboy.

>> No.2583528
File: 317 KB, 1920x1080, snapshot.jpg [View same] [iqdb] [saucenao] [google]
2583528

>>2583290
>>2583478
Here's a chart of clock speed and temperature, taken from this video https://www.youtube.com/watch?v=rU381A-b79c
Probably don't need a heat sink. Even at 400MHz the internal temperature sensor only reads 40°C

>> No.2583673

>>2583528
why is it a triangle
what does the x axis represent
i do not undertand

>> No.2583759

Hey anyone here know if this pic programmer:
>https://github.com/jaromir-sukuba/a-p-prog
can be used to read back the flash on an already-programmed pic? I suspect a PIC16F73 is being used on my UPS to control charging of a lead-acid battery and I want to swap it over to LiFePO4. Chances are kinda slim that it's not locked, but I figure UPSs are hardly black magic so maybe they didn't bother. Hopefully I'd be able to translate the machine code into ASM and figure out what the ADCs are comparing with. Maybe it's a long-shot. The thing is a socketed DIP28 so worst case I can make a little board to replace it with a 328P or whatever, though that will require a complete rewrite of the code and reverse engineering of the PCB.

>> No.2583805

>>2583759
With that programmer, I'm really not sure. However, what you want to do is not difficult.
https://microchipdeveloper.com/mplabx:read-a-device-and-save-the-hex-file
MPLABX will do what you want, but I don't know what kind of programmers you can use it with aside from the "official" tools like a PicKit.
PicKit 2/3/3.5 clones come out of China for around $20USD with everything you need.

If it ain't locked, that's pretty much all there is to it.

>> No.2583811

>>2583805
>PicKit 2/3/3.5 clones come out of China for around $20USD with everything you need.
I guess I should just get one of those.
>MPLABX
Not too fond of Microchip's software. I'd rather use GCC and some sort of command-line tool.

I'm reverse engineering the board at the moment to see if the thresholds are even set in firmware at all, the IC being used (UC3843BN) has an external reference input so it's looking promising to hack either way. A cheap ATtiny214 using its DAC to feed that pin and its ADC to monitor battery voltage and current would be a reasonably simple solution.

>> No.2583879

>>2583811
Should be possible, even picberry has a dump function. https://github.com/WallaceIT/picberry

>> No.2583892

>>2583673
x axis is time, it was a program that slowly ramped the clock speed up then down
idk why they didn't mark it

>> No.2583914

>>2583811
Wait it's just a reference output, not an input. Guess this TL431 is doing something else.

>> No.2584485 [DELETED] 

How are you supposed to teach yourself how to solder? Every video makes the process look and seem too easy. I can'r even remove the globs I made with solder wick.

>> No.2584571

whats a cheap fpga (<50€) I can use with my linux desktop for beginners? Are tinyfpga good?

>> No.2584585

>>2584571
For most Lattice FPGAs, there's even an open source tool chain by folks, who reverse engineered them.

>> No.2585051
File: 345 KB, 1280x720, maxresdefault.jpg [View same] [iqdb] [saucenao] [google]
2585051

Is it possible to send data over the micro usb port on the Pico w? I've been trying to simply send some data to my pc using uart.write() on the pico, but i haven't been receiving anything. It just dawned on me that maybe i can't use that usb port to send/receive data?

>> No.2585065

>>2585051
It's not connected to the UART pins of the RP2040 via a USB-to-UART IC like you get with an arduino nano. Rather it's connected directly to the RP2040's USB pins. If you want to speak to a computer using the USB port, you'll need to program data to be sent via the USB peripheral, rather than sent via the UART peripheral. Chances are there's an online example to get the Pi Pico to speak UART through USB.

The other option is just connecting a USB-UART dongle to the UART pins of the Pico.

>> No.2585180

>>2585051
you need to configure the usb peripheral such that the device is USB CDC. once done it will appear in winblows as virtual com port. on linux it will appear as ttyacm0 or some shit. from there you can send any serial data over line coded similarly to uart

>> No.2585421
File: 265 KB, 1267x1188, 1670276456546502.jpg [View same] [iqdb] [saucenao] [google]
2585421

I want to build a few computers from scratch, using a few different architectures. 65c816, risc-v, maybe 68k and stm32.
Thinking of using a RTOS. I'd like to get something like bash running, and if possible, a simple GUI. Thinking like MacOS 6 or 7 as far as the complexity of the GUI.

I'd like to use a FOSS RTOS to use for this. Been thinking Zephyr, FreeRTOS, or RTEMS. Any recommendations on which RTOS to use and any GUI's I might be able to get to run?

Haven't thought of what I'll do for graphics hardware. Initial steps are getting the board designed, built, running an OS, and then running a shell. Once I do all that, then I'll try getting a GUI, but would like to know what base OS to use with that end goal in mind

>> No.2585424

>>2585421
>bash
Look for something bash has been ported too. From what I know, bash requires full UNIX/POSIX. busybox might be simpler. From a swdev point of view, I'm thinking you're asking for trouble.

>> No.2585722

>>2585424
Looks like Zephyr and RTEMS are both mostly POSIX compliant. I do like the idea of busybox tho, since Linux is what I am most familiar with. This whole idea is just to practice, mostly in designing a computer from scratch, but also learning embedded operating systems. My primary architecture I want to target is risc-v.

>> No.2585878
File: 1.13 MB, 1242x730, file.png [View same] [iqdb] [saucenao] [google]
2585878

soldered my "gameboy/nes" a breadboard, it is pretty compact.

I haven't tried making PCBs yet, thus the breadboard and through hole components. After this one I want to make a much smaller tamagotchi

>> No.2585879

>>2585878
also loose wires are for the buttons, they are not soldered yet

>> No.2585928

Trying to make use of those RF modules, i need to extend the range, i'm trying to use those 0.5mm copper wires, do i need to have it all exposed or can it be with the pvc?

>> No.2585944

>>2585928
>do i need to have it all exposed

yep.
radio waves can travel thru brick, wood, plaster, tile, cement, glass, clay, curtains, and coat pockets without any harm.
but give 'em a few micrometers of plastic and they just up and die.

>> No.2585951

>>2585722
Actually, busybox works on Linux only.

>> No.2585960
File: 2.00 MB, 4032x3024, yagi.jpg [View same] [iqdb] [saucenao] [google]
2585960

>>2585878
>not desoldering the LCD from the massive PCB to cram it in tighter
NGMI

>>2585928
make a yagi-uda antenna

>> No.2585974

>>2585960
I removed the sd card slot at least, to make space at other side of the for the batery

Ordered a screen are without PCBs as well but it will take another month or so

>> No.2586135

>>2585421
> something like bash
Bash and busybox are the enemies of the minimal—you’d be better off going after bsd 2.11 toolsets as it ran platforms with similar capabilites to modern SoCs (taking up less space than a refrigerator though)

>> No.2586250

so i have this arduino loop

loop()
{
poop += 10 * deltaTime;
}

I poop to be increased by 10 every second, regardless how fast the loop is executing, so how do i calculate the value of deltatime?

>> No.2586251

>>2580065
>I just cut the traces/islands out and put it on bare copper pcb material.
this will only work with the simplest of pcb desings

>> No.2586368

Is there a recommended display to attach a pi zero to make a weather station to interact to?

>> No.2586381

>>2586250
Never used arduino before if you have access to current time in ms

initialazation()
{
poopStartTime = currentTimeInMs();
}

loop()
{
poop = (currentTimeInMs() - poopStartTime) * 10 / 1000;
}

so you don't really increment poop, but set it using current time - initial time. that way you don't need a delta (and all floating point accumulation errors)

>> No.2586385

>>2586381
>(currentTimeInMs() - poopStartTime) * 10 / 1000
actually should have been *10.0f / 1000.0f to convert it float

>> No.2586391

>>2586381
>>2586385

are both of you mathematically challenged beyond belief. why not throw in a few multiply and divde by 1 while you're coding your ass off.

>> No.2586393

>>2586391
/ 1000 implies it is a conversion from ms to s

* 10 is "10 unit per second"

Generally you want code that explains what it does. Here it is implies "10 poop per second". While * 0.01 would be confusing for people.

Plus this way it is easier to replace 10 in future with another value. Or it can be a define. Or a variable.

>> No.2586465

>>2586391
Typical for embedded devs.

>> No.2586574

>>2586250
Set up an unused timer/counter with an appropriate pre-divider. If done properly you’d be able to get one of the timer bytes to increment every 0.1s (probably the most-significant half of a 16-bit timer) and use that number directly. Or rather, you’d add (timer(now) - timer(last check)), the rollovers shouldn’t be a problem that way. If not, try to make it some factors of 2 faster so you can just do logical shifts instead of division. Multiplying and shifting is also a lot faster than division.

More professionally you’d run interrupts off that timer, though you may not have the freedom to do so if you have other timing-critical parts of your code.

>> No.2586603

anyone here have the title of engineer without a bachelors degree? Engineer I know with bachelors keep telling me you legally need a degree to be called an engineer but I think theyre full of shit. Hoping to find some examples of engineers with less than a bachelors.

>> No.2586604

>>2586603
>legally
That really depends on your country and its laws.

>> No.2586618

what kind of arduino starter kit should I get?
I want to do some simple stuff like watering plants remotely using radio signals, controlling servo and stepper motors, reading encoders, motion sensors, and that kind of thing.
I understand something like sending myself a text message or getting internet connectivity would be an order of magnitude more difficult and I don't think I'll ever be ready for that

>> No.2586623

>>2586603
they call you a "technician" or "developer" when you dont have a degree. being a registered professional engineer in my country does require you to have a degree.

>> No.2586624

>>2586250
time;
loop {
timenow = millis()
if timenow - time > 999
count += 10
time = timenow
}
god you blinkies are retarded. this is day 1 tarduino shit. you should however do it properly like >>2586574

>> No.2586625

>>2586624
Your code is fucking garbage as well.

>> No.2586703

>>2586625
how would you do it then? oh do enlighten me on how you can make tarduino c++ not look retarded

>> No.2586712

>>2586703
Not him but your >999 bullshit assumes the loop takes no more than 1 second to run, which is a decent assumption but he did say "regardless how fast the loop is executing". Also you don't account for the rollover of millis(), and I think millis has other interrupt related problems.

>> No.2586730

>>2586712
>rollover
the return value of millis is a uint32. when it rolls over it goes to zero. using unsigned variables takes care of this. if you do the subtraction between two uint32 variables by hand it works out. you can also test it manually in the program by forcing the time value to start at some large number
>more than 1 second loop
youre right about this. op said regardless of how fast, not slow, its running. i assumed that hes trying to make the loop go as fast as possible. but i even already stated that the correct way was to use interrupt based approach by pointing to the other guys answer, which solves that problem. seeing as the op is so retarded he couldnt figure this "problem" out on his own i suggested a solution that was simpler than the interrupt approach which is much less intuitive because it doesnt rely on millis. millis only has problems if youre disabling interrupts for whatever reason

>> No.2586737
File: 809 KB, 2000x1500, IMG_20230325_183727_copy_2000x1500.jpg [View same] [iqdb] [saucenao] [google]
2586737

I salvaged a security immobiliser from and old car the other day, the ULN chip looks useful for driving relays but I can't find any specs on the main controller chip, any idea if I can use it for anything anons?

>> No.2586744

>>2586730
>the return value of millis is a uint32
If he leaves it constantly, you get 4.3 million seconds, which is 50 days. It might possibly be a problem. The subtract method just makes more intuitive sense to me and it makes it a non-issue.
>regardless of how fast, not slow, its running
You can give "fast" a low value.

>>2586737
May well be a rebadged ASIC from someone else. Could try reverse engineering it, but I wouldn't consider it worth doing. If you want to get value from it, use/sell it as a car immobiliser.

>> No.2586960

>>2586618
Connecting to wifi with an esp32 is not hard. For many tasks it's hard to get the right decision logic quite right. At least for me it's easier to serve an ugly webpage from the esp32 than to make the equivalent interface with real/capacitive buttons and a screen.

>> No.2587641
File: 763 KB, 681x876, file.png [View same] [iqdb] [saucenao] [google]
2587641

it actually works, I printed a front cover and finished up the controller path. Here it is actually attached to a battery

All that is left designing where battery, on/off switch and usb charger port goes and printing a back cover. And then I can focus on software side (I want a menu list all gb/nes games on sd card and select one to play. right now it only supports either nes or gameboy and only runs 1 game from SD)

>> No.2588170

If the board says something like "10 analog inputs (16 bit ADC)", does that mean I have full 16 bit for every input or 16 bits shared between the inputs?

>> No.2588329

Anyone knows how i could improve the accuracy of the esp32 adc converter? I heard it's non-linear, how do I fix that without buying an ADC chip.

>> No.2588457

Not allowed to die

>>2588170
10 different inputs, each having a 16-bit resolution. Each returning a number between 0 and 2^16-1 mapping between your reference voltages.

>> No.2588467

>>2588457
It's called a "bump limit", newfriend.

>>2588466
>>2588466
>>2588466