2408 views|11 replies

6841

Posts

11

Resources
The OP
 

【RVB2601 Creative Application Development】Work Submission [Copy link]

 
 

Cold chain intelligent management system based on CH2601

Author: Liu Jianhua

  • Project Background

The author has been engaged in immunization planning for a long time. The top priority of immunization planning is the cold chain management of vaccines. From production to transportation, and finally to the recipient's body, vaccines have strict storage requirements. After the promulgation of the "Vaccine Management Law of the People's Republic of China", vaccine storage was regulated by law. We immunization planners often joke that we will violate the law if we are not careful. In the past, temperature monitoring was carried out manually, so vaccine management personnel did not rest, did not go to work and leave work, and were worried about what problems would occur in the storage of vaccines. Although there are many vaccine temperature monitoring systems now, the products are extremely expensive, and a temperature monitoring point costs thousands. The management software is not very standardized. The author, a physician who has no knowledge of single-chip microcomputers, started to learn single-chip microcomputer knowledge from scratch, from the original stm8L, to ESP8266, to the current flat head brother RVB2601, to provide cheap solutions for this field. Moreover, the current temperature monitoring system does not monitor the working status of cold chain equipment, and some alarm functions only have alarm actions when the temperature exceeds the alarm conditions. My work this time considers temperature monitoring + continuous monitoring of power supply voltage, current, and power consumption of cold chain equipment. Analyze the operating status of the equipment on the server side and issue early warning.

  • Introduction

This work is designed to collect the temperature of cold chain equipment, the working voltage, current, power consumption, and temperature of cold chain equipment, and upload them to the server through the Internet. The server also pushes them to the user's APP.

RVB2601 renderings:

thermometer:

Power Monitoring:

APP effect picture:

  • System Block Diagram

  • Functional description and analysis of each part (combined with pictures and text)
  1. Equipment information collection part: It is composed of power collection module + wireless serial port module. RVB sends collection data signal to the module, and the collection module returns real-time information.
  2. Temperature collection part: It consists of GD32F310G, NTC thermistor, and wireless serial port transparent transmission module. It collects data every 1 second and uploads it to RVB2601.
  3. Data receiving, displaying and uploading part: After RVB2601 receives the temperature, voltage, current and power consumption information from the wireless serial port module, it uploads it to the Alibaba Cloud IOT platform via wireless wifiW800.
  4. Alibaba Cloud IOT platform part: responsible for receiving data uploaded by RVB2601 and distributing it to user APP in real time.
  5. User APP: Public panel APP (Cloud Intelligence) provided by Alibaba Cloud, providing users with real-time data query and historical data browsing. Receive abnormal information.
  • Work source code
/*
 * Copyright (C) 2019-2020 Alibaba Group Holding Limited
 */

#include <stdlib.h>
#include <string.h>
#include <aos/aos.h>
#include "aos/cli.h"
#include "main.h"
#include "app_init.h"
#include "oled.h"
#include "aos/hal/uart.h"
#include "drv/rtc.h"
#include "http.h"

#define TAG "app"

extern int w800_living_wjap(const char *myssid,const char *mypassword);
extern int w800_living_idmau(const char *mykey,const char *myname,const char *mysecret,const char *mypsecretconst);
extern int w800_living_idmcon(void);

#define UART_BUF_SIZE   40
#define UART_TX_TIMEOUT 100
#define UART_RX_TIMEOUT 500

extern uart_dev_t uart1;
u8g2_t u8g2;
char disp_buff[40];

void w800_data_receive_callback(int linkid, void *data, size_t len, char remote_ip[16], uint16_t remote_ports);

static csi_rtc_t g_rtc;
static aos_task_t app_task1_handle;
static aos_task_t app_task2_handle;

char disp_Vrms[10]; //显示电压值
char disp_Irms[10]; //显示电流值
char disp_PActive[10]; //显示功耗值
char disp_Frequency[10]; //显示频率值
char disp_Temper[10];//显示温度
/* data buffer */

