The circuit consists of a resistor in series with the voltage source connected to the inverting input of the OpAmp. The non-inverting input of the OpAmp is short circuited to ground(common). A resistor is connected to the output and provides a negative feedback path to the inverting input terminal.

inverting opamp and Since is connected to the common or ground terminal, Node 1 is said to be a virtual ground due to the virtual short circuit between the inverting and non-inverting terminals (which is grounded) as defined by the voltage constraints, The node voltage method of analysis is applied at node 1, By appling Equation , obtained from the virtual short circuit, and the constraint on the current as defined in Equation, Equation is simplified to Solving for the voltage gain, , Notice that the voltage gain is dependent only on the ratio of the resistors external to the OpAmp, and . The amplifier increases the amplitude of the input signal by this ratio. The negative sign in the voltage gain indicates an inversion in the signal.

The output voltage is also constrained by the supply voltages and , Using Equation , the maximum resistor ratio for a given input voltage is

实验

根据下图,计算增益和。如果,输出是多少?多大的输入电压幅值,会造成amplifier饱和?

inverting opamp example

Solution:

The output voltage is independent of the load resistor, , because of the low output resistance of the OpAmp. Therefore, the gain of amplifier is Using KCL at node a, The currents and are and Solving for yields, For and input voltage signal of 由于我使用的是模块,具体参考双电源供电。

要计算amplifier的linear region,输入幅值需要小于,

一些实验结果

总体效果

big picture

输入

黄色为输入,左下角一个格子为1v,而蓝色一个格子为5v。

liner op region

输入为2v左右导致输出饱和

发现输出的顶部已经不再是正弦波。和理论计算比较一致。

saturation

运算放大器需要类似的双电源供电。由于只有一个单通道的直流电压源,所以需要做一个双电源供电模块。

diff voltage

所需要的元件:

  1. 单通道电压源
  2. LM324N
  3. 47K电阻两个
  4. 1电容一个100电容两个
实现

参考文章:

https://blog.csdn.net/qq_41836400/article/details/98345011

修改include/apue.h

在include/apue.h增加

1
#include <sys/sysmacros.h>

修改stdio/buf.c

打开apue.3e/stdio/buf.c,搜索_LP64,大致在(文件的89~93行),将其删除

1
2
3
4
5
#ifdef _LP64
#define _flag __pad[4]
#define _ptr __pad[1]
#define _base __pad[2]
#endif

将is_unbuffered, is_linebuffered和buffer_size替换如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
int
is_unbuffered(FILE *fp)
{
return(fp->_flags & _IONBF);
}

int
is_linebuffered(FILE *fp)
{
return(fp->_flags & _IOLBF);
}

int
buffer_size(FILE *fp)
{
#ifdef _LP64
return(fp->_IO_buf_end - fp->_IO_buf_base);
#else
return(BUFSIZ); /* just a guess */
#endif
}

#else

#error unknown stdio implementation!

#endif

copy头文件和库

1
2
sudo cp ./include/apue.h /usr/include/
sudo cp ./lib/libapue.a /usr/lib/

oh-my-tmux

1
2
3
4
cd
git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .

add lines at the end of ~/.tmux.conf.local

1
2
3
4
5
6
7
8
9
10
11
12
13
	# force Vi mode
# really you should export VISUAL or EDITOR environment variable, see manual
set -g status-keys vi
set -g mode-keys vi

# replace C-b by C-a instead of using both prefixes
set -gu prefix2
unbind C-a
unbind C-b
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
set -g prefix M-o
bind M-o send-prefix

install zsh and oh-my-zsh

add 185.199.108.133 raw.githubusercontent.com t o/etc/hosts

1
2
3
sudo apt install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
chsh -s $(which zsh)

install nodejs

install nvm

1
2
3
4
5
6
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.zshrc
nvm list-remote
nvm install v20.8.0
node -v

npm源

1
npm config set registry https://registry.npmmirror.com

install hexo and pandoc

1
2
npm install -g hexo-cli
sudo apt install pandoc

install hexo-theme-next

1
2
cd blog
npm install hexo-theme-next

theme-next patch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
diff --git a/_config.yml b/_config.yml
index 5059e2e..e4daac4 100644
--- a/_config.yml
+++ b/_config.yml
@@ -40,8 +40,8 @@ custom_file_path:
# ---------------------------------------------------------------

