Coder Social home page Coder Social logo

me9hanics / c-electronic_binary_calculator Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 8.53 MB

Calculator using infrared sensors as buttons: designed a PCB in Altium Designer to an STM32 Nucleo64 microcontroller. Infrared sensors are used as buttons, as an object gets close to them, their output voltage is measured. To simulate "touching" (input), I wrote a C# client app, that communicates with the microcontroller to control.

C 99.47% Assembly 0.44% C# 0.09%
c csharp hardware-designs pcb uart

c-electronic_binary_calculator's Introduction

Electronic_Binary_Calculator

Calculator using infrared sensors as buttons, currently used as a binary calculator, using an STM32 Nucleo64 microcontroller. Designed a PCB in Altium Designer and Altium CircuitMaker to the microcontroller. It contains a 16x2 LCD and 16 infrared sensors (and a supply circuit, with reverse current protection). The infrared sensors are used as buttons, as an object gets close to them, their output voltage changes, making them applicable as buttons. All 16 sensors are connected to 8 analog inputs of the Nucleo board in pairs, their values are read simultaneously, one per pair at a time (pairs are multiplexed with transistors).

The board and the LCD:

IMG_20220602_010716

The schematic:

Kép1

I also designed a firmware in C, using the Eclipse-based STM32CubeIDE.

To use all 16 buttons, I have to desolder two solder bridges on the microcontroller. Instead, I only use 8 buttons, and made a binary calculator: it uses only 0 and 1, but displays the value in base 10.

The firmware, using the analog inputs of the microcontroller, detects which sensors are pressed, and based on a state machine I modelled, decides what to write on the LCD and sends this data via UART to the C# client app (see below). The state machine:

diag

The LCD's anode pin isn't working correctly, I probably broke the LCD when putting it wrongly into the board one time. So I made a client application to aid that problem, displaying the calculator's display (and it's buttons). The client app:

kep2

This way I could take the LCD off the board. (The two cables were soldered there to see if it would work this way, but it did not fix it, those cables were desoldered later)

bo

Initially, the project started off as a decimal calculator. However, two solder bridges were needed to be soldered differently than default, causing every sensor "on the sides" not be able to function due to disconnected pins. I figured this out by that time we were only allowed to work on the software, not the hardware anymore, thus I couldn't change it, I had to use only the 8 "inbetween" sensors, creating a binary calculator: works great, but is not very nice. (The client app showcased the numbers and results in decimal, just the input was 1's and 0's, converted immediately).

About the firmware

Can be found under /Firmware_C/Core/Src/.

About the hardware

The Altium designs of the PCB can be found in the respective subfolder.

The board gets 5 Volts of power supply, but most pins and the sensors use 3.3V, so I used a Buck converter to get stable 3.3V. I used CNY70 diodes for infrared light detection. For less power usage, I designed the diodes to drain current when they are touched, not in passive (untouched) state. From the below diagram (upper one), I've found that with 1.1V input voltage results in 10mA forward current, to assert to this, I put a serial resistor in there with 220Ohm resistance (required resistance had to be calculated: 3.3V-1.1V voltage needs to drop on it, and the current equals 10mA, hence R = 2.2V/10mA = 220Ohm). The sensor has a phototransistor, based on the lower diagram, I put a 22kOhm resistor in series with it.

image

About the client app

UART communication with the microcontroller.

Files can be found under /ClientApp_CSharp/calc/ , if using Visual Studio, the solution file (calc.sln) can be ran to load the project, else all files are found under /ClientApp_CSharp/calc/calc/.

c-electronic_binary_calculator's People

Contributors

me9hanics avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.