char uart_data_buf[UART_BUF_SIZE];

int iot_connect_dome(void)
{
    char *my_ssid = " ";//2.4GHZ WiFi ssid
    char *my_password = " ";//2.4GHZ WiFi password
     
	 char *my_key = " ";//ProductKey  
	 char *my_name = " ";//DeviceName
	 char *my_secret = " ";//DeviceSecret  
	 char *my_p_secret = "";//Product Secret  
     
    int ret1 = -1;
    int ret2 = -1;
    int ret3 = -1;
 
    ret1 = w800_living_wjap(my_ssid,my_password);
    if (ret1 == 0){
      printf("AT+WJAP:OK!\n");
    }
    else{
      printf("AT+WJAP:ERROR!\n");
    }
    ret2 = w800_living_idmau(my_key,my_name,my_secret,my_p_secret);
    if (ret2 == 0){
      printf("AT+IDMAU:OK!\n");
    }
    else{
      printf("AT+IDMAU:ERROR!\n");
    }
    ret3 = w800_living_idmcon();
    if (ret3 == 0){
      printf("AT+IDMCON:OK!\n");
    }
    else{
      printf("AT+IDMCON:ERROR!\n");
    }
    if(ret1 == 0 && ret2 == 0 && ret3 == 0){
      return 0;
    }else{
      return -1;
    }
}
/*
 * 功能:创建串口1接收任务,接收数据并把数据解析出来,存放在buff中,由U8g2显示函数定时刷新。上传服务器
 * 
 * 
 */
static void application_task1_entry(void *arg)
{
	int ret = -1;
	uint32_t rx_size = 0;
	float Irms=0;       //电流有效值
	float Vrms=0;       //电压有效值
	float Frequency=0;  //频率
	float PowerFactor=1;//功率因数
	float PActive=0;    //有功功率
	double W_KWH=0;     //累积功耗
	int n=0;
	const char *dev_id = "0";
	int pkt_id = 0;
	char report_buf[128];
    while (1) {
		ret = hal_uart_recv_II(&uart1, uart_data_buf, 24,
                               &rx_size, UART_RX_TIMEOUT);
	   // LOGD(TAG, "RECV len:%d data:%x",rx_size,uart_data_buf[0]);
        if (rx_size ==  24) 
		{
			if((uart_data_buf[0] == 0x55) && (uart_data_buf[1] == 0x55))
			{
				Vrms=(double)(((uint32_t)uart_data_buf[6]<<24)|((uint32_t)uart_data_buf[7]<<16)|((uint32_t)uart_data_buf[8]<<8)|((uint32_t)uart_data_buf[9]<<0))/1000.0;
				Irms=(double)(((uint32_t)uart_data_buf[10]<<24)|((uint32_t)uart_data_buf[11]<<16)|((uint32_t)uart_data_buf[12]<<8)|((uint32_t)uart_data_buf[13]<<0))/1000.0;
				PActive=(double)(((uint32_t)uart_data_buf[14]<<24)|((uint32_t)uart_data_buf[15]<<16)|((uint32_t)uart_data_buf[16]<<8)|((uint32_t)uart_data_buf[17]<<0))/1000.0;
				Frequency=(double)(((uint32_t)uart_data_buf[18]<<24)|((uint32_t)uart_data_buf[19]<<16)|((uint32_t)uart_data_buf[n++]<<8)|((uint32_t)uart_data_buf[20]<<0))/1000.0;
				sprintf(disp_Vrms,"%.1fV",Vrms);
				sprintf(disp_Irms,"%.2fA",Irms);
				sprintf(disp_PActive,"%.2fW",PActive);
				sprintf(disp_Frequency,"%.2fHz",Frequency);
				snprintf(report_buf,128,"{\\\"LightVolt\\\":%.1f,\\\"ActivePower\\\":%.2f,\\\"LightCurrent\\\":%.2f}",Vrms,PActive,Irms);
				w800_living_idmpp(dev_id, report_buf, &pkt_id);
				memset(uart_data_buf,0,24);			
			}
		
			else if((uart_data_buf[0] == 0x66) && (uart_data_buf[1] == 0x66))
			{
				if(uart_data_buf[2] == 0x01)
				{
					sprintf(disp_Temper,"-%d.%d C",uart_data_buf[3],uart_data_buf[4]);
					snprintf(report_buf,60,"\\\"temperature\\\":-%d.%d}",uart_data_buf[3],uart_data_buf[4]);
				}
				else
				{
					sprintf(disp_Temper,"%d.%d C",uart_data_buf[3],uart_data_buf[4]);
					snprintf(report_buf,60,"{\\\"temperature\\\":%d.%d}",uart_data_buf[3],uart_data_buf[4]);
				}
				
				w800_living_idmpp(dev_id, report_buf, &pkt_id);	
			}
		}
        aos_msleep(50);
		
    }

    aos_task_exit(0);
}


