arduino 呼吸灯

The world as we know it was recently taken by storm. That storm was the outbreak of the COVID-19 pandemic. This has in turn created a shortage of ventilators world wide which has led many people to foray into the world of ventilator design.

我们所知道的世界最近被风暴席卷了。 那场暴风雨是COVID-19大流行的爆发。 反过来,这又导致了全球呼吸机的短缺,这导致许多人涉足呼吸机设计领域。

There is just one problem: many people are basing their designs around the Arduino platform. While this may be good for a proof of concept, you do not want to use it for actual life support unless absolutely necessary.

只有一个问题:许多人都将他们的设计基于Arduino平台 。 虽然这可能对概念验证很有用,但除非绝对必要,否则您不希望将其用于实际生活支持。

This is because platforms like the Arduino were designed as a platform to be used in a learning environment. They were not designed for the real time, safety-critical design that is required to build ventilators.

这是因为像Arduino这样的平台被设计为在学习环境中使用的平台。 它们不是为构建通风机所需的实时,安全关键型设计而设计的。

However, there are some workarounds you can employ to adapt the platform for use in a makeshift emergency ventilator if one isn't available.

但是,如果没有可用的解决方案,可以采用一些变通办法来使平台适应临时使用的紧急呼吸机。

In this post we will discuss real time systems and safety-critical systems. Hopefully you can use some of these principles in your own ventilator control system designs to improve their safety and reliability.

在这篇文章中,我们将讨论实时系统和安全关键系统。 希望您可以在自己的呼吸机控制系统设计中使用其中一些原则,以提高其安全性和可靠性。

Since the target audience is mainly web developers trying their hand at embedded design, I will try to make this post as self contained as possible. Join me as we dive from the browser into the realm of embedded systems design and move closer to the hardware to design our ventilators.

由于目标读者主要是尝试嵌入式设计的Web开发人员,因此我将尽量使本文章自成体系。 加入我的行列,从浏览器进入嵌入式系统设计领域,并进一步靠近硬件来设计通风机。

嵌入式系统 (Embedded Systems)

For all its usefulness a ventilator is simply an embedded system. An embedded system is a system that is designed to carry out one function and to perform it well, with high reliability and minimal user intervention.

尽管具有所有用途,但呼吸机只是嵌入式系统。 嵌入式系统是一种设计用来执行一个功能并很好地执行它的系统,它具有很高的可靠性和最小的用户干预。

To accomplish this an embedded system consists of two components: a hardware system as well as a software component to run the hardware configuration.

为此,嵌入式系统包含两个组件:硬件系统以及用于运行硬件配置的软件组件。

A classical embedded system is typically powered by a control device which generally integrates RAM, ROM, as well as a host of embedded peripherals on board to allow the system to accomplish its task.

典型的嵌入式系统通常由控制设备提供动力,该控制设备通常集成RAM,ROM和板上的许多嵌入式外围设备,以使系统完成其任务。

Modern embedded systems can sometimes be based around an applications processor, which may integrate a GPU, multiple CPU cores, multimedia codecs and other devices. Though applications processors can be used in embedded systems, they are mainly used in general purpose computing systems such as a smartphone.

现代嵌入式系统有时可以基于应用处理器,该应用处理器可以集成GPU,多个CPU内核,多媒体编解码器和其他设备。 尽管应用处理器可以用于嵌入式系统,但它们主要用于通用计算系统,例如智能手机。

The software that runs on an embedded system is called firmware. It is called firmware because once written into ROM, it is not expected to change frequently.

在嵌入式系统上运行的软件称为固件。 之所以称为固件,是因为一旦写入ROM,就不会经常更改它。

Think of a ventilator. Its main purpose is to provide mechanical ventilation to keep patients alive. It performs one function and does it with a high degree of reliability, to such an extent that it can be used as a life support system. Very rarely do you find someone changing the firmware in such a device once deployed.

想想呼吸机。 其主要目的是提供机械通气以保持患者的生命。 它可以执行一项功能,并以高度的可靠性来做到这一点,以便可以将其用作生命支持系统。 部署后,很少有人会在这种设备中更改固件。

硬件组件 (The Hardware Component)

As stated previously, the embedded system has a hardware component which integrates RAM, ROM and other devices in one package. This device is called a microcontroller.

如前所述,嵌入式系统具有将RAM,ROM和其他设备集成在一个软件包中的硬件组件。 该设备称为微控制器。

There are several popular microcontrollers today. The PIC and AVR from Microchip Technology and the STM32 from STMicroelectronics are the most popular. The classic Arduino uses an AVR microcontroller at its core.

今天有几种流行的微控制器。 最受欢迎的是Microchip Technology的PIC和AVR和STMicroelectronics的STM32。 经典的Arduino在其核心上使用AVR微控制器。

