# 8. Embedded programming

## from last week

!!! Note
    Hamamatsu CNC is using the 1 flute straight bit (Tool_dia: 6mm, Shank_dia: 12mm) by default.  
    Learn about Up cut and Down cut endmill from the Tip [CNC tool](./tips/cnc_tool.md)

## Sunshine Protection Act in US

[article](https://gigazine.net/news/20220316-us-summer-time-permanent/)  

- 2023 Autum -> never change the time
- FA2024 22:00-1:00

## Preparation for next week
> **Molding and Casting**  
> *group assignment:*  
> review the safety data sheets for each of your molding and casting materials,  
> then make and compare test casts with each of them  
>  *individual assignment:*  
>  design a mold around the stock and tooling that you'll be using,  
>  mill it (rough cut + (at least) three-axis finish cut),  
>  and use it to cast parts  

### Assessment

[Assessment](https://fabacademy.org/2022/nueval/moulding_and_casting.html)

FAQ  

> **What does 3-axis milling mean?**  
> Answer: You should have smooth tilted or curved surfaces instead of  
> "steps" towards axis Z.

some flat surfaces and depth -> X

### Material ans Machine
- [Machinable wax](https://www.amazon.co.jp/Ferris-0662-FERRIS-%E5%BD%AB%E9%87%91%E7%94%A8-%E3%83%96%E3%83%AD%E3%83%83%E3%82%AF%E3%83%AF%E3%83%83%E3%82%AF%E3%82%B9-%E3%83%96%E3%83%AB%E3%83%BC/dp/B0081Y5DCC)
    - size: 152mm x 92mm x 39mm (real size is smaller)
- Machines
    - Genmitsu PROVerXL
        - work area: 400mm × 300mm × 110mm
    - MDX-15
        - work area: 152.4mm × 101.6mm × 60.5mm
- Endmill
    - 0.1250” DIA 4FL SE LONG AlTiN 1/8
        - Tool_dia: 1/8” =3.175mm
        - OverAll Length: 2-1/4”(2.25”) =57.15mm
        - **Rough cut**
    - 0.0625” DIA 2FL SE AlTiN 1/16
        - Tool_dia: 1/16” =1.5875mm
        - OverAll Length: 1-1/2”(1.5”) =38.1mm
        - **Finish cut**
- Design to think…
    - XY size: real wax size
        - Final Part size < wax size - wax_wallx2 - mold_wallx2
        - distance between bumps凸 & dents凹: tool size > 1.58mm(1/16”) > 0.79mm(1/32”)
    - Z depth: 1.5 in mill > 38.1 - 10mm?_in_collet
    - Registration Key, Registration post
- Process
    - 3D modeling
        - Fusion360
    - Tool Path
        - Genmitsu PROVerXL
            - mods?/FusionCAM?
            - gSender?/jscut?
        - MDX-15
            - Modela Player4 (Windows)
            - Virtual Modela (Windows)
                - [install](https://drive.google.com/drive/folders/1vT6Qu2YWHNU_4Q_TgWwoMA3wRYo0V9G0)
- Casting materials
    - Silicone rubber (mold)
        - Mold Star 31T
    - Urethanes resin (final part)
        - Smooth-Cast 320
            - color: Off white
        - So-strong
            - Color Tints for Urethane
    - Ref. [last year](http://academany.fabcloud.io/fabacademy/2021/labs/kannai/site/instruction/local_session/week11/)
    - [Low melting point alloy](https://www.zairyo-ya.com/products/236.html) (final part)
        - 138 C
    - [Tin](https://www.zairyo-ya.com/products/ZASN03001.html) (final part)
        - 231.9 C

### Preparation
- 3D modeling
    - [sample](https://a360.co/3mwu8mo)
    - design final part (positive)
    - design molds to make final part (negative)
    - design wax to make molds (positive)
    - Add pouring and vent ways
- make (next week)
    - mill wax for 2-3 hours
    - pour liquid silicone rubber into wax to cast molds (negative)
    - pour liquid resin into molds to cast final part (positive)


## Group Assignment

>   compare the performance and development workflows for other architectures

### Todo
- Seeduino Xiao
    - ARM
        - Atmel SAMD21
- [Seeduino Xiao RP2040](https://www.seeedstudio.com/XIAO-RP2040-v1-0-p-5026.html)
    - ARM
        - RP2040
- Raspberry Pi 4/3
    - ARM
        - Broadcom BCM2711/BCM2837
- Microbit v1
    - ARM
        - Nordic nR51822
- Raspberry Pi pico
    - ARM
        - RP2040
- Arduino UNO
    - AVR
- ESP32
    - Espresoif

Ref. [last year](http://academany.fabcloud.io/fabacademy/2021/labs/kannai/site/group_assignments/week08/)

## individual assignment:

>   read the data sheet for your microcontroller  
>   use your programmer to program your board to do something  
>   extra credit: try other programming languages and development environments

!!! Attention
     resistor[ruh_**zi**_str] : [electrical component that implements electrical resistance](https://en.wikipedia.org/wiki/Resistor#:~:text=A%20resistor%20is%20a%20passive,transmission%20lines%2C%20among%20other%20uses.)    
     register[**reh**_juh_str] : [a memory location within the actual processor that work at very fast speeds](https://computersciencewiki.org/index.php/Registers_within_the_CPU)

!!! note
    Easier procedure to burn bootloader into USB-D11C-serial board  
    [USB-D11C-serial (Arduino IDE + Xiao)](./tips/FA2022_usbserial_ArduinoIDE_Xiao.md)

### ToDO

### Read/browse one of the data sheets

- AVR-1
    - [Attiny3216](http://ww1.microchip.com/downloads/en/DeviceDoc/ATtiny3216-17-DataSheet-DS40002205A.pdf)
- SAMD11c
    - [SAMD11C](https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42363-SAM-D11_Summary.pdf)
        - SMART ARM-Based Microcontroller

Document what you learn form one/two of the topics

### Program your 1614/3216 board from USB-SAMD11C-Serial board via UPDI interface

#### Arduino Sketch
- Press Button and LEDs blink
- Echo in Serial monitor
- [Flash sound](http://academany.fabcloud.io/fabacademy/2021/labs/kannai/site/instruction/tips/flash_sound/)

#### Arduino with register_bit
- Ref. [register_bit](./tips/register_bit.md)

#### Arduino in C
- Ref. [Write C language program to AVR-1 series](http://tatsuro.homma.fabcloud.io/fabacademy/tips/embedded_programming/write_c_program_to_avr1/)