/*
 * 功能:创建串口1发送任务,向电源监控模块发送获取监控数据的命令
 * 
 * 
 * 
 */
static void application_task2_entry(void *arg)
{
	int ret = -1;
	uint8_t uart_tx_buf[] = {0x55,0x55,0x01,0x02,0x00,0x00,0xAD};
    while (1) {
		ret = hal_uart_send(&uart1, uart_tx_buf, sizeof(uart_tx_buf), UART_TX_TIMEOUT);
		if (ret == 0) {
			//printf("uart1 data send succeed !\n");
		}
        aos_msleep(1000);
    }
    aos_task_exit(0);
}


void test_getIP_task()
{
	char ssid[32];
	int bssid[6];
	int channel;
	int rssi;
	char disp[40];
	//先获取AP信息,判断是否联网
	//偿试连接到服务器
	//发送数据
	char ip[16];
	char gw[16];
	char mask[16];
	csi_rtc_time_t this_time;
	csi_error_t ret;
	int ipinfo = -1;
	
	while(1){

		
		//获取时间
		u8g2_ClearBuffer(&u8g2);
		u8g2_SetFont(&u8g2,u8g2_font_7x13_tr);
		u8g2_DrawStr(&u8g2,12,12,"Cold Manage SYS");//字符显示
		//u8g2_SendBuffer(&u8g2);
		u8g2_SetFont(&u8g2,u8g2_font_7x13_tr);
		u8g2_DrawStr(&u8g2,4,30,disp_Vrms);//显示电压值
		u8g2_DrawStr(&u8g2,80,30,disp_Irms);//显示电压值
		u8g2_DrawStr(&u8g2,4,50,disp_PActive);//显示功率值
		u8g2_DrawStr(&u8g2,80,50,disp_Temper);//显示频率值
		u8g2_SendBuffer(&u8g2);
		aos_msleep(500);
	}
}

void w800_data_receive_callback(int linkid, void *data, size_t len, char remote_ip[16], uint16_t remote_ports)
{
	
	uint8_t *buf;
	buf = (uint8_t *)data;
	if(len == 0)
	{
		return;
	}
	printf("receive data len: %d\r\n",len);
	printf("receive data:");
	for(uint16_t i = 0; i < len; i++)
	{
		printf("%c ",buf);
		
	}	
	printf("\r\n");
}


int main(void)
{

    board_yoc_init();
	
    LOGD(TAG, "%s\n", aos_get_app_version());
	u8g2Init(&u8g2);
	u8g2_SetFontMode(&u8g2, 1);
	u8g2_SetFont(&u8g2, u8g2_font_unifont_t_symbols);
	u8g2_ClearBuffer(&u8g2);
	u8g2_DrawStr(&u8g2,0,12,"RVB2601");//字符显示
	u8g2_SendBuffer(&u8g2);
	 sleep(5);
	aos_task_new("test_get ip", test_getIP_task,NULL, 1024);
	aos_task_new_ext(&app_task1_handle, "app_task1", application_task1_entry,
                     NULL, 4096, AOS_DEFAULT_APP_PRI);

    aos_task_new_ext(&app_task2_handle, "app_task2", application_task2_entry,
                     NULL, 4096, AOS_DEFAULT_APP_PRI);
					 
	iot_connect_dome();

    while (1) {
		
        aos_msleep(1000);
		
    }

    return 0;
}

