An adjustable constant current generator is an essential tool for many electronic applications, especially when a stable current is required regardless of the load. This project, designed and built with a PIC16F1765 microcontroller, combines both constant current sourcing and sinking capabilities in one device, with the ability to adjust the value from 0 to 1000 mA.

Key features include constant current generation, current sinking capability, an integrated timer with mAh calculation, automatic shutdown when no current is flowing, and calibration. The timer is particularly useful for charging NiMH batteries, enabling precise current application for set periods.

The unit is controlled via three buttons (UP, DOWN, ENTER), with visual feedback provided by an SSD1306 display. An optional ammeter can be added for calibration purposes. The system is powered by an external 5 V supply capable of delivering up to 1 A.

At the heart of the system is the PIC16F1765, chosen for its onboard 10-bit ADC and DAC, as well as an integrated operational amplifier capable of directly driving a BD137 transistor in an emitter follower configuration. This allows for precise and stable current control. A critical issue during development was noise generated on the I²C bus by the SSD1306 module, resolved by supplying both the display and the PIC with 3.3 V via an LP2950 regulator, eliminating data corruption problems.

Assembly can be done on a breadboard, with components split across two boards to fit the chosen enclosure: one hosting the microcontroller and display, the other the BD137 transistor, the 1 Ω power resistor, and relays. It is essential to mount a heat sink on the BD137 to prevent overheating.

The firmware, written in the JAL programming language, handles the user interface, stores settings in non-volatile memory, and controls the current with updates every millisecond. Using High Endurance Flash (HEF) ensures long-term reliability. Red and blue LEDs indicate source and sink modes respectively.

In demonstration, the device performs tasks such as calibration to 1 A, charging batteries at 200 mA, discharging at 400 mA, automatic shutdown, and capacity calculation. This is a practical, versatile project, ideal for makers and electronics professionals who need a compact, adjustable tool for testing and lab applications.

By Boris Landoni

Boris Landoni is the technical manager of Open-Electronics.org. Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.

Leave a Reply

Your email address will not be published. Required fields are marked *