Remote Development of Microcontrollers Using Raspberry Pi

To ensure you don’t miss my updates, remember to check the top right corner – view the official account – set it as a star, and give me a star!

Remote Development of Microcontrollers Using Raspberry Pi
Remote Development of Microcontrollers Using Raspberry Pi

The Raspberry Pi and the 51 microcontroller seem like unrelated platforms, but after some effort, it turns out that we can use the Raspberry Pi for remote development of the microcontroller. Where there’s a will, there’s a way. Thanks to Da Fan Jin Han for the submission. The detailed implementation process can be found below the video, or you can get the corresponding code by replying: Raspberry Pi Development Microcontroller in the “Darwin says” WeChat.

Project Demonstration↓↓↓

Project Background

In 2020, the pandemic hit suddenly, and our lives became less joyful! But as someone about to become unemployed after graduation, to enhance my coding skills, I had an idea: Find a way to code and experiment remotely!!

Alright, the serious nonsense ends here, mainly because my poor writing skills just can’t go on! Spare me!!! The real reason is that I, being poor, really can’t afford to buy a development board to learn.

Project Components List

Intranet penetration tool

This is certainly recommended to use Peanut Shell.

We need a device for remote connection

I had a Raspberry Pi 3B that had been collecting dust for a long time, so I took that out to use.

A development board to execute programs

This is a 51 development board I used before.

A camera for displaying images

In the spirit of frugality, I dug out an old USB camera from 10 years ago.

Some relays

Can’t guess what this is for? I’ll keep it a secret for now.

Project Implementation Process

Step 1: The Raspberry Pi can use VNC for remote desktop, but as someone who loves tinkering, I can’t just settle for having to install a client! Absolutely not!!! So I chose noVNC, which has HTML5 parsing for the VNC protocol. That way, the remote part is okay.

Step 2: I chose SDCC for compiling the 51 microcontroller. After compiling, a hex file will appear, but for many friends, this is not enough; the hex format file is still large, we need to use bin!!! Everyone can use Hex2bin for conversion. Okay, now all that’s left is to download via serial. For remote downloading, I chose the open-source STCGAL for burning.
Step 3: Let’s take a look at the remote camera; there are many solutions for remote cameras, here I chose motion.
Alright, after analyzing, let’s roll up our sleeves and get to work!

Detailed Project Implementation Process

1) Burn the system onto the Raspberry Pi and let’s follow the old rule to change the software source of the Raspberry Pi to a domestic source.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo cp /etc/apt/sources.list.d/raspi.list/etc/apt/sources.list.d/raspi.list.bak
Modify the software update source with the following command:
sudo vi /etc/apt/sources.list
Press i to enter edit mode, change it to Tsinghua’s software source address, press ESC to exit, then 😡 to save and exit.
deb http://mirror.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main contrib non-free rpideb-src http://mirror.tuna.tsinghua.edu.cn/raspbian/raspbian/ bustermain contrib non-free rp
Modify the system update source with the following command:
sudo vi /etc/apt/sources.list.d/raspi.list
Comment out the original image with a #, then insert Tsinghua’s system source address, save and exit:
deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
Synchronize and update the source and software packages with the following commands:
sudo apt-get updatesudo apt-get upgrade
2) After changing the source, let’s enable the built-in VNC of the Raspberry Pi
Enter the following command in the terminal to access the configuration interface:
sudo raspi-config
Follow the steps: Interfacing Options -> VNC -> Yes. Then the system will prompt you to install the VNC service, enter y and press enter, and wait for the system to automatically install and complete. If the ancestors still love us, it should have been enabled successfully.
To be safe, let’s check if vncserver is installed locally (actually just checking if the ancestors are still showing their spirit).
whereis vncserver
If not, please install it manually:
yum install -y tigervnc-server
If successfully installed, look here, use the following command to run vnc
vncserver
At this point, you will be asked to enter a password. Here’s a note: The VNC server will run in the background. The port that it runs on is the display number + 5900 (i.e. 5901 in the case above).
This means that when you execute vncserver :1 set to 1, the port number for running VNC below should be 5900+1, which is 5901; the default port for VNC is 5900.
3) Install noVNC
# Install gitsudo apt-get install git# Get the source code for noVNCgit clone https://github.com/kanaka/noVNCEnter the noVNC directorycd noVNCRun noVNC (the first run may take some time to download a port forwarding program) ./utils/launch.sh --vnc localhost:5901
4) Install the 51 development environment
The development environment here depends on Python3, so make sure Python3 and pip3 are installed. If not, please download pip3.
5) Install the CH340 driver on the Raspberry Pi
Note that the driver needs to be downloaded from the official website (Linux version).
6) Install the USB camera monitoring interface
7) “Simple” modification of the noVNC interface
The detailed process for the above four steps can be found in the shared attachment. Reply “Raspberry Pi Development Microcontroller” in “Darwin says” WeChat.
8) Write a relay control script to power on the microcontroller
We use one of the Raspberry Pi’s pins to control the relay, and the relay controls the power on and off for the microcontroller. The script code is as follows; you can choose different pins for control, and I won’t elaborate further.
# -*- coding: utf-8 -*-import RPi.GPIO as GPIOimport time# BOARD numbering method, based on socket pin numberingGPIO.setmode(GPIO.BOARD)# Output modeGPIO.setup(0, GPIO.OUT)GPIO.output(0, GPIO.HIGH)time.sleep(1)GPIO.output(0, GPIO.LOW)time.sleep(1)
After running this code, we will see a warning as follows:
 RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
