Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

# Tag Info

## New answers tagged microcontroller

0

The result is left in quotient,and the remainder is left in numerator.

1

If the Auxiliary contacts are not currently used, you just connect them to a microcontroller digital input as you would any other switch - something like so: simulate this circuit – Schematic created using CircuitLab If the auxiliary contact is already used, you may have to use an opto-coupler or perhaps an additional relay, depending on what is ...

2

It will be certainly compatible with any microcontroller. The keyword "Arduino compatible" generally means that some of the following are true (from most to least likely): Module likely uses 5V signaling, or is at least 5V tolerant It likely interfaces using one of the hardware interfaces available on Arduino (serial, I2C, or SPI) There may be an Arduino ...

0

Vibration Sensor will make when the external spring touches the internal rod. If this was placed parallel to the rotational axis but non-concentric, a low rotation would produce enough force to make it. I assume that gravity however is not enough to make the switch! (Image source: Adafruit: Fast Vibration Sensor Switch)

2

When it say it is compatible with something you know that it will work with specific platform (if seller doesn't lie). To check if it will work with your specific platform you can check if specification are compatible with your platform. For modules you usually check power supply range, interface type and interface voltage. In your specific case these are: ...

10

The term "Arduino compatible" basically means nothing. Many sellers use the term more as marketing ("You can make this work with your Arduino!") than anything else. The Arduino is (usually) just an ATMega microcontroller on a board, that ATMega is very similar to many other microcontrollers. Nearly all of them work with a supply between 2 V and 5 V as does ...

0

Another solution is to use a microcontroller's sleep mode. It is a cool feature that even turns off the system oscillator. You would have a permanent magnet fixed on the outer casing and then when the circuit board spins, the inductor will sense a change of magnetic flux and create a voltage that gets sensed by the wakeup pin of the microcontroller. It ...

1

You are looking for a centrifugal switch. A centrifugal switch is an electric switch that operates using the centrifugal force created from a rotating shaft, most commonly that of an electric motor or gasoline engine. The switch is designed to activate or de-activate as a function of the rotational speed of the shaft. Wikipedia Just go to Amazon and have ...

1

Instead of a gyroscope, just get an accelerometer and mount (one of) its sensing axes radially – being spun causes a centrifugal force, which is measurably an outwards acceleration. Many accelerometer ICs come with an interrupt pin that you can use to wake up a microcontroller. Gravity is not really a problem – if you can mount your accelerometer at a ...

1

I'd go with something with no moving parts if you can. Maybe an optical reflector, with a reflective surface mounted on the spinning part. You can use a retriggerable one-shot to keep the output high until the spinning stops, and you can use the output to drive whatever type of relay/switch/FET you need. One thing to watch out for is if it stops with the ...

1

If I liked mechanics, I'd just have a weight attached to some spring, mounted so that the centrifugal force will pull it radially and hit a tactile switch.

1

TLDR: The internal circuit should withstand shorts. However, transient static discharges by connecting "probes" can destroy nearly anything. From the datasheet, the internal circuit is current-limited by a current source "I" fed from the DC supply Vdd: When Vdd is 3.3V, DC voltage at XTAL and EXTAL pin should be near 0.95V. If so, chances are that the ...

1

You need to develop (or adapt an existing one) a piece of firmware called a bootloader. A bootloader reads new application firmware using some kind of communication interface (like an SD card, USB as a device, serial port, USB memory stick etc.) and places it in MCU internal flash. This applies to "all" MCUs. If you are new to MCUs - don't start with the i....

0

It is a macro to access AVR IO address space registers, and in that address space, register 4 seems to be DDRB. You might want to actually use the datasheet as the register reference, instead of digging the info from avr-libc headers.

0

It seems this question is closely related to this one on StackOverflow. Anyway, the bottom line appears to be that it doesn't matter - just use the headers/libraries provided by AVR if you don't want the full explanation

0

I added these two lines and now it works. uint32_t first_val = TIM3->CNT; while ((HAL_GPIO_ReadPin (GPIOA, GPIO_PIN_2 && (( TIM3->CNT - first_val) < 8000) )));//continue after 1ms

3

Can I expect the RC oscillator to draw even less current than crystal one? You can expect nothing. However, a guideline to reading datasheets that I rather disdained when I heard it from an old guy with bushy white eyebrows 35 years ago, and which I've come to believe solidly since, is that if the parameter isn't mentioned in the datasheet, it's because ...

0

There are four methods to get code into a microcontroller. In order of accessibility: Bootloader. This is what the arduino uses. There is code running on the microcontroller that is capable of receiving and programming the internal flash over some interface. In this case UART. In System Programming (ISP) You use additional hardware to communicate with a ...

1

A STMicro ST-Link/V2 can be picked up for ~$22 from Mouser. A ST-Link/V3MINI is only$9.75 from Mouser. And then you have the MBed compatible STMicro Nucleo series which all have an on board ST-Link/V2-1, which can also be converted to a OEM JLink. The ones on the 64 and 144 pin models can be detached and used stand alone. They range in price from $10(... -1 Use an invert circuit to create an active HIGH signal. Connect the GPIO to an npn transistor base. Connect the collector with a pull up to the relay board and the emitter to ground. When the pin is low (like at startup) the relay input is high (from the pullup). If you switch the GPIO HIGH, the npn becomes conductive and pulls the relay input low. ... 0 I would say yes, at first it seemed weird to me, but there is an internal regulator that regulates the current that goes through the motor windings. A hint from the Datasheet page 17 -1 Have a look here: https://cdn.hackaday.io/files/1597066832861504/SimpleIsolatedZeroCrossDetector.pdf It is an improved version of the former EDN circuit: https://www.edn.com/design/analog/4368740/Mains-driven-zero-crossing-detector-uses-only-a-few-high-voltage-parts You may also read many related papers: http://sound-au.com/appnotes/an005.htm https://... 0 FIFO may be too slow. You will want to use DMA access. The M5Stack ESP32 Camera Module is using a OV2640 with a "hack" of the I2S interface because this ESP32 subsystem is able to DMA for the data. I read that the m5stack-grey ID for board option in "platformio. PICO-8 cartridges can be saved. https://m5stack.com/products/esp32-camera$8.39 Hopefully ...

3

PIC18F66K80: 7.5 Writing to Flash Program Memory The programming blocks are 32 words or 64 bytes. Word or byte programming is not supported.

0

The Bluetooth protocol is full duplex. But as far as I can see the A2DP doesn't support this. ....from the A2DP profile to the Handsfree Profile in order to run full duplex audio (this is not possible in A2DP)... A2PD is designed to uni-directionally transfer an audio stream in up to 2 channel stereo, either to or from the Bluetooth host.

1

2) I need dimming to be 0% when microcontroller is powered off. This becomes a bit non-standard immediately. If the driver outputs 0 % even at say 0.7 V, you may be able to cheat around this with a BJT pulling itself up until your MCU can take over and somehow defeat that. A NC relay comes to mind too if you can accept that. If 0 V is required on the DIM ...

14

It's far simpler to implement a UART transmission in software because you just bit-bang the output port until the bytes are sent. To implement a receiver, you have to do multiple checks on the bits as they arrive (such as waiting for the start bit) and parity checking and usually, you have to run at a much higher processing rate to ensure you can cope with ...

31

I'm not an electronics engineer, but I would go for using the TX operation as a software UART. For an RX operation, buffering is needed, and interrupts are needed not to miss information. This is typically handled by a hardware UART. For a TX operation, you only need to send information, which is happening when you want it (for receiving you don't know ...

3

Since you're a beginner at electrics/electronics, I strongly advise not attempting to modify the coffee machine or work with mains voltages unless you can find someone experienced to check your work. Instead, plug the coffee machine into a ready-constructed outlet that you can switch on and off using a signal from your Photon. If you're in the US then this ...

0

Replace the on/off switch with a "normally open" relay, then control the relay from the controlling device Alexa or whatever...

0

Actually, the animation of the assembly is quite revealing. See the tiny slots on the inner rim of the wheel? The sensing technology is probably optical, just like the scroll wheel in mice and trackballs.

2

There are a number of websites that do what you want; the ones I use most often (no affiliation) are Digi-key and Mouser. Both of these offer parametric search by both functions and footprint. You can also use individual manufacturer's sites, which will likely have more parts available, but distributors like those linked above sell parts from many different ...

3

The strategy would indeed be to go to the various manufacturer web sites and use their parametric search engines to narrow down the selection to 4 UARTS. Each manufacturer will have a slightly different search facility so you have adapt to that. One benefit here is that the number of main MCU manufacturers has been reduced in the recent decade due to ...

0

I don't think there are such website, at least they will not be supported by major brands, since it will show both their advantages, but also disadvantages compared to other MCUs. One MCU that has 4 UARTS is the ATmega2560, known from the Arduino Mega 2560, which has 4 UARTs. (see also the comment of Marcus Miller below). ST.com also has many MCUs having (...

1

You need to rewrite all of those functions as STM32F4 and STM32F1 have completely different clocks, different GPIOs . Changing GPIO pin is definitely not enough.+-

2

The microcontroller requires a steady DC supply. LED current is sourced from the microcontroller's Vdd pin. If no LED are lit, Vdd current is small. One LED lit draws about 10mA, which is sourced through Vdd. All eight LED will pull about 80mA from Vdd (a bit much). This current cannot be sourced from a DC supply having 670 ohms equivalent resistance that ...

0

Your voltage divider circuits seam OK to me. Given that there are no other requirements, this is a feasible way of measuring these voltages. Your question is too unspecific. It is always possible to improve something. It depends on what your requirements are. With the 10bit ADC of the Attiny85 you have a theoretical signal to noise ratio of 60.2dB. So this ...

0

I've been developing battery powered IoT devices now for over 10 years, and have found multiple methods to do this depending on what I'm trying to accomplish. If simply trying to find the low sleep current of a static system, I like to keep my setup relatively simple, and use common items you can find in most labs, and use basic electrical concepts. ...

0

You state that you can't change the software even though you ask how to do it. Since this doesn't make sense, here is a suggestion to invert the logic in hardware. From your question it might be that your circuit is approximately like this: simulate this circuit – Schematic created using CircuitLab Then you can change it into: simulate this circuit ...

2

Can I change the Initial LED Logic in software? I don't know why this has attracted so much comment - the answer is almost certainly "yes". It will require finding the part of the software that sets the output and inverting the value. Exactly how to do that we can't help you without the source code.

0

Sane PCB designs connect one side of the LED to 1 pin and the other side to Vdd or ground. Because MCU pins are valuable resources. If you for some reason don't have a sane PCB design but use 2 pins, then both MCU pins need to be configured as outputs or nothing will happen. A pin set as input cannot source/sink current. The anode of the LED needs to be ...

3

It is very well possible to use C++ on the AVR. Arduino has been doing it for ages. Unfortunately, avr-g++ does not ship with a C++ standard library (the successor to the old STL), so you have to rely on C++ core language features. C++, just like C, has many features that don't map well to small microcontrollers; you need to find out which ones. For starters,...

1

Low level "IC designers", that is those who are not designing MCUs etc are those using things like FPGAs or designing ASICs (Application Specific IC). FPGAs with millions of gates are now available and even amateurs can afford to use them. So if you want to create your own data flow computer, go for it.

-1

Given that you have no specifications for how this code should perform if it compiles, it's ok! It looks to me like it may behave strangely if the user presses two buttons at the same time, but I can't say for sure if that's a bug or not.

0

avrgcc is gcc and therefore it supports c++, but you have to tell it that you're compiling c++ if you want to use C++ syntax. This may be as simple as using .c++ as your file extension, or more complex depending on what your build chain is.

-1

Yes it has bugs. At least it fails to scan the column outputs in the correct 0x80,0x40,0x20,0x10 sequence.

5

Here is your code with the comments that it should have had all along added in, plus tables showing exactly what the shift operations are doing (the latter shouldn't be necessary for any experienced C programmer): #define KEYPAD A #define KEYPAD_PORT PORT(KEYPAD) #define KEYPAD_DDR DDR(KEYPAD) #define KEYPAD_PIN PIN(KEYPAD) uint8_t GetKeyPressed() { ...

6

In an abstract manner the code does this: for each pin PA6 to PA4 (column) set pin as output, driving '0' for each pin PA3 to PA0 (row) if pin reads '0' then return key code calculated as row*3+column return 0xFF as key code, meaning "no key" KEYPAD_PORT|= 0X0F; should preset the output register of the port with '0's for PA6 to ...

0

Thank you for the answers, it really made me think and I find solution of @Aaron and @Oldfart well fitting for one relay. Only, what I find disturbing is, when I have 16 charging capacitors by only 5V, 50mA power source, which means that the current will be divided. My conclusion is to use extra power source with suitable power rating as @AndersG said (I ...

0

The ground connection MUST be common to all device involved*. Without a continuous circuit there can be no current flow. The ULN200X is effectively just a group of Darlington open collector transistors in a package. You can "safely enough" drive each section with a correct voltage input (varies with the X in 200X) and then drive outputs that the Darlington ...

Top 50 recent answers are included