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

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

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


[Advertise on 4chan]


File: kino.jpg (2.17 MB, 4032x1960)
2.17 MB
2.17 MB JPG
Previous thread:>>xxxxxxx

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

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

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

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

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

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

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

>RISC-V microcontroller list:
https://codeberg.org/20-100/Awesome_RISC-V/raw/branch/master/RISC-V_MCU_development_boards.pdf
>>
actual previous thread: >>2774325
>>
File: blinkleds.webm (2.94 MB, 1280x720)
2.94 MB
2.94 MB WEBM
no interest anymore?
>>
>>2803735
I am interested but I am busy with a move, but I still lurk
>>
>>2803735
No. I quit embedded and took up gardening. I now think of snails as Arduino users. The day of the rake is coming for you.
>>
>>2803735
The autistic shithead brigade ruined this general long ago.
>>
>>2803735
I successfully managed to avoid putting a microcontroller in my last two projects. Used relay logic for one, and an LM3914 in the other. Started work back on a BLDC driver though, I’ll need to mess around with 32-bit MCUs for the first time to get that working, so I’ll post about that in a month or so.
At least we can keep the thread bumped with arduino hatred.
>>
>>2802510
I need to run 4 arduino input / output wires 50 yards. 5V going through them max, need no signal loss. Using CAT6 Ethernet cable atm. What are my other options?

> waterproof
> no signal loss without repeater bullshit
> can be rolled up, stepped on, cows might shit on it
>>
>>2804613
What kind of current draw? If no power is needing to be transferred (i.e. there’s a power source at both ends), I’d want to add differential pair transceivers on each end, with termination resistors to keep the line impedance low. Like RS485 or whatever. That would use up all 8 wires in your cat cable. But if it works as-is then I probably wouldn’t worry about it. Run it through conduit if you want something stronger, or use that double layer insulated outdoor rated cat cable.
>>
Have any of you successfully connected an ESP32 or nrf52840 that is emulating a keyboard to a PS4 console? I keep trying and it tells me it's not supported and then I change the vendor and product IDs and it gets me to pair it before it tells me that it's unsupported. Any advice on libraries or options?
>>
Any of you fucks have experience with using rust (inb4 troon) on an esp32?
>>
>>2804751
What does that even mean? You want to compile and edit and run on the esp?
If just run compiled, the existence of mrustc—turning your rust code into C—and using that would pretty much solve your problem.
Then, once you have the resultant C code, delete the original rust code and maintain it C as you should have in the first place.
>>
>>2804737
I bet it doesn't like your report descriptor.
And I am not going to help you with it because I haven't touched that shit in years.
>>
File: IMG_0984.jpg (1.98 MB, 1170x1551)
1.98 MB
1.98 MB JPG
>>2802510
What’s OPs image? I see the pi, the arm, the sd and the leds plus the nip characters. Some kind of serial interface/led light chaser?


Here’s mine latest. Paper speaker, lm386 and some 555s made baby’s first synth today. Worst speaker I ever heard and I cooked one timer trying to pull too much current when the amp didn’t work but it makes lights and sound and there’s only room for improvement.
>>
>>2804871
Hooking the fan up in place if that “speaker” would orobably sound better.
>>
>>2804751
Why would anyone want to use rust on embedded? I am not saying use C++, just use C
>>
>>2805061
Memory safety I guess, but all these examples of managing hardware (which are "singletons" to desktop brain damage programmers) with the retarded Rust ownership model makes me not want to take them seriously.
>>
>>2804905
I don’t see how? The pulses that drive the speaker wouldn’t be enough to get the fan going and spinning is not the same as oscillating. I do however have my eye on some audio exciters that should shake things up.
>>
>>2805338
No, but the fan doesn’t have to “go” it just has to vibrate and the blades act as the “cone”.

This was an actual product from a few years ago, except it was an actual spinning fan that could impart the audio through the fan blades.

>>2805086
> memory safety
Heh, I see singletons as more of a new name to “global variables” but the cargo cultests follow the “globals are evil” doctrine without understanding how computers work.
Embedded and microcontrollers bring you a lot closer to the computer. The C++ and Rust people are out of work theoreticians and neither one ever had any practical value except to be different and sell O’reilley nutshell books. And maybe for dummies books. That’s why they’re constantly adding and changing shit.

If you want memory safety, look up MISRA C rules and valgrind. Ultimately, they’re just bugs, and it’s up to you to fix them by whatever means necessary.
If you look through he gnu C standard library, like half of it is written in assembly to take advantage of SIMD anyway. Only works with long strings, the setup and checking sometimes takes like 100 clocks, so it’s worthless. Hopefully the compiler can figure out if it’s a “long haul” sized string or can fit in an m_128… oh it can’t? Well, so much for that.