Regardless of the manufacturer, the microcontroller will consist of a processor core, memory and a means to provide input and output also known as I/O.

不论制造商如何,微控制器都将由处理器内核,内存和提供输入和输出的方式(也称为I / O)组成。

Microcontrollers also consist of memory which are divided into two categories: data memory and program memory.

微控制器还包括存储器,分为两类:数据存储器和程序存储器。

Data memory is memory that is used to store data that will be used by the microcontroller during run time. It is typically a few tens to a few hundred kilobytes of SRAM. Data memory is volatile and is lost when power is removed from the device.

数据存储器是用于存储运行期间微控制器将使用的数据的存储器。 它通常是几十到几百千字节的SRAM。 断开设备电源后,数据存储器易失,并且会丢失。

Program memory on the other hand, actually stores the memory that will be used by the microcontroller. It consists of Flash (think the memory in your USB flash drive) or FRAM (Ferroelectric RAM) and is not volatile. The size of program memory typically ranges from a few bytes to a couple of megabytes on modern systems.

另一方面,程序存储器实际上存储将由微控制器使用的存储器。 它由闪存(请考虑USB闪存驱动器中的内存)或FRAM(铁电RAM)组成,并且不易挥发。 在现代系统中,程序存储器的大小通常从几字节到几兆字节不等。

The Input and Output (I/O) pins on the microcontroller are what allow the device to communicate with external devices such as sensors and other chips that perform various functions such as memory expansion and even adding additional I/O to the device.

微控制器上的输入和输出(I / O)引脚使设备可以与外部设备(例如传感器和其他芯片)通信,这些设备执行各种功能(例如内存扩展),甚至向设备添加其他I / O。

A microcontroller will also integrate peripherals for performing analog to digital (A to D) and digital to analog (D to A) functionality.

微控制器还将集成外设,以执行模拟到数字(A到D)和数字到模拟(D到A)功能。

This is because our world is analog in nature and Analog to Digital Conversion (ADC) will convert real world data into a format our microcontroller can process. If you have a voice recorder, a microphone sensor together with a microcontroller will convert your voice into a digital format and store it.

这是因为我们的世界本质上是模拟的,模数转换(ADC)会将现实世界的数据转换成我们的微控制器可以处理的格式。 如果您有录音机,麦克风传感器和微控制器将把您的声音转换成数字格式并存储。

The microcontroller may also have means to perform Digital to Analog Conversion (DAC) whereby digital data can be converted into an analog format that we can utilize in the real world.

微控制器还可以具有执行数模转换(DAC)的功能,从而可以将数字数据转换为我们可以在现实世界中使用的模拟格式。

In our voice recorder example, this would be applicable when you must play back your recorded voice. The stored digital information is converted to sound we can detect in our analog world.

在我们的录音机示例中,当您必须播放录制的语音时,这将适用。 存储的数字信息将转换为我们在模拟世界中可以检测到的声音。

When we combine all this we get a block diagram of typical microcontroller hardware.

当我们将所有这些结合在一起时,我们将获得典型的微控制器硬件的框图。

Now that we have a basic understanding of the hardware, let's look at the software component.

现在我们对硬件有了基本的了解,让我们看一下软件组件。

软件组件 (The Software Component)

As great as your hardware is, without the software to control it, it's as useful as a paper weight. Software in embedded systems typically fall into three basic categories:

就像您的硬件一样强大,没有软件来控制它,它就像纸张重量一样有用。 嵌入式系统中的软件通常分为三个基本类别:

  • cyclic execution systems,
    循环执行系统
  • finite state machine based systems, and
    基于有限状态机的系统,以及
  • systems build using a real time operating system.
    系统使用实时操作系统构建。

The difference between these three types of software systems is based on the way they handle tasks. When we speak about tasks, what we are talking about is the smallest unit of execution within your firmware.

这三种类型的软件系统之间的区别基于它们处理任务的方式。 当我们谈论任务时,我们所谈论的是固件中最小的执行单元。

循环执行系统 (Cyclic Execution Systems)

A cyclic execution system works by having all the program tasks contained in an infinite loop. These systems have one main program entry point, and then the system cycles through a list of tasks. This is the simplest type of firmware design and is used for basic systems.

循环执行系统通过将所有程序任务包含在无限循环中来工作。 这些系统具有一个主程序入口点,然后系统在任务列表中循环。 这是最简单的固件设计类型,用于基本系统。

This system will have a program entry point which would typically configure hardware and set up systems clocks and basic bring up tasks. Once the program enters into the infinite loop, it will perform Task one, then Task two and finally Task three.