We can ignore this warning. Once all the above steps are completed, we can achieve remote development of the 51 microcontroller with the Raspberry Pi.
This sharing ends here! Finally, thank you all for your patient reading, if possible, please grant me a job offer or a pretty girl. Thank you!
END
Remote Development of Microcontrollers Using Raspberry Pi

More practical project recommendations:

STM32 IoT Smart Home Project

Project Sharing | Step-by-Step Face Recognition with MATLAB + Raspberry Pi

Raspberry Pi + Compute Stick 2 for Real-Time Face Recognition Project

Building a Cloud Computing Platform for Embedded Development Boards

STM32 Achieving the Simplest Air Mouse

Arduino Rubik’s Cube Robot

STM32 Version “AI Soul Painter”

STM32 Electronic Photo Album Production

STM32 + DDS Homemade Signal Generator

Using Raspberry Pi and Web Interface for Remote Control of Home Appliances

STM32 “Cloud” Music Player

Raspberry Pi Remote Monitoring

Design of a Neon Tube Clock Based on STM32

Homemade FPGA Minimum System Board (PCB can be directly made)

Building NAS with Raspberry Pi 4 to Easily Connect Hard Drives

ESP32 Car Soft and Hard Practical Sharing

Complete Creative Gesture Recognition with Only 79 Lines of Code

IoT + Electronic Ink Screen to Create Customized Display

Build a Pathfinding Robot Worth Over a Thousand Yuan for Dozens of Yuan

Glasses that Can Show 3D Holograms, Visual Persistence POV Project

DIY Gesture Recognition Module

Practical small designs that can be DIYed with 0 foundation

Raspberry Pi to Create a Smart Doorbell + Smart Lock with Video

Strange! My development board can play games automatically

Homemade Breathing Machine

ESP8266 + Zigbee Networking to Transform Wall Switches

Wireless Home Monitoring System

DIY Bionic Arm, a Tool to Free Hands

Handmade Air Purifier, All Design Materials Open Source

Tech Toy: Bluetooth Artillery That Can Be Remotely Controlled

Using ST Sensors to Create a Little Bee Monitoring System That Lets Bees “Talk”

Homemade Cat Playing Device

STM32 + Raspberry Pi Achieves 6s Rubik’s Cube Robot

Blindly Modified Drone Controller, DIY “Foam” Drone

Making a Smart Relay Without Arc Using STM32

Making a Practical New Type Necklace with Just 5 Components

The Simplest Method for Heart Rate Measurement (suitable for secondary development)

Cracking the Magnetic Levitation Globe

Magical Light Can Transmit Video? Revealing the Production Process

Homemade Smart Watch with STM32 60FPS Animation

Paying Tribute to Classic Radios, Observing the Production Process

DIY Third Eye: “Special” Glasses with Bluetooth/OLED/Lens Function

Homemade Solar Charger That Tracks Maximum Power Point

No MCU Version Night Vision Goggles, Just Wire Connections Needed

The Right Way to DIY Flow Meters, Interest Modifiers

Homemade High-Difficulty Racing Timer (Lap/Heat Sensitive Printing)

DIY Mobile WiFi Controlled LED Dice

Gas-Powered Power Bank

Homemade Simple Raspberry Pi Security System

Using Microcontrollers + ESP8266 to Build a Small Weather Station

Super Mini & Highly Expandable Palm Machine Car

Recommended Reading:

Project Sharing | Electric Competition Series | Artificial Intelligence | Postgraduate Entrance Examination
Essential Knowledge Points | Graduation Design | Switch Power Supply | Job Search
We are Ni Mo, the founder of Darwin, only talking about technology without flirting. The Darwin online education platform aims to serve professionals in the electronics industry, providing skill training videos covering popular topics in various subfields, such as embedded systems, FPGA, artificial intelligence, etc. Tailored learning content is designed for different groups, such as commonly used knowledge points, disassembly assessments, electric competitions/smart cars/postgraduate entrance examinations, etc. Welcome to follow.
Official website: www.darwinlearns.com
Bilibili: Darwin
QQ Group: Group 1: 786258064 (full)
Group 2: 1057755357 (full)
Group 3: 871373286
Remote Development of Microcontrollers Using Raspberry Pi

Leave a Comment

×