VII. Project Summary

After more than two months of studying RVB2601, I learned about Pingtou Ge's operating system, wifi networking, the operation of Alibaba IOT cloud platform, etc., and I have a certain understanding of the various performances of Pingtou Ge RVB2601. This is a very promising chip.

  • other

Although I have achieved basic functions with this platform, there is still a certain gap between what I envisioned at the time, because I already have a real project running. Here I want to talk about this series of shortcomings, hoping to help the future development of the Alibaba Cloud platform.

1. Work order system: When you encounter a problem, it is very good to have a work order system, but this work order system is really depressing. I sent a work order, but there was no reply for a long time. When I replied, there was a series of questions. I kept questioning whether there was something wrong with me when I submitted the work order (Why would I contact you if I have no problem? I am an old engineer with more than ten years of experience. Would I contact you if I have nothing to do?). The efficiency is extremely low. I also wanted to return the board and interrupt the evaluation, but the staff persuaded me to continue to complete the project. I submitted a lot of work orders, which were basically completed after a week. Later, I asked for a DingTalk system for instant contact, and the processing effect was better. Here I say that Alibaba's technical support really needs to be strengthened.

2. The MQTT protocol has been open in other places of the W800 WiFi chip, but Pingtou Ge did not integrate the AT protocol this time. Compared with http, MQTT is lighter and more convenient for users to use.

3. My original design was to use my own server, but Pingtou Ge did not provide a solution for the https protocol, so it was very different from my original design.

4. NTP is a big pitfall. I spent several days trying to figure it out.

5. CDK also cost me a lot of time. There are so many versions, it's hard to adapt to them all at once. Engineers now have to use several IDEs, but CDK is the most frustrating IDE. For example: the file is clearly there and included, but it just says it doesn't exist. Also, when I first used it, it took more than ten minutes to start CDK, and it would get stuck at any time. And so on. I hope Pingtouge will improve this in future versions.

6. There is also a blog post system. You are asked to revise a blog post more than ten times before it is approved. We reviewers are not paid by your family. Isn’t this requirement too strict? It makes people upset just thinking about it!

7. APP update problem. After the panel is modified, it takes one hour to one day to update in real time on the mobile phone. I sent a work order, and the technical support said that I did not operate it correctly, so why did nothing change? The next day, or half a day later, it was updated by itself. It seems that the technical support of Alibaba work orders also needs to learn some business knowledge by themselves. It makes developers waste a lot of precious time.

In general, I have 20 years of programming experience, 6 years of MCU development, and have successfully developed more than a dozen chips. Although I am not a programming expert, I am not a novice. This time using Pingtou Ge was the most unpleasant experience. I spent a lot of useless work and handed in a lot of homework purely for the promise I made when I submitted the application.

Finally, I would like to thank all the friends who tried RVB2601 this time. I learned a lot from your excellent works. Thank you!

PS: Demonstration video

WeChat_20220622123148

Latest reply

Thumbs up, I really resonate with this summary. The development difficulty is indeed not small. Success lies in persisting to the end in order to complete the project!   Details Published on 2022-5-13 15:51
 
 

1455

Posts

1

Resources
2
 

Yes, the features of the two development boards are combined together.

 
 
 

1455

Posts

1

Resources
3
 

I agree with the summary!!!

Comments

Yes, I feel that the stuff of the honey badger is too bulky. Once you put it in, your head is soaked with water.  Details Published on 2022-5-10 23:34
 
 
 

6841

Posts

11

Resources
4
 
This post was last edited by lugl4313820 on 2022-5-11 07:07
jinglixixi posted on 2022-5-10 23:02 I agree with the summary!!!