该系统将具有程序入口点,该入口通常将配置硬件并设置系统时钟和基本启动任务。 一旦程序进入无限循环,它将执行任务一,然后执行任务二,最后执行任务三。

有限状态机 (Finite State Machine)

While the cyclic based execution system is simple and effective for most tasks, sometimes you need a little more control over program flow. When this occurs a designer may use what is known as a Finite State Machine (FSM) system.

尽管基于循环的执行系统对于大多数任务而言既简单又有效,但有时您需要对程序流进行更多控制。 发生这种情况时,设计人员可以使用所谓的有限状态机(FSM)系统。

In a FSM, we can think of each task as a state the machine can be in. The FSM will have an initial state and after that each state will execute based on some conditional statement. The coin acceptor turnstile is usually used (like the hello world of state machines) to explain the concept of a state machine.

在FSM中,我们可以将每个任务视为机器可以处于的状态。FSM将具有初始状态,然后每个状态将基于条件语句执行。 通常使用硬币接收器旋转门(就像状态机的世界一样)来解释状态机的概念。

We have a black dot which represents the initial state along with two states, locked and unlocked. The turnstile in a locked state will become unlocked once you insert a coin. Even if you push on the machine it will not unlock until you insert a coin. Once you insert a coin the machine enters into the unlocked state and will remain in that state as long as a coin a present.

我们有一个黑点,代表初始状态以及两个状态,即锁定状态和解锁状态。 插入硬币后,处于锁定状态的旋转门将被解锁。 即使您推动机器,在您插入硬币之前也不会解锁。 插入硬币后,机器将进入解锁状态,只要存在硬币,机器就会一直保持该状态。

If you push on the turnstile while in the unlocked state, that condition will cause the machine to transition into a locked state which it will remain in until a coin is entered again.

如果在未锁定状态下按下旋转门,则该状态将导致机器转换为锁定状态,并保持在该状态,直到再次输入硬币为止。

As simple as it seems, this method of modeling program tasks as states which transition based on conditions is a powerful method of embedded system firmware design. It is the method I use most often when designing my own systems.

看起来很简单,这种将程序任务建模为根据条件转换状态的方法是嵌入式系统固件设计的一种强大方法。 这是我设计自己的系统时最常使用的方法。

呼吸机是实时系统 (Ventilators are Real Time Systems )

Real Time Systems or RTS are systems which must meet strict requirements in terms of response times. In a real time system there is no room for compromise.

实时系统或RTS是必须在响应时间方面满足严格要求的系统。 在实时系统中,没有妥协的余地。

Such systems must guarantee that they will perform an action within a given time period. Failure to perform action within a certain time may lead to loss of life or serious damage to property.

此类系统必须保证它们将在给定的时间段内执行操作。 在一定时间内不执行操作可能会导致人员伤亡或财产严重损失。

This is the category of systems a ventilator falls into.

这是呼吸机所属的系统类别。

When a patient requires a ventilator, it is because they cannot breathe properly and need mechanical assistance to breathe required by a ventilator. A ventilator can perform Continuous Mandatory Ventilation (CMV) which means that the patient will be required to get a minimum number of breaths from the machine guaranteed.

当患者需要呼吸机时,是因为他们无法正常呼吸,需要机械辅助来呼吸呼吸机所需的呼吸。 呼吸机可以执行连续强制通风(CMV),这意味着需要患者从保证的机器中呼吸最少的呼吸次数。

Failure to provide the minimum number of breaths required will result in death of the patient. That means that the control electronics must be able to perform without failure.

未能提供所需的最少呼吸次数将导致患者死亡。 这意味着控制电子设备必须能够正常运行。

To accomplish this most real time systems will utilize what is known as a real time operating system (RTOS) to ensure that the many tasks to be performed by the device can all be performed without fail.

为了实现这一目标,大多数实时系统将利用所谓的实时操作系统(RTOS)来确保要由设备执行的许多任务都可以无故障地完成。

RTOSs use a scheduler to manage tasks and limit how each task utilizes resources. The kernel would manage how each task can utilize the hardware resources based on their priority.

RTOS使用调度程序来管理任务并限制每个任务如何利用资源。 内核将根据优先级来管理每个任务如何利用硬件资源。

Think of the current makeshift ventilator designs that exist. The most promising ones are built using a bag-valve resuscitator that uses motors to actuate mechanical arms that press on the bag-value resuscitator and perform the ventilator functions.

考虑一下现有的临时通风机设计。 最有前途的是使用袋阀复苏器制造的,该袋阀复苏器利用电动机来驱动机械臂,这些机械臂压在袋装价值复苏器上并执行呼吸机功能。

