Wednesday, January 9, 2019

Make a tube/pipe with FreeCAD

Why I Chose FreeCAD

I chose FreeCAD because it runs smoothly on my old laptop compared to AutoCAD.

Getting Started

There are two methods to create a pipe in FreeCAD that I’m familiar with.

Method 1: Using Draft and Sketcher

  1. Open FreeCAD:

    • Create a new document (Ctrl + N).
  2. Create a Circle:

    • From the dropdown menu, select Draft.
    • Draw a circle. You can adjust its location and radius later using the options in the left corner box.
  3. Set the Viewing Plane:

    • You are currently in the YX plane (visible in the right corner).
    • Press 0 to switch to the 3D view, and then press 1 to view the object in the XZ plane.
  4. Create a Sketch:

    • Select Sketcher from the dropdown menu.
    • Create a new sketch and draw a circle with its origin at the center.
    • Use the Circle Constraint to set its radius.
  5. Draw a Perpendicular Line:

    • Create a new sketch on the XZ plane.
    • Draw a straight line from the origin, and set the constraints.
  6. Sweep the Circle Along the Line:

    • Choose Part from the dropdown menu and rename the circle and line.
    • Select Sweep and choose the circle as the profile.
    • Set the Sweep Path to the straight line and click Done.
  7. Create a Pipe:

    • To create a pipe, select the top and bottom surfaces of the cylinder.
    • Press 0 to choose the top surface, then press 5 and Ctrl to choose the bottom surface.
    • Click the Thickness icon and press OK. Your pipe is now complete.

Method 2: Using Create Primitives

  1. Open FreeCAD:

    • Create a new document (Ctrl + N).
  2. Select Part:

    • From the dropdown menu, choose Part.
  3. Create a Cylinder:

    • Select Create Primitives and choose the cylinder shape from the left-hand side.
    • Set the radius and height for your cylinder.
  4. Follow Steps from Method 1:

    • Repeat the steps for sweeping and setting thickness from Step 14 in Method 1.

Done!

Friday, October 19, 2018

Control LED board by phone with ESP8266 and MAX7219

Testing NodeMCU with 4 x 8x8 LED Matrix

Date: 10/19/2018

Introduction

This project aims to use a smartphone to control an LED board as a turning signal. The ESP8266 will serve multiple roles: Access Point, microcontroller, and server. The web server will host a simple webpage featuring three buttons: "Turn LEFT," "Turn RIGHT," and "Turn SOS." These commands will trigger scrolling text on the LED boards.

Initially, I tested two libraries: Arduino Core WiFi and ESP8266WebServer. While Arduino Core WiFi lacked efficient request handling (requiring the use of client.readStringUntil(\r) which was slow), the ESP8266WebServer library performed well and was selected for this project.

Required Items

NoDescriptionQuantity
1NodeMCU ESP12E1
24 LED Boards with MAX72191
35V Power Supply1

Procedures

  1. Connect the LED Board to Power Supply:

    • Connect the LED board to the 5V power supply.
  2. Wire the MAX7219 to NodeMCU:

    • Connect the following pins:
      • VCC to 5V
      • GND to GND
      • DIN to D7 (MOSI - GPIO 13)
      • CS to D8 (GPIO 15)
      • CLK to D5 (GPIO 14)
  3. Identify the LED Board Type:

    • Determine the type of LED board you are using. In this example, I used the FC16_HW type. You can read more about it here.
  4. Setup Arduino IDE:

    • Configure the Arduino IDE with the appropriate settings for NodeMCU 12E.
  5. Set Up WiFi Access Point (AP):

    • Configure the ESP8266 to act as a WiFi Access Point.
  6. Handle Requests:

    • Write void functions to handle the requests corresponding to each button (LEFT, RIGHT, SOS).
  7. View My Code:

    • The code for this project is available here.
  8. Video Tutorial:

Good Luck!

Wednesday, September 12, 2018

Arduino and 8x8 LED matrix


This is the datasheet: http://www.kingbrightusa.com/images/catalog/SPEC/TC15-11SRWA.pdf
I made the table below for easily wiring. Also, the pin of the array start from 1 - 8, and 9 - 16. To determine the location of the pin, you can start wiring 2 left side, or right side pin to 3.3V and GND. According to the table below, the when we connect pin 1 and 16 together, the LED at position Row 5:Column 8 will light up.

R and C Pin on LED board Pin on Arduino
r5 1 6
r7 2 8
c2 3 11
c3 4 12
r8 5 9
c5 6 a0
r6 7 7
r3 8 4
r1 9 2
c4 10 13
c6 11 a1
r4 12 5
c1 13 10
r2 14 3
c7 15 a2
c8 16 a3

I'll talk briefly about how it works and you can try it your own.

We have a Row and a Col(column), when both Row and Col are set to 1, the LED will off, so to keep the LED on, we set Row to 1 and Col to 0 at specific location.

We're going to use for loop run from row 1 to 8 and set each row to 1
Then, we use another for loop to set each column to either 1 or 0
Finally, we reset the whole column

Using the available code, I need to fix couple things

  1. I rearrange col array from 8 to 1
  2. Set inverse for the buffer 

The code from Arduino Project Hub is clever
I've learned that to manage grids or matrix we should add all pins to constant array rows and columns such as:

const byte rows[] = {
    ROW_1, ROW_2, ROW_3, ROW_4, ROW_5, ROW_6, ROW_7, ROW_8
};
const byte col[] = {
  COL_1,COL_2, COL_3, COL_4, COL_5, COL_6, COL_7, COL_8
};
The code and tutorial is here: https://create.arduino.cc/projecthub/SAnwandter1/programming-8x8-led-matrix-23475a

What we can do next?
👉Control LED board with Android or Iphone using ESP82
👉Add this board to my RC car pj
👉Add MAX7219

Sunday, August 26, 2018

Learn AI

youtube: https://www.youtube.com/watch?v=cKxRvEZd3Mw
classifier
giving a sample -> say it's apple
supervised learning

pip install -U numpy scipy

http://scikit-learn.org/stable/install.html
https://www.tensorflow.org/

Sonic Pi

Learn more at: https://github.com/samaaron/sonic-pi/wiki/Sonic-Pi-Internals

Here is my code:

Thursday, April 26, 2018

S-Parameter or Reflection Coefficient

S_11 = 0 dB: all power is reflected back to antenna
S_11 = -10 dB
S_11 = reflected signal / transmitted signal
S parameter is also called reflection coefficient