Lemontree

2021 Question I - Energy storage car with power generation function - even if you walk in a queue

 
Overview

Foreword
From the beginning to the end of the National Electronics Competition, we spent four days and three nights creating the work and waiting for the test results for a month, and finally won the second place in the country. A few days ago, we saw Lichuang’s open source activity for collecting works. My teammates and I chose to sign up for the event without hesitation. We want more electronics enthusiasts to know about our “energy storage car with power generation function” "This work also wants to exchange technology with more electronic enthusiasts.           
Personal introduction
Yang Jiehai
studied
at Guangxi Vocational and Technical College in Guigang, Guangxi
Liang Weilin studied at Guangxi Vocational and Technical College
in Wuzhou, Guangxi Song Lele studied at Guangxi Vocational and Technical College in Guigang, Guangxi



Project Analysis

a task

Design and build a smart car with power generation function. The car has liquid crystal display function and uses supercapacitor (Farad capacitor) as energy storage element. Manually push the car to move linearly in one direction from point A to point B in the manual power generation area shown in Figure 1. Repeat this process 5 times to complete a complete charging process and charge the supercapacitor. After charging, the car completes the specified actions as required.

Second requirement

1. Basic requirements

(1) The car can light up the LED indicator light during charging.

(2) Place the charged car at the designated starting point on the ground and start it with one click. The car will delay 1s and then drive forward until it completely stops. Measure the straight-line distance L 1 from the starting point to the stopping point. It is required that L 1 is not Less than 100cm, points will be deducted if less than 100cm.

(3) The car is required to display its driving distance in real time.

2. Play part

(1) After the car is charged in the manual power generation area, place the car at the starting point S of the circular tracking area shown in Figure 1, start it with one click, and then delay the car for 1 second and then drive along the black circular tracking line until it is completely Stop and record the car's driving distance L 2. The farther L 2 is, the better.

(2) Place multiple RMB one-yuan coins under the circular tracking line, and require the car to detect the coins in the first circle of driving. Each time a coin is detected, the LED light will light up once, and the number of coins detected will be displayed. There will be no more testing after one lap. Points will be deducted for incorrect testing, missed testing or multiple testing. Coins must be brought by the participating teams.

Project function introduction

The circuit of this car is relatively simple. The microcontroller uses an Arduino NANO board, which is relatively simple to program and consumes little power. However, in order to save power and energy, the power supply LED lights on the module board are soldered off. Two motors are used in parallel to charge the capacitor, a tracking module is used to realize the function of the car walking in a small circle, and a metal module is used to detect coins. When a coin is detected, a high-level signal is sent to the microcontroller for processing and counting, and the count is displayed on the screen. To record the distance, an infrared photoelectric sensor module is used to obtain the pulses sent by the sensor, and the microcontroller calculates 4mm as a pulse, and then displays the distance on the screen.

Main modules:

Microcontroller module (Arduino NANO)

Tracking module

Boost module

metal module

Infrared photoelectric sensor module

Nokia5110 LCD module

Metal module: PNP type proximity switch is used

Working principle: PNP type proximity switch uses a PNP transistor as the output, pulls the output terminal down to the ground through a resistor, and uses GND as the common terminal. When there is no in-position signal, the base of the PNP transistor is high level, the transistor is not conducting, and the proximity switch outputs low level; when there is an in-position signal, the base of the PNP transistor is low level, the transistor is conducting, and the proximity switch outputs high level. The PLC determines whether it is in place by detecting the high and low levels of the proximity switch output.

QQ picture 20211215135849

Tracking module: It uses CN70 reflective infrared tube, there are three in total

The working principle of the reflective photoelectric sensor: It has a light source and a light receiving device. The light emitted by the light source is received by the photosensitive element after being reflected by the object to be measured, and then processed by the relevant circuit to obtain the required information. It can be used to detect changes in light, shade and color on the ground, as well as detect the presence of approaching objects. (The tracking module is actually welded by itself. Below is the circuit diagram)

QQ picture 20211215134743

(Tracking module) Infrared photoelectric sensor module: It uses a through-beam infrared tube, which generates pulse signals through a light wheel, 20 pulse signals in one circle, and then sends them to the microcontroller for calculation and display on the display screen.

QQ picture 20211215140144

Boost module: The PW5100 is used, which is a very good boost module. The lowest working voltage is 0.7V, which is very suitable for our project.

