ohahaha

[Tuya Smart] Pet Smart Feeder

 
Overview

1.Project Introduction

This project chooses Tuya Smart's networking module WBR3 as the main networking module, and uses it with Hangshun's HAK32F030MF4P6 chip to achieve intelligent control of the cat feeder through the mobile phone. This work independently designed a cat-shaped casing, in which the driver RZ7899 chip is used to control the forward and reverse rotation of the DC motor, and the cat food is delivered by driving the push spiral tube to rotate. It is also equipped with an analog input interface for a weighing sensor, which can calculate and record the data of the kitten's meal.

2. Functional features

  1. The mobile phone connects the device through the Tuya Smart APP intelligent distribution network to realize wireless control of the Internet of Things;
  2. Support access to world time and configure scheduled feeding;
  3. Supports serial port program downloading and extraction of simulation interfaces, making program debugging more convenient;
  4. Built-in passive buzzer, editable music to remind cats to cook; (Start-up and shutdown music of XP system)
  5. 24-bit differential ADC module can accurately and quickly read the data of the weighing sensor, which can weigh up to 10kg;
  6. Powered by 7.4V lithium battery, the lithium battery needs to be removed and recharged;
  7. The speed and direction of the DC motor can be controlled through PWM. (To prevent cats from digging out food, there is no self-locking after all)

3. Component selection

  1. Main control MCU: HK32F030MF4P6, maximum frequency 32MHz, 20 pins, has I2C, I2S, SPI, UART and other communication interfaces, 2 callable timers, an advanced timer and a basic timer, each timer has 4 PWM channels, small package, easy to develop. (2 yuan! Super cheap!)
  2. Tuya Smart WBR3: IoT module, the package size is basically the same as ESP-12F, communicates with MCU through serial port, SDK transplantation is fast and convenient, supports intelligent distribution network, remote OTA firmware upgrade, Bluetooth, WiFi, etc., APP interface can be found on Tuya platform Customize; (Ask if it is convenient to connect to the Internet)
  3. The ADC module selects the CS1237 chip, 24-bit A/D digits, SPI reading and writing, built-in crystal oscillator, with powerdown function, maximum speed 1.1MHz, convenient and fast, and works well with a load sensor;
  4. It’s a simple passive buzzer circuit. There’s nothing much to say about it. It can beep, sound, and sing;
  5. AMS1117-3.3 was selected for the voltage stabilizing circuit. The 18650 lithium battery used this time is 7.4V. Although the voltage difference is large, it is not good enough because the current is not large. It has been verified that AMS1117-3.3 can withstand it for a long time and the heat generation is not high; 6. DC motor model: JGA25-370-0660.

4.APP interface

APP.jpg (Due to many things and time issues recently, the APP interface has not made many changes)

5. Structural model

The shell is designed in the shape of a cat. The feeder has four parts that need to be printed: upper shell, lower shell, push spiral tube, and conveyor sleeve. As for the grain storage bottle, it is a 900ml large tea bottle (the bottle mouth is large and the capacity is sufficient).

Printing material: PLA;
printing parameters: layer height 0.15mm, infill 50%, some structures need to be supported;
printing time: estimated to be about 34 hours; cat feeder.pngCat feeder.jpg

6.Programming

This work is based on the HK32F030MF4P6 main control and a 20-pin compact package. Its development method and code writing method are very similar to STM32, so that a novice like me who is using the 32 series microcontroller for the first time will not be unable to find resources ( ^▽^ ) .

Github address: [ https://github.com/BlackRain543/Cat-rice-dryer.git ]()

1. Custom libraries: led.h, motor.h, beep.h, delay.h, usart.h

  • led.h: Regarding the control of LED, just configure the pins, and control the high and low levels to turn on and off;
  • motor.h: In this work, RZ7899 is used as the motor driver, and the motor can be reversed or stopped by simply controlling the high and low levels of the pins according to its truth table;
  • beep.h: The control of the passive buzzer is realized by hand tapping the square wave method, which can realize basic prompt sounds and music playback, and adds the startup and shutdown music of the XP system.
  • [At the same time, I saved three pieces of music in it (the self-contained "Red Dust Love Song", the self-composed "Fireworks" and "The Wind Rises"), but I did not call it because I was worried that the kitten would not understand it);]
  • delay.h: Use timer interrupts to achieve ms-level and 10us-level delays (us-level delays cannot be achieved after testing);
  • usart.h: Serial port reception and transmission of single-byte data, required for subsequent SDK transplantation.

2. SDK official package:

system.h, mcu_api.h, protocol.h, wifi.h This part only modifies the content in protocol.h. Some mcu_api.h content is called in the main function, and there are not many other changes. For the main transplantation steps, refer to the first comment section in the protocol.c file.

7. Physical display

1.png2.jpg3.jpg4.jpg

8. Summary

Participating in the feeder training camp organized by Tuya Smart once again gained practical project experience. In fact, I feel that the design this time is quite simple. The 5kg weight sensor I bought is not used, and the circuit function is relatively simple. It’s simple, and I let myself go a little bit this time on the model. We did encounter a lot of problems in the actual design, and we asked many questions to no avail. However, after studying bit by bit, we gradually overcame them.

All in all, this was another enjoyable activity. I would like to thank Tuya Smart and Lichuang EDA for giving us, a group of independent developers, the opportunity to practice. It is really convenient to use and I will definitely recommend it to my classmates if I have the opportunity!

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-24 11:34:03

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号