However what will happen if the motor fails? Maybe we can add an infrared or ultrasonic sensor that will measure distance of the the mechanical arm from a certain point and ensure it reaches a particular distance. These sensors can also ensure that it returns to the starting point.

但是,如果电动机发生故障,会发生什么? 也许我们可以添加一个红外或超声波传感器,该传感器将测量机械臂到特定点的距离并确保其达到特定距离。 这些传感器还可以确保其返回到起点。

However the main microcontroller reading those sensors needs time to process the information. What if a sensor fails? Must the microcontroller lock up waiting for sensor data? Will a failure in sensor prevent the motor from being actuated on time?

但是,读取这些传感器的主微控制器需要时间来处理信息。 如果传感器出现故障怎么办? 微控制器必须锁定以等待传感器数据吗? 传感器故障会阻止电动机按时启动吗?

To ensure each task takes place at a certain time, the scheduler will only allocate processing time to the task as designated by the system designer.

为了确保每个任务都在某个特定时间发生,调度程序将仅将处理时间分配给系统设计人员指定的任务。

That way if a sensor fails, once the time allocated to reading that sensor has passed, the microcontroller will move on to the other task of actuating the motor which will keep the system running.

这样,如果某个传感器发生故障,则在分配给该传感器的读取时间过去之后,微控制器将继续执行启动电动机的其他任务,这将使系统保持运行。

Using a Real Time Operating System in your design will guarantee that your device will be able to perform its function within the specified time.

在设计中使用实时操作系统将保证您的设备能够在指定时间内执行其功能。

通风机是安全关键系统 (Ventilators are Safety Critical Systems)

In the previous section we discussed real time operating systems. I think we should expand our discussion a little and talk about hard real time vs soft real time systems.

在上一节中,我们讨论了实时操作系统。 我认为我们应该扩大讨论范围,并讨论硬实时与软实时系统。

In hard real time systems, the requirement of operation is that it MUST happen within the specified time at all costs, and failure to meet deadlines is not acceptable. Air traffic control systems and ventilator systems fall into this category.

在硬实时系统中,操作的要求是必须在规定的时间内不惜一切代价进行操作,并且不能接受不符合期限的情况。 空中交通管制系统和通风系统属于这一类。

Hard real time systems are not allowed to miss deadlines.

硬实时系统不允许错过最后期限。

In soft real time systems, it is preferred that deadlines are met. But if deadlines are not always met it means that it may upset the end user but may be acceptable. Think of an online gaming platform. We would like to have real time response of our games, but if you miss a few frames it will not result in loss of life.

在软实时系统中,最好满足截止日期。 但是,如果不能总是满足最后期限,则意味着可能会使最终用户不满,但可以接受。 想想一个在线游戏平台。 我们希望对我们的游戏有实时响应,但是如果您错过了几帧画面,则不会导致生命损失。

Soft real time systems are allowed to miss deadlines.

软实时系统允许错过最后期限。

Now, a lot of people mistake a real time system with a safety critical system. Not all real time systems are safety critical systems. Think of the example above with online gaming or video conferencing – such systems require real time performance but they are not safety critical in nature.

现在,许多人将实时系统与安全关键系统相混淆。 并非所有的实时系统都是安全关键系统。 想想上面有关在线游戏或视频会议的示例–这种系统需要实时性能,但本质上对安全性不是至关重要的。

What makes a safety critical system (SCS) different from a regular real time system is that failure to meet a deadline within a safety critical system will result in death or serious property loss.

使安全关键系统(SCS)与常规实时系统不同的原因在于,未能在安全关键系统内按时完成任务将导致死亡或严重的财产损失。

In a safety critical system, stoppage of the system is NOT an option.

在安全关键系统中,不能选择停止系统。

For example a high availability system real time system may be specified as having an up time of around 99% in a 24 hour period.

例如,可以将高可用性系统实时系统指定为在24小时内具有大约99%的正常运行时间。

Think about a ventilator system.

考虑一下通风系统。

Which 1% of the day is it acceptable to have the ventilator not operational? Since we have 1440 minutes in a day, which 14.4 minutes of the day should the patient not be allowed to breathe?

呼吸机每天不运转哪一天的1%是可以接受的? 既然我们一天有1440分钟,那该不应该让患者每天呼吸14.4分钟?

Arduino平台 (The Arduino Platform )

At this stage in our discussion, I think it's best we talk about the Arduino platform for use in safety critical systems.

在我们讨论的这个阶段,我认为最好是讨论用于安全关键系统的Arduino平台。

In our discussion of embedded systems, we talked about hardware and software, however did you know that there is also the development tools component of the design process?

在讨论嵌入式系统时,我们谈到了硬件和软件,但是您是否知道设计过程中还包含开发工具组件?