Microcontroller module (Arduino NANO): easy to program and fast enough to process information.

Nokia5110 LCD module:

 Nokia5110 is a classic model. Because it is a classic model, there are many old machines, so many electronic engineers remove the screens of the old machines and drive the Nokia5110 themselves for display in developed devices. Replaces LCD1602. 5110 uses 84x48 dot matrix LCD, which can display 4 lines of Chinese characters; features include:

1) High cost performance, LCD1602 can display 32 characters, while Nokia5110 can display 15 Chinese characters and 30 characters. Nokia5110 bare screen is only 8.8 yuan, LCD1602 is generally about 15 yuan, and LCD12864 is generally 50~70 yuan.

2) The interface is simple and can be driven by only four I/O lines. LCD1602 requires 11 I/O lines and LCD12864 requires 12.

3) The speed is fast, 20 times that of LCD12864 and 40 times that of LCD1602.

4) Nokia5110 has an operating voltage of 3.3V, an operating current of less than 200u during normal display, and a power-down mode, making it suitable for battery -powered portable mobile devices.

motor driven

In terms of motor driving, we use 4800 field effect transistors to drive the motor, because the field effect tube driving method is voltage driven, which is better than ordinary npn transistors.

System composition

System block diagram

original schematic

QQ picture 20211216200420

Original PCB diagram

(Due to the tight time limit for the competition, there was no time to change the PCB diagram, so the actual PCB diagram was used. Note: The original ones need to be connected to the A7, A5, and A4 ports and disconnected, and connected to A7-TX1, A5-RX0, and A4-D7. Ports, and those that are not required in the original schematic diagram do not need to be soldered.)

QQ picture 20211216200443

Circuit schematic


Circuit PCB diagram

(If you don’t want to use the original PCB, you can also use the modified one)

QQ picture 20211215163009

QQ picture 20211215162850

QQ picture 20211215162846

Module physical picture

Tracking module:

IMG_20211217_091747

Metal detection module:

IMG_20211217_091758

Ranging module (infrared photoelectric sensor module):

IMG_20211217_091831

Car appearance (a bit rough):

IMG_20211217_111658

IMG_20211217_111731

IMG_20211217_111707

IMG_20211217_091737

code

#include <Nokia5110.h>

#include <MsTimer2.h>

Nokia5110 lcd;

int JuLi=0;

int dlnum=200;

int Plus_Distance = 0;

int Plus_Cion = 0;

float cmPerPlus = 0.4; //The length represented by each pulse, unit cm

const byte ledPin = 13;

const byte interruptPin1 = 2;//Distance measurement sensor signal pin

const byte interruptPin2 = 3;//Coin detection signal pin

const byte CionSensorCtrPin = 4;//Coin sensor power control pin

unsigned char DistanceBuff[] = {"Juli:0000mm "};

unsigned char CoinNumBuff[] = {"CoinNumber:0 "};

byte sensor[3] = {0, 0, 0};

//Motor settings//

#define Left_PIN 6

#define Right_PIN 5

// Tracking module settings //

#define left_track_PIN A0

#define middle_track_PIN A1

#define right_track_PIN A2

//keyboard definition

#define K1 A6

#define K2 7

#define K3 1

#define K4 0

#define middle_track_PIN A1

#define right_track_PIN A2

void motor_control(void); //Motor control

void motor_pinint( ); //Pin initialization

void KeyPinInit();

voidKeyPinInit()

{

// pinMode(K1, INPUT_PULLUP);

pinMode(K2, INPUT_PULLUP);

pinMode(K3, INPUT_PULLUP);

pinMode(K4, INPUT_PULLUP);

}

/*Tracking module pin initialization*/

void track_pinint( )

{

pinMode (left_track_PIN, INPUT); //Set the pin as an input pin

pinMode (middle_track_PIN, INPUT);//Set the pin as an input pin

pinMode (right_track_PIN, INPUT); //Set the pin as an input pin

}

/*Motor pin initialization*/

void motor_pinint( )

{

pinMode (Left_PIN, OUTPUT); //Set the pin as an output pin

pinMode (Right_PIN, OUTPUT); //Set the pin as an output pin

}

void ShowDistance() {//Display distance

lcd.LcdXY(0, 0);

lcd.LcdWriteString(DistanceBuff);

}

