[ 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: 8 KB, 650x291, PIC12C508-Microcontroller.jpg [View same] [iqdb] [saucenao] [google]
1741001 No.1741001 [Reply] [Original]

Previously /amg/ - arduino & microcontroller general.

An actual some random anon who got tired of waiting for a new general edition.

Microcontrollers (esp32, blue pill, arduino, ...) & single board computers (Raspberry Pi, Banana Pi, ...) welcome.

>What to post
- Questions regarding microcontrollers & single board computers
- Discussion regarding microcontrollers & single board computers
- Projects you are working on

>What should I do with my [insert hardware]?
Look here:
https://hackaday.io/
https://www.instructables.com/
https://www.reddit.com/r/raspberry_pi/ aka everyone is making magic mirrors
https://www.reddit.com/r/cyberDeck/
https://www.adafruit.com
- This is not an idea thread. Check the catalog, or make a thread for it.

>Usefull resources:

>Software
Ki-CAD
Your chipsets default IDE

>General electronics, also check their OP
>>>/diy/ohm

>Questions regarding software/OS on single board computers, unless specifically about GPIO
>>>/g/
>>>/g/fglt

>I have junk, what do?
Get rid of it.
Old thread: >>1717706

>> No.1741008

>>1741001

News:
(because I still want an answer to my question)

Anon plays with tiny CRT
>>1718139

Anon has issues communicating with his Arduinos
>>1738992

Anon gets educated on multitasking with Arduino
>>1732281

Anon needs to know how to successfully attach interrupt and not have his interrupt interrupted on Circuit Playground Express
>>1740534

Anon plays with Vacuum Fluorescent Display
>>1740383

>> No.1741053

>>1732281
>https://learn.adafruit.com/multi-tasking-the-arduino-part-1/a-classy-solution
Are you sure the code is buggy and are you using that word correctly. What is happening when you try it. Each led has its own previousMillis variable and currentMillis. They arent sharing variables.

>> No.1741119
File: 92 KB, 640x937, 1577484957750.jpg [View same] [iqdb] [saucenao] [google]
1741119

Doing a presentation about them microcontrollers at work, in context of C.

What are the points I've might missed besides:
* 8bit vs 32bit
* Harvard vs Fon Neumann
* IO
* Schematics
* Interrupts
* Peripherals (SPI, I2C, UART)
* Timers
* DMA
* HAL
* FreeRTOS
* Debugging (with breakpoints)
* Hardware debugging (oscilloscope, logical analyzers, current measure)

As you can see I am ST shill so my example chip would be the blue pill

>> No.1741134

>>1741119
>2020-6 days
>not using 6502-based microcontrollers

>> No.1741147

>>1741119
> not using 8051-based mcus
I don't consider something as powerful as a raspberry pi as really capturing the essence of what an mcu is in practice.

> harvard
retarded, historical only, and probably not worth mentioning, many of our best and fastest algorithms use self-modifying code.

> no coverage of flash vs eeprom
> no coverage of self modifying code
> no coverage of polling loops and what real-time means (a large percentage of implementations, perhaps the vast majority)

> C
Thank christ you didn't start them off with that idiotic esspressniff python or lua thing.

>> No.1741148

>>1741008

Which one was your question?

>> No.1741151

>>1741148
The one regarding interrupts on the Circuit Playground Express. Thank you for asking. I feel like there is some witchcraft involved with interrupts on the SAMD21, and the Adafruit docs never go into that, in fact they push MakeCode and Circuit Python, it seems Arduino IDE support was almost an afterthought. I can accomplish the task at hand with a different board / processor, but now that I've run into this difficulty, I just really want to know the why of it.

>> No.1741167

>>1741134
>>1741147
If you really want to get weird and retro, I have a couple of windowed 8749 micros. I've had them since before I knew what the hell a microcontroller was (35-40 years ago) and I've always wanted to build/find a programmer capable of programming them and use them even if only to blink an LED. Why? Why not!

>> No.1741170

>>1741167
>6502 and its derivatives are weird and retro
okay zoomer

>> No.1741171

>>1741167
> blink an LED

They have UV LEDs now, you could place them above the windows and have the two µCs collaborate to write self-modifying code into each other's EPROMs.

Something for the display case in the foyer, next to the ST251 with the clear acrylic case that plays music, and the intel bubble memory demo.

>> No.1741172

>>1741171
>They have UV LEDs now, you could place them above the windows and have the two µCs collaborate to write self-modifying code into each other's EPROMs.
holy shit i think i just contracted autism from this

>> No.1741178

>>1741171
This is genius . I wonder how many erase / burn cycles those old EPROMs could handle? I think it was < 1000, we could find out....

>> No.1741179

>>1741119
FPU?
also
>ST
might mention SRAM/Flash sizes (and what you use them for, such as code vs static data), CPU speeds (400Mhz is not to be ignored if you are an ST shill). also low power modes. you may need to check the specs of their lowest power deep sleep modes, i believe their cortex m0+ chips are in the nanoamp range?
Also may want to cover various IDEs and debug probes.
>booting: boot loaders, booting from FLASH vs SRAM
>external memory/FSMC
>other important peripherals: DAC, ADC, USB
>real time clock
>ST specific: graphics accelerator, HDMI/LCD/TFT controllers

>DSP: ARM cortex specific SIMD/DSP instructions, CMSIS DSP library, FFT/FIR implementations etc. optimized form cortex m4/m7 etc

>> No.1741188

>>1741178

If you figure out the minimum uv energies and burn voltages, it's probably in the 10s of thousands. Kind of like today's under-clocking for long-term reliability. The other mcu can verify and up the led current/burn voltage as appropriate.

It was always some other fucker that was baking their eproms, so you just grabbed new ones all the time. Besides, you'd have to peel the foil off, ain't nobody got time for that. Had shelves full of them with buggy code, used them like PROMs and eventually chucked them after the project was over. Cheaper than an intern that just erased stuff for us. Should have written a simulator. Didn't.

>> No.1741203

>>1740534
>>1741151

> I changed the interrupt from digital pin 2 to digital pin 26

So, my first guess here is that you used an interrupt that was bound to an internal SOC peripheral, and not one of the EXTINT[0..15] lines, so the mapping may have had no effect and it continued to get interrupts for, say, the watchdog.

>> No.1741219

>>1741203
According to the charts at the Adafruit site, D26 is EINT-12 which is connected to the built-in peripheral on the board I wanted to access (IR decoder chip). I was thinking that maybe the board is set up in a way that there are timer interrupts set up that vector back into bootloader code somehow... almost like an OS or hypervisor... and that this is interfering with my code. Or is that crazy talk?

>> No.1741225

>>1741219

> set up that vector back into bootloader

Yes, that is common as dirt. It's done for reliability and to help defeat bugs. If there is software from multiple sources, sometimes they fight to establish themselves at the start of the interrupt chain (yeah... it's a chain... you are supposed to be nice and save the previous address and call into it when you're done, but the ppl that fight for the head of the chain are ignorant and write buggy code, so...)

>> No.1741229

>>1741178
The other problem I've heard of with EPROMs is that the erase time goes up with number of erasures.

In fact, even with fresh chips it would take too long for self-modifying code to be practical. You're looking at erase times measured in minutes.

>> No.1741236

>>1741229
yeah, it's not going to be literally running something like a burn-in of the self-modifying bresenham line algorithm, it's going to be more like:

If you're going to build a burner for it anyway, and you have two of those µCs, might as well make them symmetrical so they can program each other. One would always be running, even while the other one is in erasure.

>> No.1741270

>>1741188
>>1741171
>>1741178
I propose the construction of the world's first AI emo simulator. Use any microcontroller with UV window and a watchdog timer. Attach UV LED to one output, aimed back at the window. Attach display of some sort, random number generator, and a few sensors to detect light level, humidity, noise level. Attach solenoid connected to emo doll on gallows. Write program that selects a random number each day. and randomly complains about "too bright i here for my dark soul" and "all these people are too loud, I'm trying to read Dickinson". Sensors set the "mood", making the RNG more or less likely to return the number 666. If 666, turn on UV LED for x amount of time. X maybe be randomized a little as well. Eventually the emo AI succeeds in its mission as each attempt weakens it, and when watchdog is no longer reset due to program corruption, the solenoid triggers.

>> No.1741304

>>1741179
Thanks m8

>> No.1741305

>>1741147
> retarded, historical only, and probably not worth mentioning, many of our best and fastest algorithms use self-modifying code.
Hahav jokes on you AVR (and arduino) still uses it.

>> No.1741308

>>1741305
Exactly my point.

>> No.1741340
File: 110 KB, 900x900, 20180914_PADAUK-Tech-PMS132B-S08_C133216_front.jpg [View same] [iqdb] [saucenao] [google]
1741340

>>1741001
what does everyone think about the 3c micros?
>>Yeah, they have a tiny amount of IO
>>Yeah, you currently need to buy an overpriced programmer and use chinee IDE
but at the end of the day, they are insanely cheap.
I personally believe there are a lot more things you can do apart from flashing a fucking led.

Thoughts? Has anyone had a play with these or similar?

>> No.1741354

>>1741308
Well some my colleagues might be tempted to try arduino so I want to give them a better alternative.

>> No.1741368
File: 649 KB, 800x800, file.png [View same] [iqdb] [saucenao] [google]
1741368

>install drivers
>connect via usb
>doesn't show up in /dev
where do i even begin to debug this? i know the driver is loaded, and the device seems to be working...

>> No.1741374

>>1741354
Try to sell them on WDC's MyMENSCH. I get the feeling they're going to discontinue it since they can't price them as cheap as Arduino, but my god at least you're using a fucking real architecture.

>> No.1741398

>>1741368
run lsusb, plug it in and run lsusb again
did something new appear? if not your shit's broke. Maybe try some different ports or cables, if they fucked up the SI it might be finnicky.
Check the vendor/device ID against what your driver supports. If the driver is open source there will be a table of struct usb_device_id or similar in the source. Does that thing connect with a normal CH340 or other USB UART? If so you shouldn't have to "install" any "drivers" like a windows pleb. You might have to modprobe it if the depmod/udev tables didn't update correctly.
check dmesg for any errors from the driver.
Look in /sys/bus/usb/devices for the device you're looking for. /dev is maintained by userland while sysfs shows you what the kernel knows. If you see promising things in sysfs but no device nodes, udev or some lennartware probably fucked up somewhere.

>> No.1741400

>>1741340
I looked up the spec sheets for that whole family of micros, wondering the same thing, what could you really do with one of these? They are all on the very low end of things, in terms IO, clock speed, and program memory. Unless you really need the low price for production applications, I don't see how the disadvantages and hassle are worth it. Might get you some youtube / hackaday cool points if you used one in your project, tho. Or use one just because it is unique and entertaining.

>> No.1741446

Are microcontrollers etc. best thought of as nodes which can be programmed with simple code snippets (if/else statements, loops, etc.), and which receive input and can put out… output from and to things that are not computers, like sensors, motors, LEDs, buttons, etc.?

>> No.1741448

>>1741446
You thinking of FPGAs m8

>> No.1741450

>>1741448
What would be the best terms in which to think of Arduino & co. then? I'm somewhat interested in them but I have a little bit of trouble wrapping my head around what they are (and thus, what to do with them, and how they might fit into things).

>> No.1741454

>>1741450
They're CPUs, with very limited instruction set, one core, a set of registers, program counter (a register too), SRAM, FLASH, bunch of peripherals and dozen of clocks. Depending on the chip and/or peripherals, the hardware in them can clock themselves out (e.g. do simple tasks like shit stream out of SPI concurrently), a very VERY limited ALU. They draw little-to-no current.

You can think of them as event-driven machine, if you program everything to be interrupt-based. And keep a simple busy loop (or even sleep). Or you can go a bit further and crack open the cold one: FreeRTOS.

Their primary point is they're cheap. Therefore very fucking limited. But because they're simple, they're very reliable. You can literally make one and put in in a wall and be sure it will still be working 20 years after.

>> No.1741579

>>1741454
I see; thank you.

>> No.1741692

>>1741454
>can run an OS on a PIC18
Neat

>> No.1741710

>>1741171
>They have UV LEDs now
EPROMs need at least UVB; the UV LEDs only make purple and UVA. Though I had a situation where an exposed EPROM left in front of a west-facing window erased itself over a period of a few months. It was only a boot ROM, so easily re-burned, but still a pain in the arse.
>>1741188
>probably in the 10s of thousands
I think the main limit is that some cells will get worn out and stuck before others.
>>1741270
>turn on UV LED for x amount of time
The erasure time for any given cell is kind of random anyhow, and the less efficient UVA light would be great to prolong the self-abuse.

>>1741305
I first encountered AVR a couple of years before Arduino. Fuck PROGMEM and fuck... uh... jannies?

>> No.1741730

>>1741710
>some cells will get worn out and stuck before others

We're not doing anything so brutish, we're going to focus the UV light through a quartz super-twist 720 dpi LCD and we'll only erase (and program) the absolute minimum edit-distances from burn-to-burn. We probably can't get "per bit" resolution, but that will be determined on the first calibration run (with the rest of the parameters) when we build the address map.

Since our write durability is much higher than MLC crap, we'll be scaling this up and selling it to Micron as a superior option to that 3d xpoint junk.

>> No.1741733

>>1741730
Autism intensifies, but I like it.

>> No.1741740

>>1741730
Does a quartz LCD pass UV better than glass? I tried using a standard LCD in an SLA 3D printer and basically no UV at 405nm got through

>> No.1741752

>>1741740
Quartz passes pretty much all wavelengths of UV freely. Most common glass blocks the hell out of it.

>> No.1741761

>>1741752
Neat. Any idea where to find a quartz LCD? I only see quartz clocks with LCDs

>> No.1741776
File: 127 KB, 340x327, feel-the-knowledge.png [View same] [iqdb] [saucenao] [google]
1741776

>>1741761

LCDs typically use thin glass, but the availability of thin quartz base stock materials (used for microscope slides and slips) it became possible to make quartz LCDs. Televisions will eventually adopt these as they will be backlit with intense UV, so you can actually get burned when watching instructional welding videos for the full educational effect.

>> No.1741805

I picked up this screen from amazon and I can't seem to get the drivers installed. The screen is this one: https://www.amazon.com/gp/product/B07H2CR49S/ref=ppx_yo_dt_b_asin_title_o00_s01?ie=UTF8&th=1

And I'm following the product's guide from here:
http://www.lcdwiki.com/3.5inch_RPi_Display#Driver_Installation

It all seems to go fine until the last step where it tries to reboot. It hangs on the boot screen and I have to reload the image to the micro sd card to get it to boot after that. Anyone else try one of these mini screens?

>> No.1741809

I propose a further refinement to my
>>1741270
idea, inspired by the anon who posted
>>1741730
I now propose that we use a micro that can access external memory as program memory, perhaps an 8031. At least some of that memory should be constructed of set reset flip flops built from discrete transistors, plans for a few bits of sample memory can be found with a quick google search. We can expand it to perhaps 256 bits, using a large PCB, 8 transistors and 8 resistors per bit. SMT components can help save space. Here's the twist: we replace one transistor in each flipflop with a phototransistor, and use an everyday white LED on an XY axis drive using cables and pulleys to fuckulate certain bits. Another twist: have two micros designed like this, controlling the fuckulating LED on the other's memory.

>> No.1741881

Hello /diy/,
I have a specific question about a microcontroller;

Can shorting output pins of a PIC18F4520 kill it?
I might have accidentally shorted them while it was running. The input voltage was within operating range (4.5V where 5.5V is maximum), but it stopped working after 0.1 seconds. There was no smoke and DC power supply did not indicate a full short circuit, bur I have a feeling the microcontroller is cooked inside nontheless.

Right now, the amp usage seems normal, but the output pins measure from 0V to 0.2V, which is nowhere near 4V.

>> No.1741892

>>1741809

all aboard the gaytrain.

>> No.1741935

>>1741881
Yes, if an output pin was shorted to Vcc or ground it will exceed the max current rating for that pin and could permanently kill that output. Usually won't kill the whole chip. To kill the whole chip you usually have to exceed max voltage.

>> No.1742014

>>1741398
>Check the vendor/device ID against what your driver supports. If the driver is open source there will be a table of struct usb_device_id or similar in the source.
adding my device id in there did the trick. cheers!

>> No.1742074

>>1741935
> Usually won't kill the whole chip.
That might kill a whole port, though, or even some sort of bus that might include multiple ports. You'll never know.

>> No.1742220

>>1741001
what is a more permanent solution to a breadboard? i want something lighter and that wont have wires popout with motion
not something as serious as printing a pcb
is there anything easier (and less messy) than soldering wires between each component?

>> No.1742223
File: 2.04 MB, 1200x765, file.png [View same] [iqdb] [saucenao] [google]
1742223

>>1742220
protoboard or stripboard. learn how to make pcbs though, it's fun.

>> No.1742227

>>1742220
It's not hard to make a pcb. If you're recording your schematic on your computer, which you should be, that's 80% of the work to make a pcb. And you'll save that time in the assembly since you don't need to do any soldering for the interconnects

>> No.1742293
File: 189 KB, 1920x1200, sleepyKonata.png [View same] [iqdb] [saucenao] [google]
1742293

I'm looking to make an cheap automatic teapot with an attiny85, lm35 and a induction heater from ebay, however, I'm having problems with how I will display the desired temperature with the attiny85, since I'm going to be using 3 7-segment displays to display the temperature, a pot to set the desired temperature and a simple transistor switch to control the system, I'm going to run out of pins, what can I do to fit everything in the attiny85? Should I replace it with another MCU instead and do it through a matrix circuit?

>> No.1742294

>>1742293
Would it help if I told you you can run your three 7-segment displays with a total of 10 pins?

>> No.1742304

can this work with a rpi? or does it only work with arduino? https://www.amazon.com/Elegoo-EL-SM-004-Inches-Technical-Arduino/dp/B01EUVJYME/ref=sr_1_5?keywords=tft+touchscreen&qid=1577680440&sr=8-5

>> No.1742331

>>1742294
Well kind of, now I know I would need a ATtiny48/88 at least. Still would be cool to do some 'reel engineerin' with obscure IC's and shit.

>> No.1742334

>>1742331
>'reel engineerin' with obscure IC's and shit
i sympathize but if you want to do real engineering then that includes cost assessments. the most expensive piece of your "product" is development time, so you should use the solution that's easiest. the most expensive portion of mass produced shit is the hardware, so they should use what's cheapest. nobody could fault you for fucking around though.

>> No.1742336

>>1742331
If you really really want to use an attiny85 you can use a shift register to convert two or so output pins into as many as you want. But buying the shift register and decoupling caps is going to cost more than just buying a bigger MCU. And >>1742334 is totally correct, just do the easy solution and buy an MCU with lodes a pins. I'd recommend a pic16

>> No.1742344

>>1742336
>>1742334
thanks m8s

>> No.1742621

ARe nine segment displays a thing
has anyone everyseen one?

https://infogalactic.com/info/Nine-segment_display

>> No.1742672

Not microcontroller but some fun retro CPU pics I took yesterday:
>>74191566

>> No.1742674

>>1742672
Well that's in /g/, crossboard posting not allowed I suppose

>> No.1742690

>>1742674
lrn2post
>>>/g/74191566

>> No.1742691

>>1742621
Can you ask a question in a way that it isn't answered directly by the link you posted?

>> No.1742714

>>1742691
ARe nine segment displays a thing
has anyone everyseen one?

>> No.1742725

>>1742331
There are chips ou there that would convert binary number to a set of 7 segment displays. I bet you can even find one that takes i2c or uart as input.

>> No.1742726

>>1742725
Oh shit that one >>1742336 is dead on, scratch my post

>> No.1742727

>>1742714
Yeah, see

https://infogalactic.com/info/Nine-segment_display

>> No.1742781
File: 30 KB, 422x309, hxtyw6p3msl11.jpg [View same] [iqdb] [saucenao] [google]
1742781

If I wanted to buy a 65c02 and some of its peripheral components like IO and Serial chips to build a simple 8bit computer what is a good place to buy them from. Jameco which is my go to for ICs only has the 6502.

>> No.1742803 [DELETED] 

>>1742781

this is the source: https://www.westerndesigncenter.com/wdc/
presumably they have a lost of retailers where to buy, probably the same as you see at the top of the /ohm/ thread.

>> No.1742810
File: 104 KB, 1747x773, mouser.gif [View same] [iqdb] [saucenao] [google]
1742810

>>1742781

this is the source: https://www.westerndesigncenter.com/wdc/
presumably they have a lost of retailers where to buy, probably the same as you see at the top of the /ohm/ thread.

>> No.1742825

>>1741001
I am trying to use an arduino to recieve with a lora module and write the result to an sd card.
I can do each individually, but when I put them together, it doesnt work. the script resets over and over again. it stops working when I add in an SD.open() statement. do i need two arduino to accomplish this task??

>> No.1742876

>>1742810
Aren't there any 6502-based microcontroller cores that are produced by modern chip companies?

>> No.1743019
File: 140 KB, 411x308, An FPGA Based 6502 Computer.png [View same] [iqdb] [saucenao] [google]
1743019

>>1742876

yep, the company named in the post you linked to: WDC. they're modern. they even came out recently with a 6502-based arduino competitor. it's completely awful, but they tried.
they also sell their intellectual property to others, so you can probably find an FPGA, or whatever, that includes a 6502 in the corner running at 500Mhz.

>> No.1743025

>>1742825
What is memory usage message when you compile script, any warnings?

>> No.1743171

>>1742810
What does that even mean, "modern chip company"? What do you object to in whatever you describe as a not-modern company?
>>1743019
There are free open-source cores for this and many other older cpus.

>> No.1743310
File: 11 KB, 300x300, 13093491.png [View same] [iqdb] [saucenao] [google]
1743310

Has anyone ever implemented a CNC machine in an already working milling machine/lathe? Aside from equating the stepper degrees of rotation with the cutting tool translation, and making sure there is no loose parts in the transmission mechanism, what else should I take into consideration? Is it safe, first of all?

>> No.1743383

>>1743171
>What does that even mean,

I mean mainstream, like the atmel AT89 series, but for 6502. Like cheap and plentiful.

>> No.1743396

>>1743383
So a modern, inexpensive, easy to use and program micro that uses the 6502 instruction set? I don't think this exists. I'm pretty sure the closest thing is the 68HC11 and Freescale's upgraded versions of it... but those are descended from the 6800 / 6809 instruction set, not sure about ease of use / price point.

>> No.1743413
File: 97 KB, 689x473, 1574132863777.png [View same] [iqdb] [saucenao] [google]
1743413

>>1743025
it was a memory usage problem. i gutted all my crypto libs and it works now. thx homie i luv u

>> No.1743515

>>1743396
> don't think this exists

It appears the 6502 ship sank completely about 10 years ago. There used to be a lot of 6502 cores, for example the renesas "740" series like the 7549. Digikey has only 9 of the 20-pin $2 MCUs currently, and they have been EOL for some time, replaced with the completely incompatible RL78 series. There is a "porting guide" to RL78 which shows basic pin compatibility but they neglect to mention that you have to re-write all your software from scratch! Gee I wonder why they went bankrupt?

WDC's prices are ridiculous. They can charge that much because they are replacement parts for old equipment from the era where 6502 was produced heavily by other licensed manufacturers, so it's cheaper to buy at their extortionist prices than re-design everything. Their SBCs are 100 (in some cases, more) times the price of what you can get into with microchip, ST, and even TI (all of which have a future).

It's sad to see the architecture die this way, relegated to old weirdos or hipsters that emulate it in FPGA. It's a shame, because the core must be among the smallest and cheapest to make with modern fabs.

>> No.1744072

How fast is arduino?
I need to monitor a sine with analogread that is approx 100hz and trigger a function every time the sine crosses the border between + and - (and don't worry it's so there isn't any negative voltage on the analog pin)

>> No.1744074

>>1744072
*biased

>> No.1744089

>>1744072

What is the penalty of missing a zero crossing?

If you just made a zc detector and triggered an interrupt, I think that would be viable, as long as the function does as little as possible... if that.

If you can get away with a zc det and a counter, and then read the counter, that would be even better. It's two ICs at most. Similar technique is used to buffer UART data... you might miss an interrupt, but on the next go around, you have two bytes in the buffer.

>> No.1744099

>>1744089
>What is the penalty of missing a zero crossing?
It doesn't have to be precise down to the attosecond, but it has to be somewhat reliable, basically i have a triac which i need to turn on at a certain part of the each sine (and then the triac turns it self off during the zero crossing).
So that way i can generate PWM with the AC to dim a simmable LED bulb

>> No.1744220

I'm getting started so I'm going with an Arduino instead of STM32 nucleo because it's too intimidating. Plus there's a lot of stuff already interfaced for Arduino so I can feel like I'm going stuff.
My goal is to play with IMU motion tracking and simple gesture recognition. But I want to graduate from setup() and loop() and use interrupt routines like a grown up.
Do you have example of IMUs that are easy to setup? And resources on good practice for embedded stuff from a beginner (I can write basic c++ and do dynamic programming and binary tree stuff but I'm a beginner when it comes to closer to metal) perspective?

>> No.1744235
File: 312 KB, 1224x918, IMG_20200102_112604.jpg [View same] [iqdb] [saucenao] [google]
1744235

Anyone recognize this as a micro or is it an ASIC? It's the guts from a shitty delux wireless mouse that I want to use to make a custom mouse. The problem is that the tracking quality suffers because the mouse goes into power saving mode immediately after you stop moving it which causes little lag spikes all over, if possible I want to reprogram it to not be gay. The wireless is built into whatever the hk9800 chip is.

>> No.1744250

>>1744235
https://electronics.stackexchange.com/questions/318581/tracking-down-a-datasheet-for-an-unknown-optical-sensor
tl;dr Chip on the left is proprietary so no datasheet so you can assume that the right one is as well. Google turns up japanese results.

>> No.1744290

>>1744250
Yeah I saw that before. These sensors seem pretty universal as I understand as they just give an x,y displacement or position value and people have even got them to spit out their image data. I don't think it would be too difficult to read it, it's just getting the info to the computer which is the problem. I could use an arduino with bluetooth but it's a stupid amount of work and money to reinvent the wheel.

Any ways I replaced the blue LED that illuminates the sensor with an IR one and it seems to be tracking much better now. It's surprising that those chinese engineers could fuck up so bad by using a color that the sensor can't see that well.

>> No.1744307

>>1744290
>Any ways I replaced the blue LED that illuminates the sensor with an IR one and it seems to be tracking much better now.

Well now this is interesting, the mouse is fucking making coil whine and clicking noises while in power saving mode... there are no coils inside it.

Fuck this is loud enough for me to hear over shit playing on the speakers. I know this isn't electronics general but it's weird as fuck. I got the IR LED from a photo gate.

>> No.1744359

I have an esp 1 connected to an i2c oled display. Is there an easy way to connect more than 2 buttons to it if the display takes 2 gpio pins and the esp 1 has 4 gpio pins.

>> No.1744423

>>1744307
>I replaced the blue LED that illuminates the sensor with an IR one

blue LED drops around 3V. IR LED drops around 1.5V, so it prob draws too much current, which is causing it to cry out in pain.

>> No.1744487

>>1744423
This anon is correct. Easy probably-will-work solution to try: Put (2) regular rectifier diodes in series with the LED. They will have a voltage drop of about 0.6V each bringing you closer to the original design. Will the IR LED still put out enough IR to do the job? Only experimentation will tell! Another option: Put a second IR LED in series with the first, get your voltage drop closer to spec and more IR too.

>> No.1744497

>>1744220
get an MPU9150. it has a great library. i just used one last month for a prototype. the arduino website has a guide for setting up interrupts. it's stupid simple.

if you want to get close to the metal then please learn assembly. it's fun. you'll realize how abstracted even C is, and microcontrollers are one of the very few cases where handwritten assembly is actually important for time deterministic operation and squeezing everything you can out of your pathetic 32MHz clock

>> No.1744501

>>1744497
>suddenly it's 1971 in the thread, because I'm bored at work
32 MHz? Slow down there buddy, 1 MHz is what the big mainframes do, maybe you meant 32KHz? How many germanium transistors did you solder together to make that newfangled doohickey? How many fans to prevent thermal runaway? I'm amazed you wrote an assembler for that thing, most of the homebrew guys just hand assemble hex code.

>> No.1744670

>>1744423
>>1744487

Thanks guys, I didn't realise different LED colors had different voltage. I put two diodes in series and the whine is gone but now the tracking is super bad. I'm going to try a single diode.

>> No.1744677

>>1744670
You probably need a larger current limiting resistor on it. Most of the time an LED will need anywhere from 50 to 1000 ohms depending on the voltage and current needed. You could try adding 50-100 ohms for your IR LED.
The exception is when a current source is used, which is more complicated and expensive than a simple resistor.

The basic LED circuit looks like this:
GND --->|---^v^v^v----- +5V

>> No.1744682

>>1744677
The mouse runs off a single AA battery so I'm pretty sure the control IC has a voltage booster and LED driver which is probably why I was hearing it scream.

The single diode seems to have done the trick, it's no longer screaming or it's doing it in frequencies that I can't hear...... scratch that I can hear it when I put it right up against my ear.

I should put the blue LED back in and see if I can still hear it. But any ways it seems to be good as is, as long as it doesn't fry or kill the battery super fast.

>> No.1745145

>>1744497
How do one get the technical and theoretical background for this?

>> No.1745154

>>1741119
ADC and DAC

>> No.1745165

>>1742825
Is your circuit drawing too much power using lora and the SD card at the same time? Try a different power supply that can deliver more amps. I had a similar problem when I first looked at getting a demo wifi program running on ESP32, the power supply wasn't beefy enough to deliver enough current when wifi was being used.

>> No.1745198

Can anyone redpill me on micropython? Any advantages over an Arduino, other than "you can use it if you know Python and don't know C/C++"?

>> No.1745280

>>1745198
Literally retarded. Microcontrollers are extremely limited devices and making things 20 slower isn't going to help you much.

>> No.1745286

STManons: If I wanted to change how fast/slow a hardware timer counted on the fly, would I set the timer prescaler PSC register again after the timer had been initialised, or would I change the ARR instead? I want to be able to change the delay time on the fly using a rotary encoder.

Initially, to have a 1 second delay, I set PSC to 35999 ((72MHz / 2000ms) - 1) and a period of (2000ms - 1), Why 2000ms? Because 72MHz / 1000 won't fit into the 16-bit size of the PSC register.

>>1742220
>not something as serious as printing a pcb
Having PCBs made is dirt cheap though, and better than messing around with ferric chloride.

>> No.1745385

Can't get my ESP8266-01 to respond, I've tried the following setups:
https://create.arduino.cc/projecthub/jeffpar0721/add-wifi-to-arduino-uno-663b9e
ESP didn't show up in any wifi-list that I had(computer, phone) so I tried the following:
https://www.instructables.com/id/Using-ESP-01-and-Arduino-UNO/
and
http://www.teomaragakis.com/hardware/electronics/how-to-connect-an-esp8266-to-an-arduino-uno/
And I couldn't get esp to respond to "AT" command. Any pointers how to unfuck this mess?

>> No.1745387

>>1745280
That was my impression too when I read about it. Thanks for confirming.
Funny thing is that I used to have a Pi running an infinite while loop in Python and I was shocked to discover about a month afterwards that the loop had failed (python error) at some point. I looked online and it was actually something that happens from time to time. You can fix it using systemctl services and restarting on failure but that's not the point.
I'm willing to bet C/C++ would never do that. Not shitting on Python because it has its uses (I wrote all of my whole fucking thesis in ML in Python) but fuck man you can't rely on it other than scripting.

>> No.1745770

is anyone doing any project using retro computers? those always interested me. using a C64 to drive some electronics was always really cool to me.

>> No.1745796

>>1745770

I'm amazed that nobody has made an IBM PC/XT/AT as a single die SOC. With 8087 math co-pro. I supposed nowadays you could even put a full 640K and include a AST RAMPage! card, all just built in. Cripes, the amount of software it could run...

>> No.1745799
File: 2.56 MB, 4032x3024, IMG_20200105_013521.jpg [View same] [iqdb] [saucenao] [google]
1745799

>>1741001
>only smoked once when i plugged it in
>wiring is spaguetti mess
>fucked up my diagram and had to switch wires for the gps
>it still fucking works
these chink arduino modules are bullet proof. even a retard like me can get something to work

>> No.1745800
File: 2.67 MB, 4032x3024, 00000IMG_00000_BURST20200105013610800_COVER.jpg [View same] [iqdb] [saucenao] [google]
1745800

>>1745799

>> No.1745805

>>1745800
How'd you manage to make every single joint a cold solder?

>> No.1745830

>>1745800
Let me guess, green automotive wire was on sale.

>> No.1745842

>>1745796
aren't all these parts still widely available, though? probably why we have no SOCs.

>> No.1746044

>>1745805
Idk what a cold solder is

>>1745830
Nah I bought it from aliexpress. $2 for a small roll. Clearly too large gauge.

>> No.1746130

can anyone riddle this shit ? >>1745939

>> No.1746218

>reinstall windows
>have to reinstall all of mplabx and its dependency, java, just to get the pickit command line programmer
god i fucking hate software written by hardware companies

>> No.1746261

>>1746130
anon obviously wants to skip the unwanted patches. since the rotary encoder sends pulses, it is a programming task instead of a hardware rotary switch replacement task. Or both, if you want to use a mechanical 3-way switch.

>> No.1746554

I tried every guide in existance to get my esp32 cam to work. I give up.
Most frustrating part was that I got that everything is nice and upload ready and then time out waiting for packet header which apparently is a completely different error from "esp32: time out waiting for packet header" and guess which error is the only one coming up on google.

>> No.1746867

>>1741001
you think this thing can really do 3A? https://www.aliexpress.com/item/32281479640.html

>> No.1747040 [DELETED] 

>>1746867

the first first review says ''nope'' -- yet still gives it 5 stars.

>> No.1747041

>>1746867

the very first review says ''nope'' -- yet still gives it 5 stars.

a later review says this:

Ordered blocks for 3 A. The tests showed that they actually issue 1 A with heating degrees to 30-40, 2 A warm them up to 60-70 degrees in 2 minutes, with a source of 12 V consumed 1,5 A. Current 3 and not loaded, I think will burn.

>> No.1747092

Do you start design revision numbers at 1/A or 0/blank? I always assumed a rev number was applied to a revised design. Seems a lot of people automatically give it RevA right off the bat. Seems appropriate for a version number but not revision. Thoughts?

>> No.1747104

>>1747092
I just do rev.1 rev.2 etc

>> No.1747112

>>1741001
I want to run java on an orange Pi.
How bad of an idea is it?

>> No.1747125

>>1747112
Java is literally a world-destroying technology, so using it anywhere is about the worst idea you can come up with, especially on a /mcg/ class processor.//

>> No.1747128

>>1747104
So wouldn't that strictly speaking be ver.1, ver.2, etc? I guess most people aren't so OCD about that's stuff as me?

>> No.1747236

>>1746218
They literally have stand alone programmer interfaces. Why are you crying about having to install a full IDE and dependencies when its not necessary?

>> No.1747270

>>1747125
I'm all for a good hyperbole, and I'm not a Java fanboi by any means, but "world-destroying"? Please cite evidence that Java is any worse than any other buzzword programming language.

>> No.1747330

>>1747236
>stand alone programmer interfaces
are you sure you're correct? i googled around and as far as I can tell they've removed the downloads for those. as of now it seems you have to download MPLABX to get both the IPE and the command line programmer.

>> No.1747342
File: 137 KB, 750x1334, 1577819223620.jpg [View same] [iqdb] [saucenao] [google]
1747342

Would it be a trivial problem to design and build a home monitor system w regulatory controls from a burner phone without using a prepackaged solution?
Like zone temp, humidity, flood detection, fire, door/window open logs, server, electricity usage, and cctv.
Also not sure if this is even the right thread.
t. Can't even Hello World

>> No.1747381

>>1747092
If you need to use revisions, then your design is imperfect. I don't use them.

>> No.1747407

>>1747270
I don't think there is any debate about it anymore (with the possible exception of things like "jython" ... If that became popular)

Nowadays, the investigation is focused on determining if the malfeasance existed at inception, or it was just stupidity that turned into malfeasance later on)

Not to worry though, I'm sure everyone in the embedded sector will be using picojava "microcontrollers" soon (as promised)

>> No.1747418
File: 52 KB, 800x562, _itoshiki_nozomu_and_yuno_hidamari_sketch_sayonara_zetsubou_sensei_and_shaft_drawn_by_aoki_ume_96ab6fcf7b2a6211f8ec6d0e280c7bb8.jpg [View same] [iqdb] [saucenao] [google]
1747418

Is the TMS320F28027 good enough for FFT? What about digital audio filters and video processing (analog to digital upscaling).

>> No.1747472

>>1747418
>TMS320F28027 good enough?

No. Use a 66AK2G12. 100 MHz w/ DSP for audio.

You'll need something more powerful for that to do video.

>> No.1747490

Right now I have a 4 port serial port hub that is reading the transaction output of a cash register via rj45. On each of the hubs com ports I have only gnd and rx connected from the registers via some Jerry rigged rj45 to rs232 to Dupont cables to the hub. I want to design a USB serial hub that has an rj45 interface rather than the rs232 to have a permanent professional solution. Does anyone have any suggestions for a chip that has all that on board?

>> No.1747495

>>1747342
How do you expect to test that? It will obviously fail when the moment happens

>> No.1747671

>>1747490
What does the cash register actually output? Is it a simple voltage pulse to trigger the solenoid? Is it RS485 style signal? Is it RS232 serial data? If so which voltage levels? Regardless the answer to "what can I do to make this thing talk to this other thing" is 90% likelyhood of being either "arduino with some shields" or "the same chip that's in arduino and the same components you'd find on those shields placed on a custom board".

>> No.1747673

>>1747407
Not me. I will only use MegaJava running on Macrocontrollers. Fire up the steam boiler, this thing is going to make Babbage's engine look like a moped.

>> No.1747891

Should I keep this MCU for something in special?
Right now I'm thinking about just using it for retarded shit any other MCU could do.
http://www.s-manuals.com/pdf/datasheet/k/b/kb3930_r02_ene.pdf
It has a 8051 btw.

>> No.1747899

>>1747891
just throw it in the trash and use a pic or atmel, whatever you already have a programmer for

>> No.1747927

>>1741119
>I am ST shill
STM32MP and embedded multicore in general

>> No.1747948

I want to get started with FPGAs. however I have no idea how and have barely money for a prebuilt board, I found the following website (https://www.nandland.com/goboard/introduction.html)), which details the components needed for a basic FPGA development board, for which I already have some similar components, and I only need the USB, VGA connectors and a 25Mhz oscillator, is it alright if I pick any cheap FPGA chip and install it? How could I do this?

>> No.1747969

>>1747891
> keep this MCU

So, like you have the bare MCU? Although the 8051 is an incredibly popular core, this is a 128-pin beast. You'll get more milage out of something like the MSP430 or PIC for "retarded shit" that comes in DIP packages for fucking around.

>> No.1748035

>>1747948
I bought a $35 ALTERA IV EP4CE board off aliexpress. Comes with vga port and other pc-interface ports onboard and an IR remote and the USB programmer.

>> No.1748164

Anyone here worked with sonoff? Mine stopped working after a couple weeks. I checked the power circuit and it seems fine.

>> No.1748282

>>1747948
Lattice ice, check the the lattice icestick specifically, as its pretty cheap and easy to use. The biggest reason for the ICE FPGAs is the ability to use the open source toolchain yosys, by clifford wolf.

>> No.1748295

>>1748282
The biggest reason to choose Lattice or Altera is "Xilinx are dickheads that sue hobbyists for promoting their products"

>> No.1748738

If i do serial.begin in setup() but then don't use any serial commands after, does it waste any CPU power?

>> No.1748757

>>1748738
The only way not to "waste" the 30 mA you're taking about is to pu the thing to sleep. Otherwise it doesn't really matters what you do with it. There are special calculators around that would calculate your power draw depending on your peripherals enabled, but 30 mA, nigga, really?

>> No.1748760

>>1748757
i am talking about computing power as in cycles

>> No.1748763

>>1748760
Nah, it only prepares the hardware to correct baud rates and stuff.

>> No.1748801

I have been interested in some time of making a modern LW/MW/HF/VHF art deco style radio with a modern equipment.

I think the simplest would be buy a SDR songle some rotary encoders and buttons and a stand alone screen. And build a cabinet.

Advance level I have thought of build a superhet circuit and use the Rpi to extract the signal from it.

Where would I get started.

>> No.1748802

I'm too brainlet to solve this, any idea how to do it?
x:\...delay.h:276:28: error: __builtin_avr_delay_cycles expects a compile time integer constant

__builtin_avr_delay_cycles(__ticks_dc);

The error is caused when i try to use the delayMicroseconds function on attiny.

But the same exact code runs flawlessly on arduino uno.
Also normal delay() function works on the attiny just fine

>> No.1748812

>>1748802
Try it will an integer constant.

Give it 10

>> No.1748813

>>1748812
What is it for tho? Why do i have to tell it how long a microsecond is?

>> No.1748814

>>1748802
It's probably a macro or asm that is only meant to put fixed delays into code, and only approximate. Different CPU type could have things like that implemented differently in the support libraries.

>> No.1748816

>>1748814
So how do i achieve a 100us delay then?
I need delays shorter than delay(1)

>> No.1748824

>>1748816
If you need them accurate? on an output pin? Use a timer unit.
That shit is just for approximate timing, it probably gets the clock rate from a compile-time macro somewhere too, or maybe the clock speed gets stuffed into a global by startup code. Either way the tiny probably doesn't have the ability to do the math needed to compute the number of times through the loop without using a library function, so the math is done at compile time.
It's really meant for when you're doing first initialization of a chip and need to have sort-of delays that are long enough for hardware to settle down.
Or I guess you could do some cycle-counted asm, but that stuff isn't a good idea since most modern CPUs have to deal with variable stuff like varying memory bus speeds and pre-fetch, and the time an instruction takes take isn't guaranteed.

>> No.1748827

This might be a dumb place to ask this, but how do I do multiple if statements in the void loop() function? Trying to use an arduino to make a scoreboard. And tests aren't going well.

When I did it with the Max7219 ic I was able to just put if{} after if{} to make the buttons work, but this is either not compiling or making me alternate between buttons to get the results.

if (!digitalRead(switchtwo)) {
homescore--;
while (!digitalRead(switchtwo)) {
delay(5); //delay to debounce switch
}
ledcalculate();
}

else if (!digitalRead(switchone)) {
homescore--;
while (!digitalRead(switchone)) {
delay(5); //delay to debounce switch
}
ledcalculate();
}

>> No.1748833

>>1748824
I only need the accuracy to be within 100us margin

I managed to bypass the problem by making my own delay function by using micros()

>> No.1748835

>>1748827
You are using else if so it will only read the first button if the second one isn't pressed

>> No.1748844

>>1748835
Thank you. If I use two if statements instead, then it works properly, but only if the other button is also depressed. (Thank you for making me go back to check that, I thought that it didn't work at all when a single button did nothing).

>> No.1748847

>>1748833
That's kind of the right way to do it, but any time you try to do that short of a delay without a hardware timer it's going to be hacky.

>> No.1748849

>>1748844
Personally i would just set the button pins as input_pull ups and use falling edge interrupts to detect button presses (not all pins have hardware interrupts, Uno only has 2 i think, but i believe it has software interrupts on all pins). It might be too complicated for you right now, but unless this is a one off project and you want to keep making stuff with arduino then you definitelly need to learn about interrupts

>> No.1748851

>>1748849
Will do, sir. Thank you very much. That's really what I needed, some specific terms for which I can search and read about.

>> No.1748859

>>1748827
>>1748835
>>1748849

So it worked by removing the negation "!" part from the loops. I'd stolen the code from an article on pullup switches. So just a huge oversight on my part. Works great now.

Thank you for the help!

>> No.1748970

>>1747490
Like the other anon said, you need to find out what standard (if any) that the cash register is using.
Also keep in mind that "RJ45" is a physical type of connection, and "RS232" is a communication protocol. They have nothing to do with each other.

>> No.1749286

So I completed my Arduino nano 33 BLE project. Now I wanna build a PCB for it (with a battery house location ofc) for personal use and smaller form factor

Any resources into that? I make use of the included BLE + IMU of the dev board for gyro+accel, so I don't know how to into looking up the connections

>> No.1749321

Currently making an internet bootloader for a PIC18F87J60 MCU with internal ethernet controller

>> No.1749395

>>1744220
Whats wrong with setup( ) and loop( )?
My lastest IMU code (with mpu6050) goes like this: setup the IMU as I want during setup() by uploading values to the registers. I have an isr linked to the INT pin of the IMU (this pin goes high when new data is ready to be read from its registers.)
In loop(), an 'if' function waits for the isr to set a bolean from 0 to 1. As soon as it is 1, I can read data from the IMU registers. The isr can also be used to timestamp the data quite accurately. I wouldnt know how to use only interrupts..

>> No.1749427

>had to try to estimate location change in room with mpu6050 and mpu9250 for university project
>failed miserably
fuck sensors

>> No.1749441

>>1749395
>In loop(), an 'if' function waits for the isr to set a bolean from 0 to 1.

In general this is a good approach; do as little as possible in the ISR.

As for the other guy wanting to do it the grownup way, he's an idiot.

>> No.1749531

>>1741001
Am I the only person who thinks that tiny microcontrollers like the one in OP, are absolutely adorable. They look so cute. They have cute tiny legs and a plump body. I want to have a pet microcontroller that I can cuddle with and give it a name.

>> No.1749534

>>1749531
only dip or smd too?

>> No.1749572

>>1749534
Only dip. The smaller ones with less than 8 pins are the cutest.

>> No.1749576

>>1749531
>>1749534
>>1749572
I like this photo particularly because one of them is flipped over. It reminds me of an upside down turtle.

>> No.1749578

>>1749427
>fuck sensors
>can't apply high school physics
You mean you had to use breakout boards with an arduino at your local community college?
Get your shit together anon, it only gets harder

>> No.1749581
File: 308 KB, 1680x1365, Three_IC_circuit_chips.jpg [View same] [iqdb] [saucenao] [google]
1749581

>>1749576
Oops, I forgot to attach image. Forgive the phone posting.

>> No.1749604

where can I get a legit bluepill that won't break the bank? I tried to order a few from aliexpress but I got chinked and they never turned up.

>> No.1749615

>>1749531
too bad NXP stopped making 8-pin ARMs

>> No.1749637

>>1749427
The only way that could work is with a step-sensing method.
Those things aren't calibrated. Even with proper calibration using a rate table in a temperature adjustable box and a magnetic field generator, the drift would make it impracticable for inertial navigation.

>> No.1749643

would it be feasible to do FFT on an attiny85

>> No.1749655

>>1749531
I just remembered I have a bunch of those left over from an old project. Considering programming them to blink an LED and putting them in little boxes like pet rocks and selling them on etsy. Thanks anon.

>> No.1749715

>>1749643
depends how long you're willing to wait

>> No.1749747
File: 41 KB, 1199x136, nxp-please-god-noooooo.png [View same] [iqdb] [saucenao] [google]
1749747

>>1749615

>> No.1749793

Anybody have experience using ESP8266 WiFi modules (specifically I'm working with AN 8-pin ESP-01) with an Arduino Uno? Got mine working 70% but the serial responses from the ESP are often garbled and include garbage characters. Makes confirming responses almost impossible.

I've tried powering it temporarily from the 5V on the Arduino to make sure it has enough available amps to run the ESP, also tried on the 3.3V but the ESP's LED makes it clear it's not getting enough amps. Still works though. Also haven't tried using any step-down in the TX, so the 3.3V RX pin is currently receiving the full 5V output from the Arduino. Can't see how that would screw with the responses that the ESP is transmitting though.

>tl;dr trying to make a google-home enabled addressible RGB kit
>can't get the fucking basics of WiFi working with the Arduino

>> No.1749815 [DELETED] 

>>1749793
Ditch the Arduino and use the ESP8266 for everything my dude

>> No.1749816

Ditch the Uno and use the ESP8266 for everything my dude

>> No.1749850

>>1749793
>>1749816
Got it working. Turns out SoftwareSerial can't do 115200 baud rate. Set the ESP to communicate at 9600 and it worked flawlessly. Known issue, just took too long to find the rate phrasing of my issue on google i guess.

Since then I've gotten some sketches to run straight from the ESP as you suggest. Slowly working my way up, learning experience for sure. Only got the ESPs today.

Not sure if it's fast enough to control 150+ addressible RGBs without noticeable lag when doing certain patterns though. I have a different UNO currently controlling them and I remember I had to be reasonably efficient in my patterns to even get it to work "instantly". Not sure how a less powerful board will do.

>> No.1749855

>>1749850
ESP8266 is far more powerful than an Uno

>> No.1750217

>>1749855
Took the advice, now only using the Arduino as a serial converter (since i have no other firm of usb-to-serial adapter, no way to program the ESP without).

Now controlling LEDs via Google Home -> IFTTT -> AdafruitIO -> ESP -> LEDs. Libraries and tutorials for this workflow were widely available so went that route. I'm sure there's a shorter route but this one works just fine.

I need an LM1117 to give it proper 3.3V to operate long term, then gonna solder a proper board instead of the breadboard everything's in right now. Can't find a source for the LM though, DigiKey or 3 months waiting from AliExpress I guess.

>> No.1750550

Any ideas on starter projects with Arduino Nano? So far I can only think of a music-reactive LED lamp.

>> No.1750561

>>1750550

Use it to generate /diy/ posts from retards who buy Arduinos and then come here to ask what to do with them. Put the code on github and it will become the most popular repo ever.

>> No.1750565
File: 73 KB, 800x598, He&#039;s right you know.jpg [View same] [iqdb] [saucenao] [google]
1750565

>>1750561

>> No.1751243

Should I bother with the Arduino stuff for the ESP8266?
Or should I go for https://github.com/pfalcon/esp-open-sdk ?
I've written a decent amount of C, but this is my first microcontroller project.

>> No.1751306

>>1751243
I programmed an esp01 with the arduino toolchain + VS code, works well enough

>> No.1751321

>>1751243
thanks for linking that sdk, i'm about to have to program a standalone esp for my own project. i'm sure either way you'll attempt suicide a few times in the process of getting the toolchain to work.

>> No.1751914

>>1750550
attach a button, debounce it, control a fet with it, the fet controls a coil (don't forget flyback diode), the coil has a core, the core acts an actuator for a valve, the valve controls the flow of nerve gas.
build and implement it, push the button, and report back.

>> No.1752205
File: 8 KB, 318x282, gross code.png [View same] [iqdb] [saucenao] [google]
1752205

I come from a PLC background. In which we would typically have a routine at the end of the scan which would map all the output bits to the physical outputs. I would like something similar in my MCU but I have having a hard time doing it elegantly. How can I make this not gross?

>> No.1752210

>>1752205
MCU background before recent PLC exposure. This is an interesting problem I'm gonna think on as this is a thread usually.

>> No.1752214

>>1752210
Slow thread. Shit

>> No.1752227

>>1752205
Based on that PLC scans write outputs every cycle, it might be best and easiest to gather all of your "output#" into a single variable the size of PORTD and write that to the port with each function call. Shift each "output#" to its spot, be it 0 or 1, and once you have the full port size, update the port.

>> No.1752228

>>1744099
Why not use a diode bridge and rectify it then?

You are talking about the sampling rate of an aurduino adc. It's got to be min 200 Hz but higher is better, practically 400 or greater to detect the zero crossing event

>> No.1752232

>>1752205
if you want it in a single line you can do
PORTD = (output1) ? PORTD | (1 << PD6) : PORTD & ~(1 << PD6);
but the logic is essentially the same.
put it in a macro to hide its ugliness if thats what you are worried about.

alternatively you could typedef a union, shadow port value and bitfield of outputx, then you just have to do it once per port.

>> No.1752254

>>1752227
I like this. I will look I to it.
>>1752232
I'm interested in hiding uglyness and reducing the redundancy of the statement.

I'm not sure exactly what your second paragraph means but I think it's similar to the first guy I quoted. I will investigate.

>> No.1752763

What's a good resource/book to learn about Computers and microcontrollers from the ground up?

>> No.1753052
File: 27 KB, 466x466, 617vsrQjPkL._SX466_.jpg [View same] [iqdb] [saucenao] [google]
1753052

Arduino I2C question

I'm following a tutorial for raspberry pi on how to get data off this chip (ADS1115), and to put it into read/write mode the master has to send the address followed by 0/1. so should I put the address+0/1 in the beginTransmission() function or just the address followed by Wire.write(0b0); Wire.write(next_byte); etc.? or does it even matter

>tutorial: openlabtools.eng.cam.ac.uk/Resources/Datalog/RPi_ADS1115/
>datasheet: www.ti.com/lit/ds/symlink/ads1115.pdf

>> No.1753062

>>1752763
tinyavr microcontroller projects for the evil genius. read appendix A on AVR C first, especially for bitmath stuff

also check out pdfdrive d00 c00m

>> No.1753094
File: 342 KB, 1486x999, 1579294701660.png [View same] [iqdb] [saucenao] [google]
1753094

>>1749286
Schematics for basically every Arduino dev board are publicly available. They are pretty good about separating conponents so it's pretty easy to identify what groups of components you don't need.
As for PCB design, I have used both Eagle and Altium, but you'll probably have an easier time sourcing components for Eagle given Adafruit's library. You'll likely have to design a footprint for the microcontroller and lesser known parts.
I do suggest you look at the datasheet for the chip so you know the bare minimum required for it to work though. I remember trying to shorten an stm32 board and forgot to give myself a way of programming it lel.

>> No.1753134

>>1753052
arduino libraries are retarded, if you feel fine with reading datasheets then stop using arduino libraries and write your own code.

beginTransmission is for I2C write,
requestFrom is for I2C read.

both take the address as an integer in range of 1-127 and do the shift and set r/w themselves
see: https://github.com/arduino/ArduinoCore-avr/tree/master/libraries/Wire/src

>> No.1753154

>>1753134
oh ok. I didn't know the functions handled it automatically, thanks. and I thought about writing my own I2C class before I got started, but I think it's too complicated for my skills right now. when I learn more about AVR and timers I may in the future

>> No.1753233
File: 2.74 MB, 3264x2448, Arduino.jpg [View same] [iqdb] [saucenao] [google]
1753233

Hey guys, I'm making a temperature-regulated water tank. There's a heater and a temperature probe, and long story short, the code is written so that if the temperature gets over 37 degrees, the heater turns off, but remains on otherwise to regulate it.

Here's my problem:

The temperature probe will sometimes report a temperature of -127 C. I'm not sure what error this stands for but we believe it's linked to power fluctuations or just errors made in communication along the way. We do not want to display this error at all.

My idea is to code the Arduino to go as follows:

>Request temperature
>If temperature = -127, Request temperature again.
>If temperature > 37, turn heater off
>Else, turn heater on

Running the code like this, it still displayed the occasional error. I'm wanting to communicate that if the temperature is -127, it does NOT report that and does not continue until it gets a non-"-127" temperature. Do not pass GO sort of deal.

What could I implement in the code to bar the code from proceeding until it gets an appropriate temperature?

>> No.1753240

>>1753233
The logic is slightly wrong. You should be enclosing the heater on/off within the if statement checking for a valid value. So, within the loop function

>request temp
>if valid reading (!= 127)
>>if temp > 37, turn heater off
>>else turn heater off

>> No.1753243

>>1753240
I see. Complete, would it look as follows?

>request temp
>if valid reading (!= 127)
>>if temp > 37, turn heater off
>>else turn heater off
>else request temperature

>> No.1753247

>>1753243
No, because the entire thing in a loop, the moment the reading is invalid it requests the next reading. Having the else just wastes time and a possibly good reading.

>> No.1753248

>>1753247
Brilliant. Thank you.

>> No.1753250

>>1753247
I just reformatted my code to what you've recommended. It works well but for some reason, -127 did pop up on one occasion?

Got any ideas as to why? Basically I set an integer value as
int invalidTemp = -127;
Then the code runs

requestTemperature
if(getTemperature != invalidTemp){
if(getTemperature > 37 || 0){
Turn heater off;
display getTemperature to screen;
delay(2000);
}
else{
Turn heater on
display getTemperature to screen;
delay(2000);
}

>> No.1753254

>>1753250
If it helps, the invalid temperature is -127 that I set, but when it displays we see -127.00

Should I assign invalidTemp as
float -127.00

>> No.1753292

>>1753243
FWIW the best thing would probably be to have a time-out in case the heater is on and you have been getting constant -127 readings (or some other error) for more than 5 minutes or so. Or at least if that's been a problem, but it's still something you want to be aware of the possibility.
If there's something that tells you milliseconds or seconds or whatever since startup, you can compare the current time with the last time you got a good reading. And even that's not everything, because a 32-bit milliseconds could overflow so you need to check the value of (now - then) > timeout_limit to avoid the wraparound.

>> No.1753322 [DELETED] 

testing

>> No.1753323 [DELETED] 

>>1753322
`blahblah`

>> No.1753365

>>1753250
Get rid of delay...

int period = 2000;
unsigned long time_now = 0;

void loop() {
if(millis() - time_now > period){
time_now = millis();
if ... your stuff without delay()
}
//Run other code
}

You can have different time periods/if checks for them and your code will run them ASAP and not after multiple delays. This one also is not affected by millis overflow (50 days +, micros() a bit more than hour.

>> No.1753479

Anyone know if Lora modules have any kind of forward error correction built in? I read the data sheets but I didnt see anyrhing

>> No.1753573

guys i literally need to install firmware into some modular synth pcbs that run on STM32 and literally dont know what to do. all i know is i need some stlinkv2 which looks old as shit, but theres some pendrive like versions too, dont know where to start help.

>> No.1753577

>>1753573
I did STM32duino a few days ago and I downloaded the "STM32 cube programmer" to connect to it with the stlink. doesn't show up on the com ports btw

>> No.1753578

>>1753573
Some of those stm32 dev boards actually have an stlink interface placed above which you can use to program the new board. Oherwise you do need one of the ones you listed for flashing.

>> No.1753582

I have a question. I haven't done uC or electronics in general for at least a year and I want to get back into it. Last time I tried this, I used an arduino uno to flash my AVR chips and I thought that was really really ghetto and I think it is time to get a less ghetto flasher. Any one have a recommendation that would work on a mac?

>> No.1753585

>>1753582
Using an Arduino as an ISP for your AVR chips isn't weird at all and anything you buy would just be that with a nice PCB and ribbon cable unless you buy a JTAG debugger.

>> No.1753586

>>1753585
Really? That's normal? Huh. OK, I guess I'll stick with the arduino ISP then. Thanks.

>> No.1753587

>>1753586
not sure if it works on mac but I used sparkfuns attiny programmer, also there's a premade shield for arduino or you can make your own. not as "ghetto"

or use USBasp with atmel studio. I think you can still program with arduino code in atmel studio, never done it before though. probably just use arduino to make the hex file then upload it through AVR GCC. though it's a lot easier just to use pure C in my opinion

I would post link but
>"Error: Our system thinks your post is spam. Please reformat and try again."

>> No.1753590

>>1753587
>>1753586
Any ISP programmer almost always works with either OS since the chips that interface with the USB line are the only thing that can prevent you from using it. I'd suggest making sure your OS supports that chip if you're that worried.

>> No.1753620
File: 69 KB, 563x435, file.png [View same] [iqdb] [saucenao] [google]
1753620

this is why you should read errata. now i have to bit bang my i2c.

>> No.1753631

>>1753479
Look for "CRC" in the harder and/or payload. Obviously they come at the end

>> No.1753637

>>1753254
- don't use floats if you can avoid
- if you get too many invalid readings, make sure the heater goes into fail safe "off" unless you live in the Arctic or something

>> No.1753651
File: 396 KB, 1872x1318, please save me ohm.jpg [View same] [iqdb] [saucenao] [google]
1753651

Why the fucking hell does the text on the IC show up sideways in JLCPCB?

>> No.1753653

>>1753651
I don't think those models are supposed to be accurate aside from the alignment dot for pin 1.

>> No.1753688

Is there any way to connect/make an arduino/raspie powered cassette tape player? Cant find anything on google

>> No.1753696

>>1753573
if you don't have an STlink v2 to hand, STM32 chips have a serial bootloader built in, if you can get to the USART pins it uses and set the BOOT0 pin high somehow. see ST AN2606 for more info, the device datasheet for the correct USART pins, and https://github.com/jsnyder/stm32loader for software

>> No.1753734
File: 40 KB, 633x758, file.png [View same] [iqdb] [saucenao] [google]
1753734

>>1753620
>bit bang i2c
>everything looks good on the scope
>sensor doesn't ack

>> No.1753744

>>1753696
>if you don't have an STlink v2 to hand, STM32 chips have a serial bootloader built in, if you can get to the USART pins it uses and set the BOOT0 pin high somehow. see ST AN2606 for more info, the device datasheet for the correct USART pins, and https://github.com/jsnyder/stm32loader for software

What is currently the best stm32-based 'duino from Aliexpress?

>> No.1753792

>>1753651
pin 1 is in the lower left corner by convention

>>1753734
did you forget to set open drain mode? I've blown out I2C EEPROMs that way

>>1753744
bluepills are cheap af. if you really wanted to use the chip you wouldn't be using duinoshit

>> No.1753798

>>1753688
Cassette was just about the height of the analog art.

>> No.1753802

>>1753620
Bit bang i2c? It's like they just need to clock that shit into a shift register... How do you fuck that up? Switch to an NXP uC - they invented that shit.

>> No.1753817

>>1753802
you're thinking SPI. I2C is a bit more than that: start/stop conditions, addressing, clock stretching, byte-by-byte acknowledgement, and some timing that may need to be adjusted on a per-bus basis
>buy brands
>>>/g/

>> No.1754555

guys, so i found this clock divider arduino project:
https://create.arduino.cc/projecthub/Synthemafia/modular-synth-clock-module-diy-arduino-sm-tik-tak-bd8ded

it makes divisions by 2, 4 and 8.. what should i change in the code for it to divide by 3, or other numbers?

>> No.1754597

>>1754555
it's a piece of shit. the cycle_on() function just turns outputs on and off in a pre-determined order to simulate a divide-by counter. if you want to extend that design, you need to redo the case statement in cycle_on() routine to handle as many cases as the lowest common multiple of all division ratios you desire, and change the max count in cycle_off to reach them all. there are better ways to do it, to put it mildly

>> No.1754645

>>1754597
i get it. its done by fucking hands. well im not bothering with expanding, but as is its pretty much working as intended.