Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Trip computer for electric bike. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Home, household, hobby

Comments on the article Comments on the article

Readers are invited to a trip computer on the PIC16F876A microcontroller with an external current sensor, designed for an electric bike. On its display, it displays both the parameters of movement and the voltage of the battery, the current consumed from it, power and electricity consumption. The device is made on an accessible element base and is easy to repeat.

To control the mode of operation of electric bicycles, various measuring instruments are used. Electrical parameters are measured by power analyzers [1, 2], movement parameters are controlled by various electronic bicycle computers [3] and even mechanical speedometers [4]. There are even special displays for electric bicycles [5], showing all the necessary parameters, but having a high cost.

Based on this, I developed a trip computer for an electric bike on a PIC16F876A microcontroller with an external current sensor.

Main Specifications

  • Speed, km/h.......0...99 (0,5)
  • Average speed, km/h.......0...99 (0,1)
  • Total mileage, km.......0...9999,9 (0,1)
  • Daily mileage, km .......0...99,9 (0,1)
  • Consumed electricity, Wh .......0...99999 (1)
  • Specific electricity consumption, Wh/km .......0...99999 (0,1) Battery charge, % .......0...100 (10)
  • Battery voltage, V.......25...75 (0,1)
  • Load current, A.......0...20 (0,1)
  • Load power, W .......0...10465 (1)

In parentheses, the discreteness of the display of the corresponding parameter is indicated. The trip computer shows the current time with a resolution of 1 minute.

The scheme of the trip computer is shown in fig. 1. Microcontroller DD2 (PIC16F876A-I/P) is powered by an oscillator stabilized by a ZQ2 quartz resonator with a frequency of 8 MHz. The XP1 connector is provided for programming the microcontroller. I connected a PICkit2 programmer to it. The microcontroller program was developed in the Flowcode graphical environment [6].

Trip computer for e-bike
Rice. 1. Trip computer diagram (click to enlarge)

Voltage and current measurements are made using the internal 10-bit ADC of the microcontroller. When measuring voltage, the signal from the voltage divider R5R9R12 is fed to the analog input AN0 (RA0) of the microcontroller.

When measuring current, the voltage drop across the current sensor Rш amplifies the operational amplifier OPA241 (DA1). From the output of the op amp, the amplified signal comes to the analog input AN1 (RA1) of the microcontroller. The gain is set by the trimmer resistor R13 in the Oy feedback circuit. Instead of OPA241, almost any single rail-to-rail op-amp in the SO-8 package, for example, OPA340 or TS507, can be used. The program calculates power and electricity consumption based on the measured values ​​of current and voltage.

A standard measuring shunt 75SHISV.2-0.5-15 with a voltage drop of 75 mV at a current of 15 A was used as a remote current sensor. Any standard shunt with a resistance of 5 ... 10 mΩ or a similar self-made one can be used as a replacement [7].

The trip computer is powered by a linear voltage regulator formed by a regulating transistor VT1 and a TL431ID (DA2) microcircuit. A VD1R10C6C7 circuit is installed in the power circuit, which reduces the noise generated by a running electric motor. Resistors R16 and R17 ensure even voltage distribution between capacitors C6 and C7. The maximum allowable input voltage (battery voltage) depends on the allowable collector-emitter voltage of the transistor VT1, its allowable power dissipation, the quality of the heat sink and the power released by the resistors R19-R22. With the stabilizer elements indicated in the diagram, the battery voltage should not exceed 75 V. However, the device is able to display values ​​up to 102,3 V on the indicator.

The trip computer is made on a single-sided printed circuit board made of fiberglass 1,5 mm thick. A drawing of the printed conductors of the board and the arrangement of elements on it are shown in fig. 2 and fig. 3. In fig. 4 shows its appearance.

Trip computer for e-bike
Rice. 2. Drawing of printed circuit board conductors

Trip computer for e-bike
Rice. 3. Location of elements on the board

Trip computer for e-bike
Rice. 4. Appearance of the trip computer

On the front side of the board, a PIC16F876A microcontroller, a ZQ2 quartz resonator, a DS1307 real-time clock chip, trimmer resistors, a VT1 transistor, an XP1 connector (PLS-5R corner pin block) and a PLS-14 block for connecting the HG1 indicator are installed. The mating part of the connector is soldered into the mounting holes of the HG1 indicator - the PBS-14 socket block. A 1V G2032 CR3 lithium battery is installed in the BH-642 holder. All other elements are mounted on the side of printed conductors.

