Simulating MOSFET based bidirectional 3.3V to 5V logic level shifter

clamping diode

Different logic levels are a common problem in various circuits. For instance, Arduino boards come powered from 5V or 3.3V. Raspberry Pi is powered at 3.3V, and it accepts and generates 3.3V signals on its GPIO. This is fine until you need to connect the 5V peripheral to a 3.3V device. This can be a simple LCD. Of course, you can get 3.3V LCDs, but this is not always the solution. Sometimes it is handy to build a voltage level converter. It can be a special buffer IC like SN74LVCC3245A. These work great as bidirectional voltage translators. But in many cases, there is no need for another IC in your circuit. Hobbyists like to go with simpler solutions. The simplest way is to use resistors, where signal levels differ. The fact is that in most cases, devices have clamping diodes on the inputs that are meant to protect a further circuit from over-voltages. For instance, clamping diode inside a 3.3v device will try to limit the input voltage to 3.3V. This is why a series resistor necessary to limit the current flowing through the diode. Using resistors doesn’t guarantee safe operation. First of all, you must be sure that the…

Continue reading

Building more complex commands using Raspberry Pi terminal

Probably this would be unwise to go through a long list of available Unix commands. It is quite long, and there is no reason to point out each of them here. You can take a look at some basic ones in the following list. It is more important to learn how to use them and get the desired result by building more complex commands. Commands can also be combined into a single line using piping. In this case, the output of one command becomes the input of the next one, and so on. Let’s go with a few examples. We all know that Raspberry Pi comes with Python installed. So we should expect to find lots of .py files here: sudo find / -name *.py this throws us a large list of file names: Finding and displaying files that way is useless. Viewing is even more painful. Let’s say we simply want to count all .py files. For this, we use the same command, but instead of throwing the list to the terminal, we feed it to another command that does the counting of lines (we get every file in a new line):

Continue reading

Linux command structure

Previously we looked at simple terminal commands like ls, cd. We know that ls output all files in the working directory. But in practice, command without options and parameters is almost useless. You may need to list special files or list files from the specified directory in more complex situations without going to it. This is why UNIX commands are run with options and parameters command [options] [parameters] There can be more than one option and parameter for a single command. For instance, we used a cd .. command to go to the previous directory. Dots .. are nothing more than parameters. Let’s see what parameters we have with the ls command. ls -l It displays a list of files in a long format. You can see that we get much more information by adding a simple option -l. Let’s say we want to display files in a long format from a different than a working directory. Then we need to type in the path to the directory as a parameter.

Continue reading

Diving in to Raspberry Pi shell

Raspberry Pi terminal commands

Computer users today are so attached to graphical interfaces. Sometimes it seems that people help computers to do the tasks. Can you imagine how many mouse clicks are required to do something simple? This is visible when the task is cyclic like “find, sort, delete.” Sometimes you find yourself just clicking the mouse and not seeing the result. What you would do half a day clicking the mouse can be performed with the single command line. The question is how to be that smart and feel like a fish in the water in front of the command prompt, shell, or bash – call it however you want. It is a system program that accepts typed commands from used and performs tasks. If you look deeper at almost any program with the graphical interface, you will see that it is only a nice skin that hides the same commands that run when the user clicks buttons. No graphical interface can cower all features of shell commands. So if you start dealing with Linux, then start being a friend to the terminal. Historically Unix computers even didn’t have a graphical interface, so all tasks were performed from the terminal screen. This is…

Continue reading

Getting used to Raspberry Pi

raspberry pi model b

It’s been quite some time since my Raspberry Pi Model B arrived. All I’ve done is tried to run several things, blink GPIO with examples found on the Internet, set up a desktop computer for my daughter with TuxPaint. I never was a big fan of Linux; on the desktop computer, I always use Windows for my daily tasks. With cheap single-board computers like Raspberry Pi, people looked at Linux from a different perspective. We can notice an increased interest in Linux, how to do this, and this. Who works with Linux long time? It is just another computer where they can work with it and make cool things right away. But for us like me, it’s a good chance to get to know Linux better and learn a few tricks.

Continue reading

Test run of VFD display using Arduino

Among my electronics junk, I found a VFD (Vacuum Fluorescent Display) display and wanted to make sure it still works and can be used in projects. It’s a 16T202DA1E display manufactured by Samsung. It can replace the standard HD44780 based liquid crystal display out of the box. First of all, it only requires a 5V supply. The voltage step-up circuit for lighting fluorescent display is already on board. The controller accepts the same commands as any 2×16 LCD does. The pin-out of the display is as follows:

Continue reading

Running LEDs on MSP-EXP430FR5739 FRAM board

In this part, we are going to create a simple project for the MSP-EXP430FR5739 FRAM board. As development tools, we will use Code Composer Studio, which is free to up to 16KB Flash code size. MSP430FR5739 microcontroller has exactly 16KB of FRAM memory to use it all with no hustle. Download Code Composer Studio (CCS) and install it on your PC. Then start the application and go to the workbench. It is an Eclipse-based IDE, so it should be no problem if you have used Eclipse before.

Continue reading

Building STK500 AVR ISP programmer with USB

A programmer adapter is one of the first things to get when starting with microcontrollers. Luckily, it is not hard to build a working programmer almost for any microcontroller, as there are tons of open-source projects. I decided to make my own stk500 compatible programmer, which is taken from tuxgraphics.com. I did not look for the same parts as in the original schematics but used what is on the desk. As a result, I got a mix of through-hole and SMD PCB, which does the job. Short info about STK500 V2 programmer This STK500 V2 adapter is a clone of the original AVR STK500 programmer. It works on all leading platforms, including Windows, Linux, BSD, and macOS X. This is mainly because USB to serial converter  –  FT232RL chip has full driver support. The main reason to build it is that the programmer works in AVRstudio, where microcontrollers can be programmed fluently from the same IDE. Besides, it works fine with AVRDude – which would be the primary application for Linux users. This clone gained quite significant popularity so that you can find many variations – mostly different PCB versions. Therefore, mine is yet another PCB.

Continue reading

Using analog joystick in AVR projects

joystick

In many cases, the joystick manipulator is the best choice for user input. Whether it is a game, robot, or flying machine – a joystick is the most intuitive way of controlling them. You can actually find them in gaming controllers like PlayStation or XBOX. The one we are going to the interface is Thumb Joystick I purchased some time ago from SparkFun. They are really cheap, and as users report, it is practically the same as in XBOX 360, which can be replaced if one is broken. I didn’t bother making a PCB for it – I just used a breakout board for it, which also can be found on SparkFun. Simply speaking, this joystick is nothing more than two potentiometers and one pushbutton. It is designed so that potentiometers are oriented perpendicular and thus moving stick; you can have X and Y-axis control. The push-button is simply an action button that can be activated by pressing the joystick down. So controlling joystick is a matter of analog read of both potentiometers with microcontroller ADC inputs.

Continue reading