I dropped rust when I updated the compiler and it kept crashing. The compiler itself is written in rust. It’s worthless, and it told me so by dumping core.
>>
Is it possible to make a somewhat useful computer with a P8X32A?
>>
>>2805663
>I dropped rust when I updated the compiler and it kept crashing.
I bet that's because they use LLVM, a C++ project, to do the real work at code generation, and some API or ABI incompatibility got them.
>>
I learned C intending to get into programming some stuff, but ended up using other dev environments instead. Is there much difference between regular C and embedded C, and can I use it on any old microcontroller? I'd love to give some electronics projects a try, since that kind of low level, simple programming looks like fun.
>>
>>2806396
theres not really any fundamental differences in syntax. however things like dynamic memory allocation, multithreading/processing, networking are just a few of the things that dont work out of the box on a mcu. instead those features are chip specifc and may use different function names and have other limitations
>>
>>2806449
To start with I'll only be doing basic shit like a light controller or a garden watering monitor. Is it possible to use assembly to program mcus as well?
>instead those features are chip specifc and may use different function names and have other limitations
I guess as long as the documentation is good I'll be fine.
>>
>>2804828
Anon, I will give you the finest PP touch that a straight man can send over text if you at least point me in a direction that isn't "sucks to suck, faggot."
>>
>>2806452
Assembly is usually preferred on smaller mcus.
You can almost always emit assembly code from your C code. Everything used to work that way until idiots became involved.
Even microsoft C++ could do this and you could assemble the output it with masm. Up until 2016 or so, but then they said “the asm might not complie any more” … but the microsoft boat is adrift at sea with no captain and infested with pakleds.

If you write it in assembly, and you gave trouble with something, sometimes it’s helpful to “cheat” and see how the compiler emits the code for it. Maybe you want to copy it verbatim, but more likely you can cut it down by two thirds… it’s a little chatty sometimes and does useless checking or saves registers you don’t care about.

CISC cpus were more designed to be programmed in assembly, back when they cared about that stuff. RISC CPUs, not so much… this culminated in the Itainium, the ultimate expression of RISC and the futility of the endeavour. Thank god it never made it to the embedded arena but the lesson should be observed from a distance and learned from.
>>
>>2806396
Read a microcontroller datasheet to see what you might be getting yourself into. I recommend an older AVR like the popular ATmega328P. It has both assembly and C code examples, though I prefer how the later AVRs handle their I/O ports.

The relevant assembly manual may also be useful, if just to see what instructions the part you've chosen has. Whether it can do hardware multiplication or division, floating point, etc. Whether it can bit-shift multiple bits at once, or just one at a time. Whether it has instructions for easily reading longs from adjacent registers, or if it can read-bitwiseop-write a register in a single clock cycle. Additionally, and this may be in a different document, how many clock cycles it takes for things that don't have instructions, like different multiply and divide routines from different optimisation levels. The kind of stuff that's important for optimising code.

I'd also check out Ben Heck's videos where he programs an ATtiny10, a chip with 6 pins, 1kB progmem, and 32B RAM, to run space invaders. Surprisingly entertaining.
>>
Hello /MCG/ is there a better, high IQ way to talk to individual pins on a shift register than just to specify every bit digit individually?