A cylindrical quartz resonator ZQ1 (32768 Hz) is soldered into the holes on the side of the printed conductors next to pins 1 and 2 of the DD1 chip. The upper part of its body is soldered to the foil section connected to the common wire. The trip computer board is attached to the LCD board on two metal racks 10 ... 12 mm high using M3 screws.

Resistors and capacitors of size 120b for surface mounting are used. Capacitors C6 and C7 are surface-mounted tantalum oxide capacitors in a frame size E. They can be replaced with other capacitors of the same size with a capacity of 6,8 ...

A replacement for the npn transistor BD139 in the voltage regulator can be another transistor of the same structure in the TO-126 package with a permissible collector-emitter voltage of more than 80 V, for example, BD179, MJE182 2N5192, BF469, KT817G. A strip of thin sheet of copper or aluminum with an area of ​​​​approximately 6 cm is placed under the transistor housing.2serving as a heat sink. The transistor is attached to the board with an M3 screw with a nut.

To reduce the measurement error shunt Rшshould be located as close as possible to the negative terminal of the battery. All connections to the trip computer can be made with small wires. For connecting to the trip computer reed switch SF1 (path sensor), shunt Rш, and the GB1 battery, a PC7TV connector not shown in the diagram, installed on the trip computer case, was used. The reed switch was taken from a failed electronic cycle computer.

Indication of parameters in the trip computer is displayed on a four-line LCD WH1604A with a supply voltage of 5 V without backlight. Its absence is explained by the high current consumed by the backlight (220 mA), which would lead to overheating of the VT1 transistor.

The LCD simultaneously displays seven parameters: voltage, current, amount of electricity consumed, current time, speed, total mileage and specific consumption of electrical energy from the moment the trip computer was turned on (see Fig. 4).

The speed value is displayed on the screen using pseudographics. This made it possible to bring the height of the digit to two lines, which greatly facilitated reading the speed from the screen.

The trip computer is controlled using the buttons SB1 "M" (setting minutes), SB2 "H" (setting hours) and SB3 "P" (indication mode). With successive pressing of the SB3 button in the lower right corner of the screen, instead of the specific consumption of electrical energy (Fig. 5, a), the average speed (Fig. 5, b), daily mileage (Fig. 5, c), battery charge (Fig. 5, d) or the power consumed by the electric motor (Fig. 5, e).

Trip computer for e-bike
Rice. 5. Indication of parameters in the trip computer

When the SB3 button is pressed for more than 5 s, the program enters the wheel circumference setting mode (Fig. 5, f). With further holding of this button, the circumference of the wheel changes in 1 cm steps from 201 to 215 cm (26-inch wheel). When the device is initially turned on, the wheel circumference is set to 210 cm. 5 s after the SB3 button is released, the wheel circumference setting mode is exited with the set value written to the EEPROM of the microcontroller.

When programming the microcontroller, it is necessary to write zeros to the first five EEPROM cells (Fig. 6) to set the initial value of the distance traveled to zero. If this is not done, the mileage will be 1525,7 km.

Trip computer for e-bike
Rice. 6. Microcontroller programming

The program saves the distance traveled in the EEPROM of the microcontroller 3 s after the electric bike stops. To indicate the moment of recording, an asterisk symbol appears for 0,3 s in the upper right corner of the LCD. When the power is turned off, the program resets the values ​​of the unit costs of electrical energy, average speed and daily mileage.

To set up the device, instead of a battery, you can use a laboratory power source with an output voltage of 25 ... 50 V and a permissible load current of at least 5 A. As a load equivalent, you can use a powerful wire resistor with a resistance of 5 ... 10 Ohm.

Set up the device in the following order. First calibrate its voltmeter. To do this, voltage is applied to the device from a battery or from a laboratory power source, controlling it with an accurate digital voltmeter. By changing the resistance of the tuning resistor R9, the same readings of the exemplary voltmeter and the device being adjusted are achieved.

Then the current meter is calibrated. An accurate digital ammeter is connected in series with the load. By applying the supply voltage, by changing the resistance of the tuning resistor R13, the same readings of the exemplary ammeter and the device being adjusted are achieved.

If necessary, by selecting the resistor R25, the optimal image contrast on the indicator is set.

The trip computer can be installed in any suitable plastic or metal case.

Trip computer circuit board file in Sprint Layout 5.0 format and microcontroller program: ftp://ftp.radio.ru/pub/2016/05/tripcomp.zip.

