High frequency generation ( 100K ) and above using Simulink and deploying it on Arduino

32 次查看(过去 30 天)
I trying to experment with simulink and interface it with arduino , my goal is to generate high frequency , but there is a limit and i know I saw a high frequency generated by arduino before , but how , is there any tutorial .
  3 个评论
Walter Roberson
Walter Roberson 2022-8-25
I am not clear on what it is that you wish to have happen at 100K? Is that 100K samples per second input? If so then how many channels, how many bits per channel, and what is the the acceptable latency?
Or is it a pwm output signal? If so then how frequently does it need to change pattern? If it is reacting to input, then how much latency of reaction is acceptable?
Ovaga Technologies
When it comes to generating high frequencies using Arduino and Simulink, there are a few considerations to keep in mind. Although Arduino boards are generally not designed for high-frequency applications, it is possible to generate relatively high frequencies with certain techniques. Here's a general approach you can follow:
1. Select the right Arduino board: Some Arduino boards, like the Arduino Uno, have limited processing power and may struggle to generate high frequencies. Consider using a board with a faster clock speed, such as the Arduino Mega or Arduino Due, as they are better suited for high-frequency applications.
2. Utilize timer/counters: Arduino boards have built-in timer/counters that can be configured to generate square wave signals at specific frequencies. By utilizing the timer/counters, you can achieve higher frequencies than using general-purpose I/O pins.
3. Employ direct port manipulation: If you require even higher frequencies, you can utilize direct port manipulation techniques to bypass the Arduino's digitalWrite() function, which can introduce significant overhead. Direct port manipulation allows for faster I/O operations, enabling you to generate higher frequencies.
4. Utilize external libraries: Arduino community libraries can provide additional functionalities for generating high frequencies. Libraries like the TimerOne and TimerThree libraries can help you leverage the built-in timer/counters more efficiently and generate precise high-frequency signals.

请先登录,再进行评论。

回答(4 个)

Walter Roberson
Walter Roberson 2022-8-16
If you are using the USB connector, and if you are transfering each sample individually, not many people manage to get more than 40 Hz or so. The theoretical limit is 1000 packets per second (with roughly 1000 bytes of data each time.)
If you are using an ethernet connection, the theoretical rate is significantly higher. I do not know what the practical limit is.
Some people are getting higher serial port rates with add-on ports; https://www.avrfreaks.net/forum/mega2560-board-usb-connection-speed
  1 个评论
MUSTAFA
MUSTAFA 2022-8-19
Can u please put a link for hardware and any other detachment that will be needed for this , another question after getting all of these ,can I still use simulink for flushing the codes , or there more thinks i may need to do in order to use the simulink , thanks

请先登录,再进行评论。


Arun Kumar
Arun Kumar 2022-8-25
编辑:Arun Kumar 2022-8-25
Hi Mustafa,
Don you mean the PWM frequency?
If yes, then you can specify the PWM frequency in the PWM block by selecting the specify option.
Hope this helps!
  8 个评论
Arun Kumar
Arun Kumar 2022-8-25
In MATLAB 2020a and later releases, it is possible to generate PWM with higher frequencies on Arduino.
Simply change the desired frequency parameter of the PWM block.
Some pins have certain limitations which is mentioned in the following page: https://www.mathworks.com/help/supportpkg/arduino/ref/pwm.html
Hope this helps.

请先登录,再进行评论。


Veswin Tang
Veswin Tang 2023-8-2
Choose the Right Arduino Board: Some Arduino boards, like the Arduino Uno, have a limited clock speed (16 MHz), which restricts the achievable frequencies. Consider using boards with higher clock speeds, such as Arduino Due (84 MHz) or Arduino Zero (48 MHz), for higher-frequency applications.
Use Timer/Counter Hardware: To generate higher frequencies, utilize the built-in Timer/Counter hardware of the Arduino. It allows precise and efficient control over pulse width and frequency.
Timer Libraries: Arduino libraries like "TimerOne" or "TimerThree" can help you set up timers for generating PWM signals and higher frequencies.
Direct Port Manipulation: By manipulating the digital pins' states directly using port registers, you can generate simple square wave signals with higher frequencies.
Simulink Arduino Support Package: Simulink has an Arduino Support Package that allows you to interact with Arduino boards and run Simulink models on the hardware. This package provides blocks to control the Arduino's digital and analog pins and can be utilized to generate high-frequency signals.
Use External Oscillator: If higher frequencies are needed, consider using an external oscillator or clock source that can drive the Arduino's clock input.
My website: https://www.veswin.com/

Avaq Semiconductor
Avaq Semiconductor 2023-9-27
Generating high-frequency signals with an Arduino can be challenging due to the limitations of the microcontroller's hardware. The Arduino Uno, for example, is based on the ATmega328P microcontroller, which has a maximum clock speed of 16 MHz. This clock speed determines the maximum frequency you can generate using the Arduino's built-in functions.
If you need higher frequencies, you can use techniques such as pulse width modulation (PWM) to generate square wave signals at frequencies higher than the Arduino's clock speed. However, the actual achievable frequency will depend on various factors, including the specific Arduino board you are using and the accuracy and stability of the generated signal.

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by