favicon:
- small: /images/favicon-16x16-next.png
- medium: /images/favicon-32x32-next.png
+ small: /images/favicon-16x16.png
+ medium: /images/favicon-32x32.png
apple_touch_icon: /images/apple-touch-icon-next.png
safari_pinned_tab: /images/logo.svg
#android_manifest: /images/manifest.json
@@ -164,9 +164,9 @@ sidebar:
# Sidebar Avatar
avatar:
# Replace the default image and set the url here.
- url: #/images/avatar.gif
+ url: /images/maru.jpeg
# If true, the avatar will be dispalyed in circle.
- rounded: false
+ rounded: true
# If true, the avatar will be rotated with the cursor.
rotated: false

@@ -501,7 +501,7 @@ math:

# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support.
mathjax:
- enable: false
+ enable: true
# See: https://mhchem.github.io/MathJax-mhchem/
mhchem: false

@@ -712,7 +712,7 @@ firestore:
# Show Views / Visitors of the website / page with busuanzi.
# Get more information on http://ibruce.info/2015/04/04/busuanzi
busuanzi_count:
- enable: false
+ enable: true
total_visitors: true
total_visitors_icon: user
total_views: true
@@ -812,9 +812,11 @@ pdf:

# Mermaid tag
mermaid:
- enable: false
+ enable: true
# Available themes: default | dark | forest | neutral
- theme: forest
+ theme:
+ light: default
+ dark: dark


# ---------------------------------------------------------------
@@ -894,6 +896,7 @@ vendors:
# MathJax
# mathjax: //cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
mathjax:
+ enable: true

# KaTeX
# katex: //cdn.jsdelivr.net/npm/katex@0/dist/katex.min.css
diff --git a/layout/_partials/footer.swig b/layout/_partials/footer.swig
index f60ea9b..dc5f8e9 100644
--- a/layout/_partials/footer.swig
+++ b/layout/_partials/footer.swig
@@ -42,6 +42,12 @@
{%- endif %}
</div>

+<div class=BbeiAn-info">
+ {{ __('<E6><B5><99>ICP<E5><A4><87>') }} -
+ <a href="http://www.miitbeian.gov.cn/">20003462<E5><8F><B7></a>
+ </a>
+</div>
+
{%- if theme.footer.powered %}
<div class="powered-by">
{%- set next_site = 'https://theme-next.org' %}

下载emacs 29.1

  • gi t clone的方式,需要autogen一下

install dependencies

树莓派源

cat /etc/apt/sources.list

1
2
deb http://mirrors.aliyun.com/raspbian/raspbian/ bullseye  main non-free contrib rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ bullseye main non-free contrib rpi

安装emacs依赖

1
sudo apt install libxpm-dev libgif-dev libgnutls28-dev libgtk-3-dev libjpeg-dev libtiff-dev libncurses-dev libgccjit-10-dev

编译

1
2
3
./configure --with-native-compilation
make -j
sudo make install

树莓派小电台

参考炬峰的视频,来搞个电台玩玩。

r pi t x

1
2
3
4
5
6
7
8
git clone https://github.com/F5OEO/rpitx
cd rpitx
./install.sh

sudo reboot

cd rpitx
./easytest.sh # FmRds

windows安装SDR软件

  • 淘宝买一个软件无线电R820T2+RTL2832U
  • 下载地址

树莓派设置

audio输入输出设置

  • Audio Inputs - USB Audio Device
  • Audio Outputs - Analog

验证输入输出

1
arecord -f cd - | aplay -V sterio -

修改testfmrds.sh脚本

1
sudo arecord -f cd -D plughw:2,0 -c 2 - | sudo ./pifmrds -freq "$1" -audio -

修改/boot/config.txt

1
2
# Enable audio (loads snd_bcm2835)
dtparam=audio=off

测试

1
./testfmrds.sh 434

rplidar

build on the pi and dev machine

1
2
3
4
5
6
cd ~/code/dep_ws/src
git clone https://github.com/Slamtec/sllidar_ros2.git
cd ..
colcon build --symlink-install
source install/setup.bash
ros2 launch sllidar_ros2 view_sllidar_launch.py

for normal rplidar

1
sudo apt install ros-foxy-rplidar-ros

enable image