Literature

  1. Turnigy 130A wattmeter and power analyzer. URL: hobbyking. com/hobbyking/store/uploads/242601761X977727X9.pdf.
  2. E-bike wattmeter/power analyzer at VoltBikes. - URL: bikes-n-parts.ru/kupit/voltbikes. en/vattmetr_analyzator_moshchnosti_dlia_elektrovelosipeda.
  3. Bicycle computers. - URL: sportmaster.ru/catalog/velosport/aksessuary/velokompyutery.
  4. Bicycle speedometer mechanical. - URL: 32spokes.ru/blog/test-drive/2543.html.
  5. XOFO displays for e-bikes. - URL: li-force.ru/catalog/lcd_led_display_ xofo.html.
  6. Site of Russian-language support for the Flowcode program. - URL: flowcode. info.
  7. Nefediev A. Wattmeter-electricity meter for an electric bike. - Radio, 2015, No. 9, p. 44, 45.

Author: A. Nefediev

See other articles Section Home, household, hobby.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Machine for thinning flowers in gardens 02.05.2024

In modern agriculture, technological progress is developing aimed at increasing the efficiency of plant care processes. The innovative Florix flower thinning machine was presented in Italy, designed to optimize the harvesting stage. This tool is equipped with mobile arms, allowing it to be easily adapted to the needs of the garden. The operator can adjust the speed of the thin wires by controlling them from the tractor cab using a joystick. This approach significantly increases the efficiency of the flower thinning process, providing the possibility of individual adjustment to the specific conditions of the garden, as well as the variety and type of fruit grown in it. After testing the Florix machine for two years on various types of fruit, the results were very encouraging. Farmers such as Filiberto Montanari, who has used a Florix machine for several years, have reported a significant reduction in the time and labor required to thin flowers. ... >>

Advanced Infrared Microscope 02.05.2024

Microscopes play an important role in scientific research, allowing scientists to delve into structures and processes invisible to the eye. However, various microscopy methods have their limitations, and among them was the limitation of resolution when using the infrared range. But the latest achievements of Japanese researchers from the University of Tokyo open up new prospects for studying the microworld. Scientists from the University of Tokyo have unveiled a new microscope that will revolutionize the capabilities of infrared microscopy. This advanced instrument allows you to see the internal structures of living bacteria with amazing clarity on the nanometer scale. Typically, mid-infrared microscopes are limited by low resolution, but the latest development from Japanese researchers overcomes these limitations. According to scientists, the developed microscope allows creating images with a resolution of up to 120 nanometers, which is 30 times higher than the resolution of traditional microscopes. ... >>

Air trap for insects 01.05.2024

Agriculture is one of the key sectors of the economy, and pest control is an integral part of this process. A team of scientists from the Indian Council of Agricultural Research-Central Potato Research Institute (ICAR-CPRI), Shimla, has come up with an innovative solution to this problem - a wind-powered insect air trap. This device addresses the shortcomings of traditional pest control methods by providing real-time insect population data. The trap is powered entirely by wind energy, making it an environmentally friendly solution that requires no power. Its unique design allows monitoring of both harmful and beneficial insects, providing a complete overview of the population in any agricultural area. “By assessing target pests at the right time, we can take necessary measures to control both pests and diseases,” says Kapil ... >>

Random news from the Archive

Earthquake expected in New York 21.02.2009

American seismologists analyzed historical documents indicating tectonic activity and seismograph records from the New York area for 1677-2006. Conclusion: the metropolis is not immune from a major earthquake.

The last three most powerful earthquakes of magnitude 5 occurred in 1737, 1783 and 1884, that is, the last of them - shortly before the appearance of the first skyscrapers in the city. The risk of even stronger soil movements cannot be ruled out.

According to the calculations of seismologists, an earthquake of magnitude 6 can occur in this area every 670 years, and a magnitude 7 - every 3400 years. The trouble is that there is simply no data for such long periods, and no one can say how long such catastrophes have happened (and, therefore, how soon to expect new ones).

Other interesting news:

▪ Cooked rice is dangerous to health

▪ SONY camcorders burn DVD on the fly

▪ Draw at meetings

▪ MFP Stylus Photo RX600

▪ The ocean turns to plastic

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site Normative documentation on labor protection. Article selection

▪ article The third is not given. Popular expression

▪ article Which marine and terrestrial reptiles are able to mate and produce offspring? Detailed answer

▪ Chemerits article. Legends, cultivation, methods of application

▪ article Electrical unit for outboard motor. Encyclopedia of radio electronics and electrical engineering

▪ article Active load regulator for low currents, 2,5-4,5 volts 20-200 milliamps. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024