You see, in order to put the software you have written into the microcontroller device running the hardware, you need to use development tools such as an IDE and toolchain to program the device.

您会看到,为了将编写的软件放入运行硬件的微控制器设备中,需要使用开发工具(例如IDE和工具链)对设备进行编程。

Setting up and using a toolchain was a painful process depending on the device you were using. Many microcontroller vendors used to provide clunky IDEs that you had to be a seasoned embedded designer to use (though this has changed in recent years).

根据所使用的设备,设置和使用工具链是一个痛苦的过程。 许多微控制器供应商过去常常提供笨拙的IDE,您必须是经验丰富的嵌入式设计人员才能使用(尽管近年来情况有所改变)。

Additionally you also needed knowledge of the underlying hardware, and configuring registers and clocks can be daunting even for experienced designers.

此外,您还需要了解基础硬件,即使对有经验的设计人员而言,配置寄存器和时钟也可能令人生畏。

Even if you overcame these hurdles on the software side, you needed to have a Printed Circuit Board (PCB) or have experience using a breadboard to get your microcontroller running.

即使您克服了软件方面的这些障碍,也需要具有印刷电路板(PCB)或使用面包板来使微控制器运行的经验。

It you did not know how to properly connect your hardware, even if your program was correct, the device would not run and troubleshooting the hardware also required some experience.

您不知道如何正确连接硬件,即使您的程序正确无误,设备也将无法运行,对硬件进行故障排除也需要一定的经验。

In order to address the problem, the Arduino platform was introduced as a way to provide synergy between hardware, software, and development tools to allow students control hardware with ease.

为了解决该问题,引入了Arduino平台,以在硬件,软件和开发工具之间提供协同作用,从而使学生能够轻松控制硬件。

The Arduino provides a physical board with the chip that is in a configuration known to work along with a simple IDE with tons of libraries. This seamless integration makes a less intimidating foray for beginners looking to get into the realm of hardware design.

Arduino提供了一块带有该芯片的物理板,该板的配置可与带有大量库的简单IDE一起使用。 这种无缝集成为希望进入硬件设计领域的初学者提供了更少的威胁。

在安全关键系统中使用Arduino的问题 (The Problem with Using Arduino in Safety Critical Systems)

There is one problem: since the Arduino is so easy to use, this has led many people to use the Arduino far beyond what the platform was originally intended for, including use in real time systems.

有一个问题:由于Arduino易于使用,这导致许多人使用Arduino远远超出了平台的初衷,包括在实时系统中使用。

It's not recommended to use the Arduino for real time systems. Why? Some people may argue that you can use an operating system such as Amazon FreeRTOS on the Arduino and make it real time. That is true. But while the platform does become real time and it will make it highly reliable, it will not make it a safety critical one.

不建议将Arduino用于实时系统。 为什么? 有人可能会争辩说,您可以在Arduino上使用Amazon FreeRTOS之类的操作系统并将其实时化。 那是真实的。 但是,尽管该平台确实可以实时运行并且将使其高度可靠,但它并不会成为安全性至关重要的平台。

What makes the Arduino not suitable for use in safety critical systems? The answer lies in abstraction and its relation to the testing and debugging capability of the platform.

是什么使Arduino不适合用于安全关键型系统中? 答案在于抽象及其与平台测试和调试功能的关系。

The Arduino is a good platform for learning, and as such it adds a lot of software abstraction to make things easy.

Arduino是一个很好的学习平台,因此它添加了许多软件抽象以使事情变得容易。

Abstraction in itself is not necessarily a bad thing. Abstraction allows for code reuse and can help eliminate bugs if used correctly. Properly tested code that abstracts away a lot of the hardware can be a powerful tool in the right hands.

抽象本身不一定是一件坏事。 抽象允许代码重用,并且如果正确使用可以帮助消除错误。 经过适当测试的代码可以抽象出许多硬件,可以在正确的地方使用强大的工具。

However abstraction does NOT eliminate bugs and there is the problem. Even if code is abstract, if it had faulty logic to begin with then abstraction will not save you.

但是抽象不能消除错误,这是有问题的。 即使代码是抽象的,但如果逻辑开头有误,那么抽象也无法挽救您。

If you find a bug, usually you would rely on a debugger and software tests to help you figure out the source and improve the system reliability.

如果发现错误,通常将依靠调试器和软件测试来帮助您找出源并提高系统可靠性。

Therein lies the problem. The Arduino platform has no debugging capability.

问题就在这里。 Arduino平台没有调试功能。

Having no debugging makes bugs difficult to track. Having software that a bug free is crucial in a safety critical design. Additionally running tests on your code is not easy as the IDE is too simple for the powerful debugging and testing that is required for safety critical system design.