Yes, I feel that the things of Flathead Brother are too bloated. Once I go in, I am completely confused.

 
 
 

280

Posts

7

Resources
5
 

The landlord has done a good job.

Regarding posting, here is a little tip. First, edit the format of the blog post in wps, leave space for pictures, and then paste it directly when posting. Finally, insert the pictures. You will find that posting is not so troublesome.

 
 
 

6773

Posts

2

Resources
6
 

I’m still not used to Pingtou Ge’s platform. I hope they can improve it slowly!

 
 
 

149

Posts

0

Resources
7
 

May I ask if the "cold chain equipment" mentioned in the article refers to the sum of equipment used in production, storage and transportation?

 
 
 

149

Posts

0

Resources
8
 

How is the current monitoring done here?

Comments

I bought a module for 10 yuan on a certain website. It seems to be a single-phase metering module, which can also collect current frequency, accumulated power consumption, etc.  Details Published on 2022-5-11 18:43
 
 
 

6841

Posts

11

Resources
9
 
Mengxi Kaiwu published on 2022-5-11 10:23 May I ask if the "cold chain equipment" mentioned in the article refers to the sum of equipment used in production, storage and transportation?

Cold chain equipment is defined from the perspective of the supply chain. Each product has its own uniqueness, and the supply chain of the product is also unique; frozen products are called frozen products because the environment in which the product is required is usually low temperature or low humidity, so the supply chain of frozen products is called cold chain; the equipment used to create a low temperature and low humidity environment is called cold chain equipment.

Specific cold chain equipment includes: low-temperature cold storage, normal temperature cold storage, low-temperature refrigerators, ordinary refrigerators, refrigerated trucks, refrigerated boxes, vaccine transport trucks, spare ice blocks, etc.

 
 
 

6841

Posts

11

Resources
10
 
Mengxi Kaiwu published on 2022-5-11 10:25 How is the current monitoring done here?

I bought a module for 10 yuan on a certain website. It seems to be a single-phase metering module, which can also collect current frequency, accumulated power consumption and other information.

 
 
 

297

Posts

0

Resources
11
 

I agree. CDK is really annoying to use.

 
 
 

20

Posts

1

Resources
12
 

Thumbs up, I really resonate with this summary. The development difficulty is indeed not small. Success lies in persisting to the end in order to complete the project!

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>
Featured Posts
PIC series microcontroller programming basics

This book is a great help to those who want to learn PIC microcontrollers. This book is a basic tutorial book and a good ...

During the epidemic prevention and control, don’t forget to have a date with spring!

Activity link: During the epidemic prevention and control, don’t forget to have a date with spring! Works Summary: " Da ...

TI C2000 LaunchPad uses official routines to compile and debug

488551488552488553488554488555488555488556488557488558488559

Hybrid beamforming: the new main force of future 5G construction

Beamforming is a mature technology used in cellular communications and other applications. Beamforming was originally de ...

[Flower carving DIY] Interesting and fun music visualization series of small projects (07) --- large square spectrum light

I had the urge to do a series of topics on sound visualization. This topic is a bit difficult and covers a wide range of ...

36 "Ten Thousand Miles" Raspberry Pi Car——ROS Learning (VSCode to Implement Hello World)

It is very convenient to run ROS projects in VSCode. In this section, we use ROS to write and run the "Hello world" pro ...

[HPM-DIY] HPM6750 USB open source protocol stack performance comparison - cherryusb or tinyusb?

Since the current hpm SDK uses tinyusb, the performance speed is still extremely unmatched with the high-speed USB of t ...

[The strongest open source] Hand-rubbed 120W switching power supply

I recently took the time to make a switching power supply 645265 645262 645263 645264 645261 645260

Network port isolation transformer network cable side protection and routing

662606 As shown in the figure above, the upper side is a network port isolation transformer, U43 is a clamping diode, th ...

Specific working principle of no-load protection circuit

668703 668704 The specific working principle of the no-load protection circuit, For example, if the input sine wave a ...

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list