void ShowCoinNum() {//Show the number of coins

lcd.LcdXY(0, 0);

lcd.LcdWriteString(CoinNumBuff);

}

void setup() {

lcd.initLCD(9, 8, 10, 12, 11); //CLK,DIN,DC,CE,RST

motor_pinint();

track_pinint();

KeyPinInit();

pinMode(interruptPin1, INPUT_PULLUP);

pinMode(interruptPin2, INPUT_PULLUP);

attachInterrupt(digitalPinToInterrupt(interruptPin1), JuLiCeL, RISING);

attachInterrupt(digitalPinToInterrupt(interruptPin2), YBJC, FALLING);

Plus_Distance = 0;

Plus_Cion = 0;

pinMode(CionSensorCtrPin,OUTPUT);

pinMode(ledPin,OUTPUT);

MsTimer2::set(500,zhong_duan);

}

void zhong_duan()

{

digitalWrite(ledPin,0);

MsTimer2::stop();

}

void JuLiCeL()//Measure distance

{

unsigned int temp;

noInterrupts();

Plus_Distance++;

JuLi = (unsigned int)(Plus_Distance * cmPerPlus * 10);

DistanceBuff[5] = JuLi / 1000 + 0x30;

DistanceBuff[6] = JuLi / 100 % 10 + 0x30;

DistanceBuff[7] = JuLi / 10 % 10 + 0x30;

DistanceBuff[8] = JuLi % 10 + 0x30;

interrupts();

}

void YBJC()//Coin detection

{

noInterrupts();

if(JuLi<1800){ Plus_Cion++;digitalWrite(ledPin,1);}

CoinNumBuff[11] = Plus_Cion/10 + 0x30;

CoinNumBuff[12] = Plus_Cion%10 + 0x30;

interrupts();

MsTimer2::start();

}

void Stop()

{

digitalWrite(Left_PIN, 0);

digitalWrite(Right_PIN, 0);

}

void TurnLeft()

{

digitalWrite(Left_PIN, 0);

digitalWrite(Right_PIN, 1);

}

void TurnRight()

{

digitalWrite(Left_PIN, 1);

digitalWrite(Right_PIN, 0);

}

void Go()

{

digitalWrite(Left_PIN, 1);

digitalWrite(Right_PIN, 1);

}

void Move()

{

if (analogRead(left_track_PIN) * 5.0 / 1023 >= 0.5)sensor[0] = 1;

else sensor[0] = 0;

if (analogRead(middle_track_PIN) * 5.0 / 1023 >= 2.8)sensor[1] = 1;

else sensor[1] = 0;

if (analogRead(right_track_PIN) * 5.0 / 1023 >= 0.9)sensor[2] = 1;

else sensor[2] = 0;

if (sensor[0] == 0 && sensor[1] == 0 && sensor[2] == 0) //Outside the black line is 1, inside the black line is 0

{

Go();

}

else if ((sensor[0] == 0 && sensor[1] == 0 && sensor[2] == 1) || (sensor[0] == 0 && sensor[1] == 1 && sensor[2 ] == 1))

{

TurnLeft();

}

else if ((sensor[0] == 1 && sensor[1] == 0 && sensor[2] == 0) || (sensor[0] == 1 && sensor[1] == 1 && sensor[2 ] == 0))

{

TurnRight();

}

else

{

Stop();

}

}

void loop() {

while (1) {

if (digitalRead(K4)==0)

{

delay(1000);

while (1)

{

ShowDistance();

Go();

 

}

}

if (digitalRead(K3)==0)

{

delay(1000);

while (1)

{

Move();

}

}

if (digitalRead(K2)==0)

{

digitalWrite(CionSensorCtrPin,HIGH);

while (1)

{

ShowCoinNum();

Move();

}

}

}

}

Summarize

This has allowed me to gain a lot and learn a lot. After this incident, we learned the importance of daily learning. In this competition, we also used a lot of things that we usually don't think of, such as: the circumference of a circle; Ohm's law, etc.
In this competition, we also learned the importance of unity. The captain is a very important position. If you have a captain, you must trust the captain. You cannot just do your own thing when you have an idea. You should discuss it with the captain first. Only in this way can we get the best solution, which is the best. We also encountered many difficulties in the process of making our works, and we will solve them step by step. We don't talk to each other just because we encounter some difficulties, but we work together to find a solution.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-18 19:17:13

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号