没有调试会使错误难以跟踪。 在安全关键型设计中,拥有无缺陷的软件至关重要。 此外,在代码上运行测试并不容易,因为IDE对于安全性至关重要的系统设计所需的强大调试和测试来说太简单了。

If you have no choice you can use the Arduino for design of a ventilator system. But the lack of debugging makes it difficult to do so and increases the likelihood of bugs in your firmware, and increases the risk of failure within the system.

如果您别无选择,可以使用Arduino设计呼吸机系统。 但是,由于缺乏调试,因此很难进行调试,并且增加了固件中出现错误的可能性,并增加了系统内部发生故障的风险。

如何设计好的临时系统? (How Can I Design a Good Makeshift System?)

If you must design a ventilator system, there are two specific things you can do to improve your design based on the Arduino: You can improve the software design and improve the hardware design.

如果必须设计呼吸机系统,则可以基于Arduino进行两项特定的工作来改进您的设计:您可以改善软件设计并改善硬件设计。

在软件方面改进设计 (Improving Design on the Software Side)

All hope is not lost. To make sure your system has reliable software consider doing the following:

所有希望都不会丢失。 为确保系统具有可靠的软件,请考虑执行以下操作:

  1. Consider using Another IDE - Atmel Studio is a great IDE that provides the option for debugging if you use an external debugger such as the Atmel ICE or ICD 4 debugger. Additionally MPLAB X can be used. These IDE's will assist with debugging.
    考虑使用另一个IDE-Atmel Studio是一个很棒的IDE,如果您使用外部调试器(例如Atmel ICE或ICD 4调试器),它提供了调试选项。 另外,可以使用MPLABX。 这些IDE将帮助调试。
  2. Adhere to a C/C++ coding standard - Using a code standard can improve your system reliability and make your system design more efficient. Consider rewriting the libraries you are using to adhere to MISRA, JSF++ or even the Barr Group's embedded C coding standard
    遵守C / C ++编码标准-使用编码标准可以提高系统可靠性,并使系统设计更高效。 考虑重写您用来遵守MISRA,JSF ++甚至Barr Group嵌入式C编码标准的库
  3. Use an RTOS - Many of the ventilator designs based on the Arduino utilize the platform as is with a cyclic execution system in place. Consider using the Amazon FreeRTOS to make your system real time. This would avoid system lockup and make your system more reliable.
    使用RTOS-许多基于Arduino的呼吸机设计都像使用循环执行系统一样利用该平台。 考虑使用Amazon FreeRTOS使您的系统实时。 这样可以避免系统锁定,并使系统更可靠。
  4. Consider using a Platform with Libraries that meet Safety Requirements – While not ideal for inexperienced designers, using a device that has libraries that already have existing safety requirements will help make your design more robust.

    考虑使用具有满足安全要求的库的平台–尽管对于经验不足的设计人员而言不是理想选择,但使用具有已经具有现有安全要求的库的设备将有助于使您的设计更坚固。

    For example even though our device is a makeshift medical device, using IEC 60730 requirements for Class B safety can help make your design more robust. Microchip Technology (company that makes the chip that powers the Arduino) has other devices that has libraries that meet Class B safety requirements and would aid in improving device safety.

    例如,即使我们的设备是临时医疗设备,使用IEC 60730的B级安全要求也可以使您的设计更坚固。 Microchip Technology(制造为Arduino供电的芯片的公司)拥有其他设备,这些设备的库符合B级安全要求,并有助于改善设备安全性。

  5. Implement Sensor Data Analytic Redundancy - When designing your device consider using sensors to ensure the device is still operational and when you do, consider using analytic redundancy methods to aid with more accurate sensor data.
    实施传感器数据分析冗余-在设计设备时,请考虑使用传感器以确保设备仍可运行,在使用设备时,请考虑使用分析冗余方法来帮助获得更准确的传感器数据。
  6. Consider using SAFERTOS - While it may require you to change systems SAFERTOS is pre-certified for use in medical systems and will provide a higher level of safety that the software of the Arduino platform.
    考虑使用SAFERTOS-尽管可能需要您更换系统,但SAFERTOS已通过预先认证,可用于医疗系统,并且将提供比Arduino平台软件更高的安全性。

在硬件方面改进设计 (Improving Design on the Hardware Side)

To improve your design on the hardware side:

在硬件方面改善设计:

  1. Consider using a Watch Dog Timer - If you don't have time to use an RTOS, a simple way to ensure your device keeps operating is to use a watchdog timer in your design. The watchdog timer ensures the device resets if a problem occurs in the execution of your code.
    考虑使用看门狗定时器-如果您没有时间使用RTOS,确保设备保持运行的一种简单方法是在设计中使用看门狗定时器。 看门狗定时器可确保在代码执行过程中出现问题时设备复位。
  2. Use a Hardware Device with Pre-existing Safety Certifications and Libraries - Some devices are better suited for the task of a ventilator design. Rather than entrust a safety critical design to an Arduino, consider using a control device that can use software that is already certified for medical device use or provides safety libraries.

    使用具有预先存在的安全证书和库的硬件设备-一些设备更适合通风机设计任务。 与其将安全性至关重要的设计委托给Arduino,不如考虑使用一种控制设备,该设备可以使用已经通过医疗设备使用认证的软件或提供安全库。

    The SAFERTOS supported platforms is a good place to start. The Microchip Technology web page on Class B safety software is also a good place to start.

    SAFERTOS支持的平台是一个不错的起点。 B类安全软件上的Microchip Technology网页也是一个不错的起点。

  3. Add Feedback Systems - It is not enough to have your device up and running. You also need feedback systems to ensure devices are operating as they should. Integrate sensors to provide feedback on mechanical parts that are subject to failure.
    添加反馈系统-仅启动和运行设备是不够的。 您还需要反馈系统,以确保设备正常运行。 集成传感器以提供有关可能发生故障的机械零件的反馈。
  4. Consider Distributed Hardware Control- Though many persons base their designs on a single chip consider using multiple microcontrollers in your design. Consider having one device for control and another for notifying the end user if a component is failing.
    考虑分布式硬件控制-尽管许多人的设计基于单个芯片,但在您的设计中考虑使用多个微控制器。 考虑拥有一台用于控制的设备,而另一台用于在组件出现故障时通知最终用户的设备。
  5. Implement System Redundancy - Having a proper shutdown system with a proper transfer system is crucial for such designs. Implement a proper shutdown procedure in case the system fails as well as have a proper switch over mechanism to ensure you have a 100% up time on your system.
    实现系统冗余-对于此类设计,拥有适当的关机系统和适当的传输系统至关重要。 如果系统出现故障,请执行适当的关闭程序,并具有适当的切换机制,以确保系统具有100%的正常运行时间。

结语 (Wrapping Up)

In this post we looked at embedded systems, briefly talked about their hardware and software components, and touched on firmware design paradigms. We also talked about real time systems and safety critical systems as it relates to ventilator design.

在本文中,我们研究了嵌入式系统,简要讨论了它们的硬件和软件组件,并介绍了固件设计范例。 我们还讨论了与呼吸机设计有关的实时系统和安全关键系统。

Finally, we talked about how to improve the safety and reliably of your Arduino-based ventilator designs by improving the hardware and software design.

最后,我们讨论了如何通过改善硬件和软件设计来提高基于Arduino的呼吸机设计的安全性和可靠性。

By the end of this post you should have some understanding of how to enhance your makeshift Arduino ventilator system.

在本文结束时,您应该对如何增强临时的Arduino呼吸机系统有一些了解。

If you wish to learn more about microcontrollers, pick up my book "Programming PIC Microcontrollers with XC8" where you will learn about the PIC microcontroller and how to program it. This microcontroller can also be used to design your ventilators and will give you a greater degree of control and debugging capability than the Arduino platform.

如果您想了解有关微控制器的更多信息,请阅读我的书“用XC8编程PIC单片机”,在其中您将了解PIC单片机及其编程方法。 与Arduino平台相比,该微控制器还可用于设计通风机,并为您提供更大程度的控制和调试功能。

Read the book here:

在这里阅读这本书:

https://www.apress.com/gp/book/9781484232729

https://www.apress.com/gp/book/9781484232729

翻译自: https://www.freecodecamp.org/news/programming-the-electronics-for-covid-19-ventilators/

arduino 呼吸灯

