基于物联网的温度采集系统(一):底层感知网络搭建

摘要:

本文为物联网温度采集系统底层感知网络搭建的一些项目经验分享,主要包括了Altium Designer 17、Keil uVision5等开发软件的使用,以及初期调试所需注意的一些问题。本系统选用STM32F103C8T6芯片作为核心控制器,温度芯片选用TMP275-Q1,采用WIFI模块进行数据传输。初期调试采用预留串口及外接OLED屏进行交互。
Abstract:
This article shares some project experience sharing for the underlying sensing network of the IoT temperature acquisition system, including the use of development software such as Altium Designer 17, Keil uVision5, and some issues that need attention during initial debugging. This system selects STM32F103C8T6 chip as the core controller, temperature chip selects TMP275-Q1, data transmission adopts WIFI module. The initial debugging uses a reserved serial port and an external OLED screen for data interaction.

硬件部分

1.AD17(Altium Designer 17 )的使用

想要制作一个物联网系统,底层感知网络的搭建是必不可少的,此次我们选用ARM公司的STM32F103C8T6作为主控芯片、TI公司的TMP275-Q1 作为传感器芯片搭建小系统版。小系统的电路设计采用的是AD17,AD17作为一款较成熟的制图软件,无论是在操作上还是开发上都有很多可圈可点之处,而且它的查错功能对后期板子开出来的可行性也提供了很好的保障。当然,这个过程千万不要忘了查找各个模块的数据手册,查清各个引脚的定义。
(下面放出主要的原理图和pcb图)
在这里插入图片描述
在这里插入图片描述

2.Keil uVision5的使用

搭建完小系统版后,好戏才刚刚开始,这个时候我们需要给他注入一点“生机”,让它能够自己把温度采集上来并发到服务器上去。这些功能我们通过C语言实现,用Keil uVision5进行编程烧写。
整体工程代码文件如下:
在这里插入图片描述
32作为库函数编程的典例,充分地展示了库函数编程的方便。而且由于是用C语言进行编程,其执行效率也是很可观的。搭建一个32工程就好比玩沙盘测试,所有的模块已经帮你准备好了,你只需要按照你的想法进行搭建就完事了。
(话不多说,上代码)

/*主函数代码*/

#include "stm32f10x.h"
#include "usart2.h"
#include "usart3.h"
#include "myiic.h"
#include "delay.h"
#include "tmp275.h"
#include "wifi.h"
#include "oled.h"

int num;
int number;
float i;
char crc[20];
char str[200];
char end[200];
char data[200];
char crc_reg[20];
char Temp_Result[20];

int main(void)
{
   	
	TMP275_Init();
	delay_init();
	Usart2_Init(9600);
	Usart3_Init(115200);
	WiFi_ResetIO_Init();
  OLED_Init();
  OLED_Clear();
  
	while(1)
	{
   
		OLED_ShowString(0,5,(u8*)"Connecting");
		if(Connect_flag==1)
		{
   
			TMP275_Read_Registers(0X00);
			i = TMP275_Get_Temp();//读温度
			sprintf(Temp_Result,"%.1f",i);//温度转字符串
			memset(data,0,sizeof(data));//清空
			sprintf(data,"%s%s%s%s;",ST,MN,Temp_Head,Temp_Result);//数据段组合
			
			
			number=strlen(data);//计算数据段长度
			
			if(number>=1&&number<10)
			{
   
				sprintf(str
  • 6
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值