(I'm too embarrassed to ask chatgpt again)
[code]
#include <SPI.h>

/*Define the pins we are using on the Arduino Board and
cross reference them with the pins on the Shift register
so you can give them appropriate names*/
int latchpin = 3; // chip select
int datapin = 11;
int clockpin = 13;

byte shiftLED1 = 1;
byte shiftLED2 = 2;
byte shiftLED3 = 4;
byte shiftLED4 = 8;
byte shiftLED5 = 16;
byte shiftLED6 = 32;
byte shiftLED7 = 64;
byte shiftLED8 = 128;


void setup() {

SPI.begin(); //Start the SPI library
SPI.setBitOrder(MSBFIRST); //Set LSB as bit order, this means we will send the least significant bit first and it will be written to Q7 = Register Pin 7 with the most significant bit being written last to Q0 or Pin 15
/*Configure the Arduino pins we use as OUTPUT, so they can send
data to the Shift Register
*/
pinMode(latchpin, OUTPUT);
pinMode(datapin, OUTPUT);
pinMode(clockpin, OUTPUT);

delay(50);
}
void loop() {
digitalWrite(latchpin, LOW);

SPI.transfer(shiftLED3); // Send a test byte

digitalWrite(latchpin, HIGH);
delay(0); // 1 second delay to observe changes

digitalWrite(latchpin, LOW);

}
[/code]
>>
aah how would I even iterate a for loop this way?
im brain ded
>>
>>2806527
you need a "shadow register"
add a variable to keep the state of all your LEDs, turn bits off and on in that, then send it out to the shift register
>>
>>2806527
Instead of
>byte shiftLED1 = 1;
>byte shiftLED2 = 2;
>byte shiftLED3 = 4;
it's more common to see
>byte shiftLED1 = 1<<0;
>byte shiftLED2 = 1<<1;
>byte shiftLED3 = 1<<2;
Of course, you should call them LED0-LED7, not LED1-LED8, for more clarity. I'd also use the term "bitmask" (or "bm") instead of "shift" when labelling these variables.

But better than that is to use the bitmasks that come along with the register data in the header files that the compiler uses. I don't actually know where to get human-readable names for these bitmasks, I see them in tutorials and code that MPlab wizards create for people, and in examples in datasheets, but nowhere in whole. They make more sense with status registers, here's an example:
>/* Write logical one to WDCE and WDE */
>WDTCR |= (1<<WDCE) | (1<<WDE);
Where WDCE is bit 4 of the Watchdog Timer Control Register WDTCR, and WDCE stands for Watchdog Change Enable. The actual constant WDCE is just "4", it's intended to be used to bitshift for bitwise boolean setting or unsetting of bits. For I/O ports specifically, here's another example:
>/* Define pull-ups and set outputs high */
>PORTB = (1<<PB7)|(1<<PB6)|(1<<PB1)|(1<<PB0);
>/* Define directions for port pins */
>DDRB = (1<<DDB3)|(1<<DDB2)|(1<<DDB1)|(1<<DDB0);
Here, writing "PB7" is the same as writing "7", but it's more clear.

The arduino IDE uses something similar but more removed from the user and less flexible, it uses a selection of functions to calculate which bitmask of which port a given "i/o pin number" is, e.g. arduino pin 12 = port B, bitmask 0b00000001. It's fine for static use cases as it all gets precalculated at compile time, but if you're trying to iterate through several pins it becomes extra bloat. See:
https://forum.arduino.cc/t/get-portx-from-arduino-style-pin-number/469729/8
If you want to optimise code portability (e.g. in a Marlin compiler) then using this sort of function may well be desirable. I don't know how to use it properly.
>>
>>2806539
>>2806527
also i misread your entire question but i think it's not entirely out of place
>>
File: media_F9a1YYDXQAA4h5k.jpg (43 KB, 960x960)
43 KB
43 KB JPG
>>2806539
Ok anon. I didn't really get it. but thanks for your effort anyways.
I asked chatgpt where I learned about bitshifting. I feel retarded for having everything spoonfed but I guess I also learned something new:
https://pst.moe/paste/gyenln
>>
Getting ready to start a phone alert security project with esp32. Sensors are of the 433mhz sort. I’ll figure out the hardware stuff but I’m confused about the pushing of notifications. Looks like a lot of options. Was going to try and learn MQTT and use mosquito but I’m not sure if that’s the best route.
>>
>>2806539
> byte shiftLED2 = 1<<1;
Except you shouldn’t make a variable for a constant. I’ve worked with microcontrollers that are 128 bytes of memory and you don’t want to trust the compiler to optimize that out.
>>
>>2806482
That's really good to know, I'm kind of hoping to build up enough knowledge to eventually make my own 8-bit microcomputer clone, but first I need to get a grasp of the basics. Having watched the Ben Eater 6502 videos, assembly seems like an interesting way to program.

>>2806520
I've got a few 328Ps and a 2560 that I need to dust off and put to use, then.
>Ben Heck
I'll definitely give that a watch, thanks anons.
>>
>>2806785
Well I'm pretty sure that will get consistently optimised out, but I can feel some of that apprehension. Is #define the better way to go?
>>
>>2806662
Mqtt implies the need of having a server, if you want to keep it simple just set it up to send emails or telegram messages
>>
>>2806530
What is your expected result and what do you get instead?
The loop condition won't end as the "i" counter isn't ever increased, but instead the test byte (?) "shiftLED".
>>
>>2806530
>for (led i = 0; i <= 255; testLED++)
should probably be
>for (int i = 0; i < 256; i++)

Then increase testLED inside the loop, either directly after usage or at the end. If that's even what you want done?
>>
>>2806543
>asked chatgpt
Pick up a book or find a bootstrap example. No one sanitize the output of AI and it is frankly rude comining with
that crap and asking others to do it for you.
>>
>>2806543
>asked chatgpt
Don't forget to kill yourself, low IQ retard.
>>
>>2806530
>delay(0) // 1 second delay to observe changes
>>
>>2806894
> use #define
Most certainly. Always use the simplest tool that accomplishes the task.
Also, assembly typically uses macros as well, so it’s easier to adapt. I sometimes prototype fluffy things in C and then rip out the assembly code and optimize it.
A lot of microprocessors have special instructions that you can sometimes take advantage of.

Microsoft’s C++ template system used the C preprocessor to work, which was kind of funny when it was discovered since the C++ theoreticians and neo-purists hated the C preprocessor without realizing #include was just that.
>>
>>2806931
Thanks, I’m an aspiring boomer that’s never used telegram either but I’ve already got a new bot so that was pretty easy. What’s my exposure puttying WiFi credentials into the arduino IDE and sending a hello world message from the ESP32? Are the hackers going to come in through my back door?! Any steps I can take or concepts I should explore to protect said back door?
>>
>>2807040
>t. born with intrinsic knowledge of everything
>shitposts on a Tibetan homesteading forum
nice
>>
>>2807201
Just don’t hook up your dev env to the internet. Simple.
>>
>>2807207
Development environment? Is that the same as arduino IDE because the machine running that is connected to web. Is there a sandbox or something that should be involved? Also what’s the secret to flashing these fucks. I swear I’ve done it before but I’ve got 8266 and 32WROOM and between the two I can’t figure out why the ESP8266WiFilibrary won’t work or if the flash/boot button pulls pin 0 low or how long I’m supposed to do that. At least I keep getting different errors.
>t.ignorant, please spoonfeed.
>>
>>2807435
> dev env == arduino ide
So, it depends on the microcontroller. For the older architectures, you can get by with an old 386.
So what do you have on there?
Editors, compilers, debuggers, emulators, eeprom burning stuff, now writes flash instead, telix, serial ports, rs232 to uart box, parallel ports, your pickit2 or whatever. It’s sometimes useful to have a few dev microcontroller dev boards to handle things like i2c, spi, gpio, d/a and a/d converters, or maybe a raspberry pi or latte panda for usb stuff. Or, maybe you want a pentium if you’re doing Usb.
>>
>>2803735
its summer in the US, alot of people would rather be outside, than cooped up inside doing electronics.
>>
>>2807482
It’s already too hot out.
This is peak basement-dweller productivity time.
>>
>>2807444
Checked. although took too many neurons to figure out you’re probably suggesting I use an old dedicated machine with no internet connection. If so, good advice and I imagine anything else is beyond my scope. Currently I think my usb cable is charge only because I cut up the other ones to use for powering leds.
>>
File: GOPuOKfXYAA2FAV.jpg (63 KB, 800x463)
63 KB
63 KB JPG
>>2802510
How do I charge esp32-cam with a lipo battery?
>>
>>2807035
>it is frankly rude comining with that crap and asking others to do it for you.
Reading back on the post it does sound kinda rude, but wasn't intended to be. I didn't really understand the entirety if Anons post but he led me in the right direction with bitshifts and the code example chatgpt provided was genuinly helpful.
>>
File: ring-doorbell-4-1.jpg (98 KB, 1200x900)
98 KB
98 KB JPG
Hi /mcg/

Doing my first ever electronics project:
a doorbell camera.

Saw a video on the esp32-cam and it looked simple enough.
Have ordered bits from aliexpress.

Wish me luck.
>>
>>2808390
>run esp32-cam from lipo

From https://www.dfrobot.com/product-1879.html
>Power supply range: 5V

You could step up your 3.6v lipo to 5v using a step-up/boost circuit.
Or step down 7.2v (2 cells) to 5v using a linear regulator.

>charge lipo
If 1 cell then maybe tp4056 ?
If 2 cells then I don't know.
>>
>>2804737
Does it work against your pc ?

Here's a video showing an oscilloscope-level view into usb keyboard stuff
https://www.youtube.com/watch?v=wdgULBpRoXk

It does briefly talk about the usb from 27:58.
>>
>>2808583
>It does briefly talk about the usb setup from 27:58.
Fixed.
>>
>>2808583
I thought the point of that video was to show that PS/2 keyboards and mice were simple and worked well, and USB started off as a disgrace, and went downhill from there.

“let’s base the USB supply voltage on TTL logic since that will be around forever and will only become more popular”
>>
>>2808610
That must be some other video.

He spends the bulk of this video looking at traces and decoding by hand what is being sent between computer and keyboard.
>>
File: 4alfIoAL.png (1.3 MB, 1792x1024)
1.3 MB
1.3 MB PNG
Here's some AI kino that got posted in this SO thread:
https://electronics.stackexchange.com/questions/715517/artificial-intelligence-in-pcb-component-definitions
>>
File: 1694612826682375.webm (1.65 MB, 608x1080)
1.65 MB
1.65 MB WEBM
>>2802510
>have a need for an analog/digital io block to can bus module for attaching various signals to and making them available on the can
>find no products or even projects that do just that
>"fine... I'll do it myself"
>stm32, can bus transciever, 8 channel optoisolator for inputs
>find some basic example code off ST's website and strip it down further to build off of
>whole thing done in 3 hours

>want to expand the project a bit
>want to pull in data from a 1-wire bus
>one project exists for it
>doesnt compile
>bullshit OOP issues
>get fucked

FINE ILL DO IT MY FUCKING SELF AGAIN
why is everything hard and make me learn how to just solve it myself instead

3 year old code on github, load the .ino, put the header file in the right folder, click compile, dozens of undefined reference errors.
clearly the code worked at one point, and 3 years later it doesnt. why
>>
>>2809111
People like myself, and probably yourself, that are pro-grade, don’t vomit their failures on github, and don’t have time to write books about it either (back when those were a thing)

I’ve seen shit on github that’s so bad, I’d have sworn they were planted by our competitors to fuck us up. You can even find stuff that basically implements security holes and could damage d to a attached equipment, like all lines locking-up hi simultaneously due to bugs when they try and bit bash a 3ph motor signal.

Of course, this cesspool of github detritus is what a lot of the code-writing AI feeds from. Might as well have someone from india do it.
>>
>>2808583
Yep, it works perfectly on PC. But I know that the PS4 only supports a few Bluetooth keyboards. My goal is to figure out a way to spoof one of those keyboards.
>>
>>2809118
But they have working examples in videos and they are white American. I think it is a case where the code works on their machine or worked 3 years ago
It's only a few hundred lines of code anyway so I can just simplify it and de-oop it until it works perfectly as all things do. It just doesn't help that I'm low int on c++
>>
>>2809126
> low int on c++
I’m high int, I started decades ago on cfront.
After too many decades, I realized that oop and c++ is bullshit, and is made worse with every new c++ misfeature that out-of-work theoreticians put forth because they’re academic and not practitioners (who are too busy getting things done). There’s a few neat tricks and whatnot in c++ over C, but nothing very extraordinary.
Could be worse though… python comes to mind.
> de-oop
Good. You’re ahead of the game.
>>
>>2809119
> ps4 bluetooth keyboards
I find that all kinds of devices randomly support/or don’t work at all on random bluetooth keyboards.
Some can’t even see them to pair. But it’s random, across apple, PCs, laptops, PS3/4, etc, and all kinds of bluetooth keyboards both big names and chiwanese knock offs.

The worst thing is when you have to go dig out the original controller to use that stupid pad thing in one random place where sony paid-off the game devs just to include it somewhere in the game to make it artificially relevant.
>>
>>2809111
>.ino
there's your problem
assuming your stm32 actually has hardware 1-wire support, it should be pretty easy to just read/write the registers in the right order and shuffle data like any other comms hardware
if not, you can bit-bang better than a tarduino
>>
File: race ya.jpg (378 KB, 1024x709)
378 KB
378 KB JPG
Give it to me straight bros: what's the minimum voltage you can run a Arduino Nano at? ESP2866? Surely you can run it on a single button cell? All I get is "but you wouldn't do that, you would run it of AAs"
>>
>>2809189
read the datasheet
>>
>>2809184
It might have some hardware, but I'm using it for hardware can support
It just level shifts to 3.3v and goes in an pin.
I don't have to transmit so I can really strip it down
>>
>>2808557
You’ll need more patience than luck. Following a video is almost retard proof just don’t get mad when you start coming to terms with how retarded you are, like most things it will be an opportunity to be less retarded. I believe in you Anon.
>>
are there any cheap FPGA dev boards like the icesugar line, but that actually have a serdes?
>>
File: 1.jpg (352 KB, 1600x1064)
352 KB
352 KB JPG
>>2802510
Will I be able to play a 4gb .mp4 video file even though the pi 3 B has 1gb of ram? I need to convert a raspberry pi 3 B into a media player, with composite video/audio coming out of the 3.5mm jack. I have an understanding on how to configure the 3.5mm jack, but I also need a script to have the device launch a running media player app upon startup. Can I get some help on where to go to find a script like this, or where to find a how-to for a project like this? Big thanks in advance for any help you can provide. I'm hoping to have this running by Saturday for a video art installation.
>>
>>2809493
>Will I be able to play a 4gb .mp4 video file even though the pi 3 B has 1gb of ram?
Sounds fine.
Bits of the .mp4 will be read from usb drive as they are needed.

>need a script to have the device launch a running media player app upon startup.
(1) install raspberry os to sd card
(2) confirm install by booting your raspberry pi from the card
(3) poke around the desktop and see if you can get it to play your .mp4 file at all
(4) poke arounds settings to see if you can boot without login or password straight to desktop
(5) poke around settings to see if you can get it to launch a program as soon as you login, eg: a web browser
>>
File: 2.jpg (405 KB, 1600x1064)
405 KB
405 KB JPG
>>2809501
I found an install (Video Looper) but I can't get config.txt settled so the pi outputs a working NTSC 4:3 signal. I tried sdtv_mode=0 and sdtv_mode=16, and neither are working. The config.txt also said to uncomment the sdtv section for PAL. I commented the section and no clear picture. The pi boots up and my tv displays a messed up NTSC signal. Any ideas? I'm using a 3.5mm headphone jack RCA splitter and I have the composite cable plugged into the correct jack port.
>>
File: 3.jpg (449 KB, 1600x1064)
449 KB
449 KB JPG
>>2809536
I think I figured it out. My 3.5mm RCA adapter isn't the right style for a raspberry pi.
>>
File: OSMC.jpg (107 KB, 1202x734)
107 KB
107 KB JPG
>>2809493
>also need a script to have the device launch a running media player

you can install an OS that contains just a media player
best is LibreElec, second best is OSMC
(or OMXPlayer if you prefer a geeky command-line experience)
https://www.youtube.com/watch?v=ngGkVd-_LP8
>>
>>2809493
>Will I be able to play a 4gb .mp4 video file even though the pi 3 B has 1gb of ram?
The total size of the video doesn't matter shit, because it will be streamed from the storage media. What matters is how the video file is encoded (resolution, codec profile), and how the player manages memory.
>>
>>2809493
Every media format since caveman times has been readable incrementally, instead of having to load the entire thing in ram. The rest is up to how your media player handles things, it should be fine if it’s not potato coded.
>>
>>2809961
> potato coded
Reading everything into memory has been commonplace among the retards that infiltrated 90% of sw devs for the last 15 years at least.
>>
>>2810000
checked quads of truth
>>
>>2809493
>that pic
What is this thing? Tried various terms in google and I can't find anything like it.
>>
>>2810388
https://youtu.be/pbpFgvttBZw
>>
>>2810388
>he doesn't know about eurorack synths
>>
And idea what I'm missing here. I'm expecting TX to idle high, but it's not. (SAMD21E18A). Pullups? idk..


void UART_init(void)
{
uint32_t u32_baud = 36000;

// Configure pins
IO_pin_gpio_init(IO_PIN_PA24); // init TX
IO_pin_gpio_init(IO_PIN_PA25); // init RX
IO_pin_pmux_enable(IO_PIN_PA24, IO_PERIPHERAL_FUNCTION_C); // Enable peripheral function for pin TX
IO_pin_pmux_enable(IO_PIN_PA25, IO_PERIPHERAL_FUNCTION_C); // Enable peripheral function for pin RX

// Enable the peripheral bus for SERCOM3
PM_REGS->PM_APBCMASK |= PM_APBCMASK_SERCOM3(1);

// Use GCLK 0 to clock SERCOM 3
GCLK_REGS->GCLK_CLKCTRL = GCLK_CLKCTRL_GEN(GCLK_CLKCTRL_GEN_GCLK0_Val) |
GCLK_CLKCTRL_ID(GCLK_CLKCTRL_ID_SERCOM3_CORE_Val) |
GCLK_CLKCTRL_CLKEN(1);


SERCOM3_REGS->USART_INT.SERCOM_CTRLA = SERCOM_USART_INT_CTRLA_MODE(SERCOM_USART_INT_CTRLA_MODE_USART_INT_CLK_Val) | // Use internal clock
SERCOM_USART_INT_CTRLA_CMODE(SERCOM_USART_INT_CTRLA_CMODE_ASYNC_Val) | // Async mode
SERCOM_USART_INT_CTRLA_DORD(SERCOM_USART_INT_CTRLA_DORD_LSB_Val) | // Send LSB
SERCOM_USART_INT_CTRLA_RXPO(SERCOM_USART_INT_CTRLA_RXPO_PAD3_Val) | // Pad 3 for RX
SERCOM_USART_INT_CTRLA_TXPO(SERCOM_USART_INT_CTRLA_TXPO_PAD2_Val); // Pad 2 for TX

SERCOM3_REGS->USART_INT.SERCOM_CTRLB = SERCOM_USART_INT_CTRLB_SBMODE(SERCOM_USART_INT_CTRLB_SBMODE_1_BIT_Val) | // Single stop bit
SERCOM_USART_INT_CTRLB_RXEN(1) | // Enable RX
SERCOM_USART_INT_CTRLB_TXEN(1) | // Enable TX
SERCOM_USART_INT_CTRLB_CHSIZE(SERCOM_USART_INT_CTRLB_CHSIZE_8_BIT_Val); // 8 bit char size

SERCOM3_REGS->USART_INT.SERCOM_INTENSET = SERCOM_USART_INT_INTENCLR_TXC(1) |
SERCOM_USART_INT_INTENCLR_DRE(1);

SERCOM3_REGS->USART_INT.SERCOM_BAUD = u32_baud;

SERCOM3_REGS->USART_INT.SERCOM_CTRLA |= SERCOM_USART_INT_CTRLA_ENABLE(1);
}
>>
>>2810757
> uint32_t u32_baud = 36000;
> SERCOM3_REGS->USART_INT.SERCOM_BAUD = u32_baud;
Why is this a variable?
>>
>>2810898
It makes it easier to track in gdb, you pedantic twat
>>
File: its_cheaper.gif (2.79 MB, 520x250)
2.79 MB
2.79 MB GIF
What is the cheapest SBC out there that can hold "full" linux (kernel + some networking)?

Raspberry Pi Zero 2 W is $15, but can we find something for below $5? Specs can be worse.
>>
>>2810945
> linux
The real goal should be running something like bsd 2.11.
>>
>>2811006
To be honest, linux is not a hard requirement, as long as it has networking stack and can communicate with ethernet camera
>>
>>2810757
do you have a device connected to it or are the rx/tx lines floating? im pretty sure the "idle high" is actually done by the receiving end not the transmitting end.
>>
>>2811125
I have them being passed through my debugger. TX lines are typically pulled up by the transmitter. Receiving devices expect their RX line to be pulled up by the transmitter. Could also be the case that there's some peripheral muxing problem. Not sure. Will take another crack at it tomorrow. Let me know if anything comes to mind
>>
>>2810945
>What is the cheapest SBC out there that can hold "full" linux (kernel + some networking)?
>Specs can be worse
You phrased that a bit retarded. What's your tasks/requirements? What are you trying to accomplish?
Is it for personal education? => Better buy popular board, you'll get more options later.
Is it one board only project? Can you (re)use old board? => Buy a used router (check OpenWRT support though).
Why do need GNU/Linux at all? You can use networking on more simple OSes. => STM32, ESP32 etc support networking almost natively
>>
Programmer here, not new to microcontrollers but don't have a lot of domain knowledge.

>friend has idea for product
>pick up Xaio ESP32-C6 to prototype it
>oldered on a battery
>blink program killed it in a few hours
>want to start experimenting with the deep sleep mode to try and squeeze more life out of it
>need visibility into the battery state

I know I can basically read the battery voltage as a close approximation of battery life, but all my searches have returned no results on how to do this or if there's a nice battery info package.

I know some of these pins are analog, so is it as simple as just reading one of the analog pins with nothing connected to it to get the voltage and doing some math, or is there some electrical concept (voltage drop? idk) that makes that flawed? What is the proper google search terminology to figure this out?
>>
whats the easiest, least bullshit way to add a ntc thermister to a stm32?
any simple built in functions or some simple code I can use? I dont want to use some bloated 3 file 1200 line abortion to read the fucking outside temp, especially when it gets condensed down to the same damn fucking shit in machine code no matter how autistic you write it
>>
>>2811382
If you don't want to use shitty third party code written by idiots (like most "driver" code in embedded seems to be), you need to do it yourself. First get the shitty third party code to work to make sure the hardware works. Then either write your own code by reading the datasheets, or minimize the third party code by removing all bullshit.
>>
>>2811351
Okay I figured out how to do this I'm just reading A0 and doing some math, but I am unable to upload sketches while connected to both battery power and USB power. If I disconnect the battery, it works, if I unplug it then reconnect my battery, the sketch works.

Anybody know why this might be?
>>
>>2811405
I think i figured it out already
>buy TPM36
>analogRead(pin)
>>
>>2811415
>voltage linear to temperature
I guess that works, if your ADC is good enough.
>Ardushitto API
Die.
>>
>>2811418
12 bit adc, it's temperature, it does not matter.
>ardushitto
Nigger it's a stm32
All I am doing is getting the pin value to however many decimal places, and sending that value over can bus.
>>
>>2811421
analogRead is Arduino convention. I thought maybe they ported it to stm32. Most C devs would probably prefer this_convention.
>>
>>2811425
I'm sure there's some other method like HAL_Get_Pin or something like that but I just don't care, I already do digitalRead for other functions and it just werks
>>
>>2811421
>>ardushitto
>Nigger it's a stm32
"Wiring", "Processing" and other arduino-like APIs are not confined to the AVR chips
>>
>>2811406
posting a schematic of how youve wired it up might help for a start
>>
>>2811351

Battery capacity voltage/capacity curves are very non-linear and differ by chemistry, size, etc. On top of that, you can discharge a battery less (i.e., set your "0%" to a higher voltage) to get more lifetime charge/discharge cycles out of it. In most consumer devices 0% is definitely not 0% on the cell.

The easiest thing for you to do software wise is add a discrete fuel gauge IC. It will do the compensation, filtering, measurement, etc. that you need. Do a search for "fuel gauge," pick your flavor, TI, analog devices, etc. Follow integration manuals for those components because measuring voltage affects the voltage, which affects the curve, which affects the measurement, etc. If your MCU is running and you really care about battery life, that means there is a load on the cell that will affect the voltage you're trying to measure. A discrete IC gets around this.

You may also want to look into cell characterization, that's the process by which you work out those curves for your particular cell/load. If you are doing a production part you'll want to do some testing to figure out how to squeeze the battery life you want out of the power budget you have.
>>
>>2811351
>>2811611
(2/2)

As for software, different peripherals of your MCU will have different current draws; if the datasheet is good they will tell you. But in general, you want the MCU to be in the deepest sleep it can be while preserving the state that you need for your application (many can power down SRAM but only partially, for example) Your RTOS also probably has configuration options that will sleep the processor to various degrees when entering the idle task, for example; the tradeoff is that there's some latency to wake back up.

Having the CPU running, or a lot of RAM, is expensive power wise. So it's better if you can to do e.g. DMA, or batch sensor reads so that a SPI line can be kept "on" for only a short time, instead of waking it up a bunch of times every time a tiny amount of data comes through. For that ESP, the Wifi and BLE radio are very very power hungry peripherals that you should keep alive as infrequently as you can manage. Techniques like that. And, choose your MCU well. Keep your memory footprint as small as it can be. Not sure about the ESP32 family but MCUs come in various flavors, one of which is usually a "low power" version which is designed with good sleep current draw and fewer power-hungry peripherals.
>>
>>2811406
The pixies line up and march from the negative of the battery, through your MCU, to the positive of the battery. Your MCU measures how energetic they are on the positive side by having them flow from ground into a capacitor inside the MCU and then timing how long it takes for the voltage to equalize.

So if you connect a USB, your MCU starts drawing power from that, and the pixies don't really know where to go. Why would they go towards the cell when they can just go towards the higher-voltage USB port instead?

That's why it works only one way.
>>
I'm logging data to a csv files on an sd card (esp32c3 sdspi), do I have to worry about synching the fat filesystem or at least blocking the main loop if the 5V starts to sag?
>>
>>2811751
esp32s are a 3.3V device so it hardly matters. why would your 5V line "sag"?
>>
>>2811806
Because I'm unplugging it to turn it off.
>>
>>2811807
Don't do that
>>
>>2811807
well thats fine when you are not dealing with external memories or internal flash writes. but since you are, you should explicitly finish all transfers and unmount the memory before turning it off. most actual devices that datalog have a battery backup if the main power source is lost, and it will kick in and allow the device to turn itself off properly
>>
>>2812001
I was hoping that a smallish capacitor (500uF) would last long enough to do the File::sync_all(). Another way it can go wrong is if somebody ejects the SD card without powering it down.
>>
what microcontroller (programming) and frameworks/tools/standards should i learn if I want to get into automotive embedded programming?
>>
>>2812541
It depends on what you mean by that.
MISRA, obviously, for that high level C fluff.
The tesla still uses the ‘ol MC68HC11 in places.
>>
File: file.png (1.42 MB, 1280x720)
1.42 MB
1.42 MB PNG
i have stm32 blue pill and stlink v2 and i need to program a bios chip and i've tried flashing it with this program to use it for that
https://github.com/dword1511/stm32-vserprog
but i can't get through with it because my PC doesnt detect /dev/ttyUSBxxx nor /dev/ttyACM etc.
i've tried on Xubuntu liveusb and still no luck, my regular install is nixos and my user is in flashrom group
the jumper is on 1 on BOOT0 and 0 at BOOT1
i am an absolute beginner
>>
>>2812751
>beginner
Then you may be interested in knowing that controlling serial lines directly requires some special permissions, at least on Ubuntu. You don't need root, it's just standard Linux shit about adding random lines of text to random config files. That's the way i remeber it at least. Try it
https://askubuntu.com/questions/58119/changing-permissions-on-serial-port#58122
Idk if this is your exact issue
>>2812719
Misra, right
Fanks
>>
File: IMG_1368.jpg (879 KB, 4032x3024)
879 KB
879 KB JPG
having trouble with RPI interrupts:
i was on here a while ago asking if a RPI could handle GPIB. i bought a board, installed the drivers, and was able to successfully transmit a message to my oscilloscope. reading from the scope, however, is not working. i send "*IDN?", which asks for the name of the device, and i get back "T" (the first letter of "Tektronix"), but nothing else, and the Pi times-out waiting for EOL. the scope shows the DAV (data available, active low) line going down several times, but the interrupt routine in the kernel module (which gets the interrupt with request_threaded_irq()) is only being called once. im not sure how to proceed. any ideas?
>>2802510
hey, its my image! thanks for saving it! btw, the LCD says "lolicon".
>>2804871
its an STM32L462 (or something like that). i bought one and tried to get it to do something just to see if i could (and also to learn how MCUs work under the hood). the reference manual was like 1600 pages long and it took many nights just to get an LCD to blink. the Pi (same one in pic rel!) uses SPI to program it and it uses UART to get output. i got printf() to output over the UART controller, quite proud of that one. the LCD is controlled with some hardcoded GPIO stuff. i never got the SD card to work, not for lack of trying.
>>
>>2812771
i'm new to electronics, not linux
i can see the stlink device in lsusb but i dont have any interface in /dev/
not sure if that's a permission problem because i tried that on root
think i've had that same issue with my arduino
i dont know, i dont use ubuntu i fucking loathe how not streamline it is, they just change shit for the fuck of it
>>
>>2812772
>im not sure how to proceed. any ideas?
Get a USB logic analyser (or a second scope) to probe the lines and see if it is sending more letter than just the T, or if it’s waiting for flow control pins or a clock edge or whatever. Compare what you see to a handy timing diagram that I hope someone made already.

I did the same logic analyser snooping to figure out that my scope RS232 was actually a master that was to be sent to a plotter, and was carrying HPGL data. For that I used a cheap FX2-based unit.

>>2812776
Maybe /g/fglt will have some archaic insight for you?
>>
>>2812841
>Maybe /g/fglt will have some archaic insight for you?
they wont
i'm asking here because i wasnt sure if the jumper is set correctly or the device is fucked for some reason or maybe someone's used that program before
/g/ is just /v/ with gpus, we don't even discuss linux anymore
>>
>>2812841
>Get a USB logic analyser
dont have that
>(or a second scope)
do have that
>see if it is sending more letter than just the T
from what i can tell, it's sending the T, then it tries to send the E but the Pi never acknowledges that it receives it. this is backed up by 1) the debug menu on the scope shows that it tries to send both T and E, and then stops; and 2) the scope otherwise works fine with a USB GPIB adapter.
this discussion is kinda pointless for now because i reinstalled the OS on the Pi and now nothing works :c
>>
File: file.png (142 KB, 1368x751)
142 KB
142 KB PNG
>>2812851
the gpio_request_one() is failing on the first call. it was at least partially working before reinstalling the OS, but its fucked now. its also concerning that the function is apparently deprecated. i dont think any other processes are using any GPIO pins. not sure what to do.
>>
>>2812751
no. what you have is chink shit clones of "bluepill and stlink".
>>
>>2812876
ok i also have a chinkshit clone of arduino and it works fine, why wouldnt this
>>
>>2812883
because its much easier to clone. expecting any chink shit to work properly its just retarded. get some legit devices, verify your shit works, then roll the dice with chang
>>
>>2812861
What’s errno?
>>
>>2812911
iunno, errno isnt working in the kernel module for some reason.
>>
>>2812876
iirc stlink is an open source design so anyone can make and sell them
pretty good idea for making your products more accessible, especially considering the low price of the stlink
atmel can eat my ass im never buying an atmel ice or dragon

>>2812914
well i’unno either mate
>>
File: you.png (390 KB, 1080x1080)
390 KB
390 KB PNG
I thought i would use the day productively today and progress with the ARM Cortex course
I hit the point where I need a simulator now.
i've spend the ENTIRE day trying to make the simulator work but it tries to build something and then fails.
i have no idea what to do.
i fucking H A T E packages that you have to build yourself. Today is a wasted day thanks to those delays.
I'm going to jerk off to some porn, and then i'm going to the gym. fuck this shit.
>>
>>2813014
apt install qemu-system-arm

Getting it to work requires some fiddling if you're new to this.
I rarely need an emulator. I run everything local (on x86) or on a dev board. the only time when an emulator makes sense to me is when writing asm.
>>
I'm looking to make a battery powered device that can be controlled with an RF remote controller inside an apartment. The device will be idle for 99% of the time and during periods of activity I don't expect it to consume more than some tens of mA, and I want the battery to last as long as possible, preferably months to a year.
So, what I need is a digital radio protocol that can remain at a very low power consumption idle while still being able to wake up on radio activity, my understanding is that WiFi, BLE etc. will not work because they need to remain connected in a high power state to hear anything at all, does what I'm looking for even exist in a neat module or will I have to resort to a separate RX detector and all that?
>>
File: IMG_1371.jpg (475 KB, 1179x1636)
475 KB
475 KB JPG
>>2813029
>I don't expect it to consume more than some tens of mA.
thats a lot, low-power MCUs idle current is typically in the nanoamps. the IR receiver in pic rel has a typical supply current of 350uA. they probably make low-power IR receivers too.
>>
>>2813092
oh i can read lol. well you got your answer.
>>
>>2813093
fuck, cant type either, apparently.
>>
>>2813029
https://forum.allaboutcircuits.com/threads/low-power-ir-detection-circuit.115744/page-2#post-911606
guy on this forum reduced the IR detector current by a factor of 10 down to 35uA by cycling it at 7%.
>>
>>2813092
‘FT’ is the acronym for ‘Five volt Tolerant’ now?
That’s a disgraceful example of zoomerese.
Data sheets an app notes are going down hill.
> STM
As expected, about as much street cred as batteroo.
>>
>>2813092
Thanks, I was looking at RF remote controls so it's not so sensitive about directivity but those do seem like really good numbers
>>
>>2813029
Receiving only? Some sort of 433 MHz bullshit like zigbee or whatever would probably be my go-to, so long as the protocol does t require duplex. Ideally built into an MCU like an NRF something. LoRa is great for low power transmission but that’s not a requirement unless you want to really minimise the remote’s power consumption too. Even then it’s probably overkill since normal RF remotes last years on a 2032, and the NRF-based LoRa receivers are really expensive.

Also check out cnlohr’s latest video.
>>
>>2812541
QNX is somewhat popular, but its for chips with Raspberry Pi power, not microcontrollers.
>>
>>2810945
There's the Milk-V, a RISC-V board with an Arduino core on the side
https://www.youtube.com/watch?v=SeExddxWdNs



[Advertise on 4chan]

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

[Enable Mobile View / Use Mobile Site]

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