arduino 呼吸灯_如何改善您的Arduino呼吸机:用于临时COVID-19呼吸机设计的RTS和SCS简介...相关推荐

  1. android8 通知呼吸灯_android8 通知呼吸灯_说说8.0下 Android 通知(Notification)

    当运用程序不在前台运转,这时便借助关照( Notification )向用户发送少许提醒消息. 发出关照后,手机非常上方的状况栏中就会表现一个关照图标,下拉状况栏就会看到关照的细目. 1 根基用法 / ...

  2. android8 通知呼吸灯_说说8.0下 Android 通知(Notification)

    当运用程序不在前台运转,这时便借助关照( Notification )向用户发送少许提醒消息. 发出关照后,手机非常上方的状况栏中就会表现一个关照图标,下拉状况栏就会看到关照的细目. 1 根基用法 / ...

  3. android8 通知呼吸灯_正在消失的功能,为什么越来越多的手机没有呼吸灯?你知道原因吗...

    正在消失的功能,为什么越来越多的手机没有呼吸灯?你知道原因吗 其实说到手机呼吸灯,大家应该都不陌生,毕竟如果你有心心念念的人儿,每次呼吸灯闪烁,都会迫不及待的打开手机查看消息,想看看是不是TA给自己发 ...

  4. android8 通知呼吸灯_手机呼吸灯那么好用!为什么要取消它?没有呼吸灯真的好吗?...

    说起手机的呼吸灯相信大家应该都是不会陌生吧,当我们手机内有消息的时候,呼吸灯就会亮起,甚至是有些手机的呼吸灯还可以因为不同的消息设置不同的提示颜色,随着智能手机的发展,相比过去单调的设计,有的厂商为其 ...

  5. PWM脉冲宽度调制,实现呼吸灯_领航者开发板

    1.脉冲宽度调制(Pulse Width Modulation,PWM) 仅从本次实验(呼吸灯)的角度进行解释:通过不断调节信号的占空比来改变LED灯的亮度,如占空比逐渐递增会使得LED逐渐变亮,占空 ...

  6. 【跟着江科大学Stm32】STM32F103C6T6_实现呼吸灯_代码

    PWM.h #ifndef __PWM_H #define __PWM_Hvoid PWM_Init(); void PWM_SetCompare1(uint16_t Compare);#endif ...

  7. android8 通知呼吸灯_手机没有呼吸灯?这款APP帮你实现手机通知“可视化”

    7月6日消息,现在越来越多的手机因为全面屏设计导致了LED通知灯被移除.对于这一问题,外媒Phone Arena称,一位安卓程序开发人员开发了一款名为"通知好友"(Notify B ...

  8. arduino 休眠 节能_魔法书3:让 Arduino 慢下来 20倍省电

    我是潘,曾经是个工程师.这是 "Arduino 魔法书" 系列的专栏.上节课介绍了怎么让Arduino 全速运行,但大部分时候我们更希望 Arduino 能慢下来,节省更多的电能, ...

  9. arduino 有源 蜂鸣器_穷创客教育之Arduino编程第十课:蜂鸣器电子琴

    欢迎注册,加入沙洋社区-我们的网上家园! 您需要 登录 才可以下载或查看,没有帐号?注册 x 穷创客教育之Arduino编程第十课:蜂鸣器电子琴 蜂鸣器又分为有源蜂鸣器和无源蜂鸣器两种,无源蜂鸣器的电 ...

最新文章

  1. 电脑录屏工具_屏幕录制工具有哪些?这些录屏软件须知
  2. python创建数据集_使用Python从图像创建数据集以进行人脸识别
  3. CRichEditCtrl 好象没有复制、粘贴的功能(Ctrl+C、Ctrl+v都不好用
  4. .NET Core 2.1预览分层编译特性
  5. MediaWiki 1.19.2 发布 - 开源 Wiki 系统
  6. matlab可达性分析,毕业论文 Petri网系统的可达性研究
  7. HDFS—常见面试题
  8. 大学计算机专业高考听力,高考英语听力测试对考生听力策略反拨作用的研究
  9. django默认缓存是多大_Django之缓存 - osc_fd8vzgsi的个人空间 - OSCHINA - 中文开源技术交流社区...
  10. 一个下课的时间带你手写promise!
  11. 虚拟化系列-Citrix XenServer 6.1 XenMotion与HA
  12. Fizz Buzz @leetcode Math
  13. UG模具设计从入门到精通
  14. wmv数字证( DRM)相关介绍与破解(收集整合)
  15. 计算机管理的事件id,事件查看器7035是什么意思_windows事件查看器常见ID代码含义详解...
  16. 微型计算机显卡型号,擦亮眼睛认准型号 移动显卡型号大解析
  17. Nginx 安装部署以及负载均衡
  18. 魔兽争霸dota内外网p2p联机玩游戏-不需要对战平台的联机
  19. 李沐动手学深度学习V2-NLP文本预处理和代码实现
  20. 空间直角坐标系、大地坐标系、平面坐标系、高斯平面直角坐标系

热门文章

  1. Swing 实现聊天系统 私发与群发
  2. html脱机不显示图片,Python绘图脱机图表嵌入HTML(不工作)
  3. iOS 计算两个日期之间的差值
  4. eclipse.ini内存设置
  5. java.lang.NoSuchMethodError: org.springframework.web.context.support.XmlWebApplicationContext.getEnv
  6. 新闻发布项目——业务逻辑层(newsTbService)
  7. ***和******
  8. Lumen / Laravel 5.5 使用网易邮箱 SMTP 发送邮件
  9. cmder里ls、pwd、自定义的alias等一系列命令都无法使用
  10. ASP.NET页面之间传递值的几种方式