Can't Measure voltage of battery for solar power system - stm32f1

I want to measure the voltage battery by ADC of STM32F103C8T6 using resistor divider.
When the system starts, the value from STM32 is 6.35V but when the voltage battery reaches 6.45V the value of STM32 doesn't change.
I don't know about that. Please help me. Thank you so much.

Related

IMU/MEMS with high limit accelerometer and magnetometer

anyone know of an IMU sensor.
Price range of 5-17$.
That has a high accelerometer value of 50-200g and a magnetometer to measure the the Earth's orientation.
Update on mag and acc need to be 100Hz or higher.
I know i kan get one imu for each but i would like to have them combined to save space.
I'm using it to measure high rpm and high g crashing.
Im also designing the pcb myself so just a datasheet of the ic is fine.

Reading 4-20ma transmitter stm32 adc

I try to use 4-20 ma pressure transmitter
With stm32 internal adc
Problem reading is flacuating too much I have to take average for 128-256 reading to take stable reading
Is that normal solution or there is other way to filter data and transmitter signal ??
Many reasons can affect the reading stability. Basically grounding, PCB layout, input cables, noise on the uController supply pins, input RC filter, the ADC code...
I have a similar application using a current resistor of 162R from input connector to the same ground of the ADC input. Than a series resistor of 22k and a ceramic capacitor of 47nF to ground, placed close to the ADC pin.
With that I take 10 ADC measures and make an average. Signal is stable.
Please, share your code and circuit diagram...

How to find analog voltage period and average value of connected signal?

I'm using STM32 and i need to find analog voltage period and average value of connected signal which is connected to PC0. I need to read the analog voltage and find the period of signal. I need to write a c code.

High Frequency GPIO toggle AVR

I have a basic AVR setup with ATmega328P and a FreeRTOS kernel running on it. I want to toggle a GPIO pin set as output at high frequency between 30kHz-60kHz. The frequency of GPIO toggle is continuously determined by other RTOS tasks and function which is between 30kHz-60kHz.
I want to ask how to toggle the GPIO at such high frequencies that are constantly changing. I am using Atmel Studio 7. Please help.
If you plan to change the frequency at about let's say every 2 pulse then software MAY be a solution. If the frequency will stay for several 10th or 100ds of pulses, PWM is definitely the good way to do.
Of course you can manage PWM frequency and period on the go. You will need to read timer/counterX with PWM part of the datasheet. If you need always 50% duty cycle, §15.7.2 is the best way to configure. If you need both duty cycle and frequency the §15.7.3 is adapted.
Cover all the possible configuration would be to broad to write here but if you start implementation and experience issues you can ask new question.

Connect models in Matlab Simulink

Good day everyone!
I tried to make a circuit in matlab simulink, with an AC voltage, Resistor and Voltage measurement. AV voltage and Resistor connect quite well but voltage measurement can't connect the resistor connection.
how may I connect the voltage measurement to the resistor? Please help me thanks!
this is the circuit i want to simulate
I used different types of resistor, and Ac voltage but same results
In my opinion, your diode is from a different library (Simscape\Foundation Library\Electrical) than the voltage source, the resistance and the voltage measurement block (Power Systems...). Try to use blocks from the same Library.
See following picture for when I only use blocks from Simscape\Foundation Library\Electrical