flowchart
    A[Driver Node] ---> B["/image_raw
    sensor_msgs/Image"] ---> C[Algorithms & Stuff]
    E["/image_raw/compressed
    sensor_msgs/CompressedImage"]
    B <-- image_transport_library/nodes --> E

install dependencies

on the dev machine

1
2
sudo apt-get install ros-foxy-v4l2-camera
sudo apt install ros-foxy-rqt-image-view

on the pi, add start_x=1 to /boot/firmware/config.txt

1
2
3
4
5
6
7
8
9
sudo apt install libtheora-dev libogg-dev v4l-utils
cd ~/code/dev_dep/src
git clone -b foxy https://gitlab.com/boldhearts/ros2_v4l2_camera.git
git clone https://github.com/ros-perception/image_transport_plugins.git -b foxy-devel
git clone https://github.com/ros-perception/image_common.git -b foxy
git clone https://github.com/ros-perception/vision_opencv.git -b foxy
git clone https://github.com/ros-drivers/usb_cam.git -b ros2
cd ..
colcon build --symlink-install

Launch the camera

1
2
3
cd ~/code/dev_ws
source install/setup.bash
ros2 launch articubot_one camera.launch.py

on the dev machine

1
2
3
4
cd ~/code/dev_ws
source install/setup.bash
rviz2 -d src/articubot_one/config/main.rviz
ros2 run rqt_image_view rqt_image_view

ros2 flow

stateDiagram-v2
    Command_Velocity --> Diff_Dirve_Controller
    state ros2_control {
        Diff_Dirve_Controller --> Hardware_interface: Req. Motor Velocities Velocity Cmd Interfaces
        Controller_Manager
        Hardware_interface --> Joint_State_Broadcaster: Encoder position state
    }
    Hardware_interface --> Car
    Joint_State_Broadcaster --> /joint_states
    /joint_states --> Off_to_robot_state_publisher

install packages

install ros2 controll

要注意的是如果ubuntu20.04都是源码编译ros,需要跳过这一步,因为会失败。总之我是通过源码编译的,因为树莓派在20.04系统64位的暂时没法烧录成功。

1
sudo apt install ros-foxy-ros2-control ros-foxy-ros2-controllers ros-foxy-xacro

需要从这里开始源码编译。

1
2
3
4
5
6
7
8
9
git clone https://github.com/ros/angles.git -b foxy-devel
git clone -b ros2 https://github.com/ros-drivers/ackermann_msgs.git
git clone https://github.com/ros-controls/control_toolbox.git -b foxy
git clone https://github.com/ros-controls/realtime_tools.git -b foxy-devel
git clone https://github.com/ros-controls/control_msgs.git -b foxy-devel
git clone https://github.com/ros-controls/ros2_controllers.git -b foxy
git clone https://github.com/ros-controls/ros2_control.git -b foxy
git clone https://github.com/ros/xacro.git
git checkout 2.0.7

~/.bashrc

1
2
source ~/ros2_foxy/ros2-linux/setup.bash
source /opt/ros/foxy/setup.bash

install joystick test

1
2
3
sudo apt install ros-foxy-joy joystick jstest-gtk evtest
evtest
jstest-gtk

install libserial

1
sudo apt install libserial-dev

joystick flow

stateDiagram-v2
    [*] --> Linux_Joystick_Driver
    Linux_Joystick_Driver --> Joy_Node
    Joy_Node --> /Joy
    /Joy --> /Other_Nodes
    /Other_Nodes --> /whatever
    /Joy --> e.g.teleop_twist_joy
    e.g.teleop_twist_joy --> /cmd_vel

ros2 joy

1
2
3
ros2 run joy joy_enumerate_devices
ros2 run joy joy_node
ros2 topic echo /joy

dev_ws

1
2
3
4
5
6
7
8
9
10
11
mkdir ~/code/dev_ws
mkdir src && cd src
git clone https://github.com/joshnewans/joy_tester
git clone https://github.com/joshnewans/diffdrive_arduino
git clone https://github.com/joshnewans/articubot_one
git checkout 174b3f31
git clone https://github.com/joshnewans/serial
git clone https://github.com/joshnewans/teleop_twist_joy
colcon build --symlink-install
source install/setup.bash
ros2 run joy_tester test_joy

config/my_controllers.yaml

1
2
wheel_separation: 0.177
wheel_radius: 0.042

description/ros2_control.xacro

1
<param name="enc_counts_per_rev">1321</param>

端午节到了,👨👩带我和妹妹一起去朱家尖。到了以后,我们在楼下的🍴里吃饭。吃完饭我们在酒店里睡觉。睡觉起来以后,我们一起到🏖️堆起了沙堡。第一步我先画好了我们的地盘。第二步,我们挖出了一条护城河。👨拿着大铲子,挖出了很深的一个坑。我想到了一个好主意,我把👨挖出来的土,都放在地盘的边缘上。第三步,我叫妹妹拿着🪣,打好多水倒进护城河里,我叫妈妈把这些泥土弄结实。而我把所有的泥土都弄到边线上。

后来我拿着大耙子,画出了一条护城河的边缘,然后我拿了一个小🔧,帮👨一起挖护城河。挖了一半,我感觉水不太够了。我和妹妹赶紧跑到海边,拿小🪣灌了一大桶水。我们赶紧跑回来,把水洒在护城河里。然后我赶紧拿起小工具继续挖呀挖。我们挖呀挖,挖呀挖,堆呀堆,堆呀堆,堆好了大半个沙堡。水又不够了,我和妹妹赶紧跑到海边,拿起水桶,刚准备灌水,忽然一阵🌊飘来,我和妹妹一起把水都给接了过来。我和妹妹大喊起来:“爸爸妈妈,马上就要涨潮啦!”我和妹妹急忙提起🪣,跑了回去。我们几个赶紧搭呀搭,搭呀搭,快速地搭了起来。只剩最后一点了,我们几个飞快地搭了起来。终于搭完了,只剩最后一个,就是挖护城河。我和妹妹赶紧来到海边,拿起🪣,这是又有一阵🌊飘来了。我和妹妹跑了回来,刚好👨👩挖好了护城河。我和妹妹把水都洒了进去。天色已经差不多了,我们也该吃饭了。我们到了🏨楼下,开始吃饭。吃完饭,我们准备去🚶‍♀️。

沙堡

🚶‍♀️的时候,我们走到了隔壁一家🏨里,到了那边,我看见了三只🐱。第一只🐱叫做“🍮”,第二只🐱叫做“咪咪”,第三只🐱叫做“小小”。那三只🐱真的好可爱。那三只🐱颜色各不相同。🍮的颜色是黑白相间的,咪咪的颜色是灰白色的,小小的颜色是跟🍮一样,是黑白相间的。🍮它喜欢吃猫粮和鱼条。咪咪喜欢吃狗尾巴草。小小它喜欢吃猫粮。我们跟🐱拜拜了以后就去🏨睡觉了。

咪咪

第二天,我们先到楼下吃了早饭。早饭非常丰富,有🍜,炒粉,粽子,还有好多好多好吃的。吃完早饭,我们去看了🐱。只看到了咪咪,剩下的🐱全没有看到。我们给咪咪喂了好多好多的草。后来我在那边知道,咪咪抓过很多很多的🐭。因为没有看到其他的🐱,所以👩带我们到海边去挖沙了。👩在旁边的🪨上,抓到了一只小🦀️。我和妹妹把沙子放在磨具里,做出了好多个冰淇凌。我们还在旁边堆了个小山,也就是沙子山。

到了中午,我们一起去吃完了午饭。吃完午饭,我们到🛏️准备睡觉。妹妹在🛏️唱了一首“找朋友”,找呀找呀找画人,找到一个画画人,敬个礼呀握握手,你是我滴画画人。起床了以后,我在楼下写作业,妹妹在旁边吵吵闹闹地玩。写完作业,我们一起玩,然后等雨停了,我们又来到了海边。我跟妹妹在旁边挖了一个大水坑。我和妹妹一起把水给填满,我和妹妹在水坑里蹦来蹦去,跳来跳去。

果果跳泥坑
可可跳泥坑

到了🌃,我们在旁边的店里吃了一顿晚餐。👩点了🦪,🐙,🐚,海瓜子,扇贝。我还喝了北冰洋,可乐。👨喝了🍺,杨梅酒。

我们吃完饭,回到家,躺在🛏️就睡着了。

第三天,我们刚起床,外面就哗哗哗地下了大雨,我发现了一句👩‍🏫叫我们的谚语:“有雨山戴帽,无雨半山腰”。我们准备回家了。我们告别了大海、🏖️,还有小🦀️,🐱。我们来到🚗上,高兴地回到了🏠。

真是一个快乐的端午啊!下一次🤷‍♀️👨👩还会带我们去哪里⛱️。我相信下次还会带我们去更好的地方玩!

0%