WeisTek’s Current Build Logs (pinned)

Featured

If using my designs or content in your build logs please be sure to cite my blog as well, I appreciate it very much. If I have missed any attributions please let me know and I will correct it.

This post is pinned to make it easier to find the build logs. I will update this post regularly


Announcements

Find this blog useful or interesting? consider supporting me by buying directly from me on my Tindie store, or support me through PCBs.io <- this nets me a small credit every time you purchase one of my designs shared through them.

(Price drops on ParraPortCNC, and Attiny85A dev board. New items and updated stock!, ParraPortCNC A2.2 now in stock!!)

k40 middle man boards with connectors, now available from my Tindie store!

I sell on Tindie


Current Build Logs

K40 laser build log links have been moved to the temporarily postponed section.

Jackel3D (Work in progress, Build log coming soon.)

CPLDuino (XC9536XL) Mashup (External)

8bit Avr Tutorials in C using Atmel Studio 7

Gerald chess board 01-01-2017.

External Build log: miniSam-Zero, New serial bootloader for Arm Cortex M0+

20160706_093510

Mini CRT clock

image

Traveling Hacker box’s

20160615_183230

Maintaining old lab equipment

This section is dedicated to posts about old lab equipment.

20160515_132533.jpg

GPS Disciplined (selectable) frequency standard

3020T Chinese CNC router build logs

3020T CNC.

ParraPortCNC 3020T CNC upgrade build logs

Updated rev A2 now in my Tindie store

20160131_143312

External build log: Micro numitron clock

Finished clock added to the hackaday square inch contest.

Finished clock added to the hackaday square inch contest.

NumiClock, VFD, Numitron, Nixies | starting a clock design

NumiClock is ALIVE!

NumiClock is ALIVE!

K40 MiddleMan board files, and links Updated

Custom GameBoy flash cart.

Custom Gameboy flash cart based off of xzakox’s mbc emulated cart design, updated with newer components and re routed for use with oshpark, custom pixel art.

Temporarily postponed build logs

K-40 Laser upgrade and modifications (Arduino/Ramps)

Before

After

image

  1. Part 1
  2. Part 1A
  3. Part 2
  4. Part 3 : Cleanup and a closed loop cooling system.
  5. Laser mis-haps, final post delayed.
  6. Final Post (Cleanup, small changes, middleman files release, FIRE!) <– Delayed
  7. Revival, new frame/enclosure.

Designing an Arduino based alarm clock (pending post).

  1. Part 1 Intro
  2. Part 2 (coming soon, Postponed)

DIY reflow oven (Pending post).

  1. Part 1 (Pending post).

Diy Microcontroller Retrospect + custom robots (awaiting parts, pending post).


Old Build Logs

Rasperry Pi OwnCloud. (Still relevant)

  1. Part 1

Prusa Mendel I2 Build and upgrades. (Super Old)

  1. Part 1: Building the frame.
  2. Part 2: The Brains.
  3. Part 3: Upgrades and stuff. (Pictures are missing, will fix soon.)

PS3 (PC power supply conversion / Reflow) : (Failed).

  1. Part 1

Omnia I900 Custom USB data cable. (Super Old)

  1. Part 1

Go from Da Vinci Jr to the Jackel3D

Work in progress,

First let me say that this is not a finished project, it is still very much under development. As such I want to use as much from this printer as possible, the only things I imagine having to buy is vitamins such as 10mm M4 hex nuts and some M4 bolts, maybe a few 20mm M4’s. I have a metric ton of M3’s laying around from previous builds so maybe I will use those as well, and I have a few ramps board with drivers, LCD’s etc etc. BUT, I will try to use as much from this printer as possible to make the conversion a cheap as possible.

I was given a Da Vinici Jr 1.0 as a mess around project. I tried to set it up and well.. either I got a crap unit or XYZ needs to rethink what they are doing. I could not for the life of me get this thing to print in any decent quality, not to mention the closed source firmware and software and to top it all off the closed source filament. Let me just say .. NOOOOOOOOOOO

Ok I may have gotten a bad unit who knows, all I know is that it sat for 2 years and did nothing but take up valuable space in my office. My Prusa I2 works circles around this thing. So what to do with a borked printer. Well what would any self respecting hacker/engineer/whatever you call yourself do? take it apart, see what parts it spits out and make something new.

So through this build log we are going to go through what it takes to make the Da Vinci Jr a good printer, and by that I mean what kind of printer can we build from its guts. From what I can piece together so far a fairly decent printer. So far I have modeled part of the frame using the existing Aluminum extrusions extracted from the unit and whipped up some parts that will need to be printed. Here is a list of the things I plan on using from the Da Vinci Jr.

  • 2020 Aluminum extrusions, you get 5 x 376.009mm and 4 x 299.5mm enough to build a Prusa I3 style frame.
  • 4 x Alu L brackets.
  • 10mm Diameter Polished rods 2 x 296.05mm “Bed rails for our build”
  • 10mm Diameter Polished rods 2 x 299.65mm “Z rails for our build”
  • 8 x Brass? 10mm inner Diameter | 12mm outer Diameter bushings “They move so well”
  • 2 x brass? 8mm diameter bushings from the x carriage.
  • Z axis Stepper motor x 1
  • Z axis coupler 5mm to 8mm x 1
  • Z axis sudo ball screw, looks more like a fine pitch (0.75mm) single start lead screw.
  • Z axis lead screw nut. “Slides ok, my 4 start lead screw is nicer.”
  • X axis Stepper motor x 1 with plastic pulley “I’d recommend replacing with a GT2 style 20T pulley”
  • Y axis Stepper motor x 1 with plastic pulley “Same as X axis pulley”
  • Bowden style extruder x 1 “We may be using this.”
  • Bowden style hot end x 1 “We may modify this to be used. I don’t like the quick release stuff.”
  • A bunch of misc nut and bolts, screws etc. only the nuts and bolts used for the Alu extrusion will be used.
  • There are some pulleys as well but they are cheap plastic ones, if they fit the GT2 belt may as well use them.

The other stuff is trash, the main board, the screen may be able to be used or used for another project. Other than that and needing another printer or a friend to print out the other parts we may vary well have a nice printer on our hands.

Starting out with the frame, we get some nice L brackets to use for our main Y axis, that not being enough for a rigid frame I whipped up some over engineered plastic bits for you guys to spew out of your printers.

The Y corners are made of 4 separate pieces all printable on my tiny MP select mini V2 printer.

  • Alu L bracket, + 2 x 10mm bolts
  • 1 x Top corner bracket + 7 x 10mm bolts
  • 1 x L corner bracket + 7 x 10mm bolts “the fourth bolt closest to the foot is bolted directed into the threaded portion of the extrusion”
  • 1 x Bottom foot bracket + 4 x 10mm bolts

wow all together that’s 20 x 10mm M4 nuts and bolts. That corner is not going anywhere, the only corner I have now for testing the printed bits is stupid strong at this point.

Next we have the Y rode holder, part also prints fine on my tiny printer.

The rods from the Da Vinci Jr are 10mm rods with 8mm end shafts. The Y rod holder bolts to the top and the back side of the front and back Alu extrusion profiles.

Next we have the Y bushings, they are super nice, way nicer than my LM8UU’s. But in order to use them we need something to capture them to a plate. This is what I came up with.

So far this works really well, these bits lock into place quite snug and won’t let go when bolted to a plate of some sort. We may find that we need to extend each side of the holder to allow for a longer bolt to stop twisting if there is any.

The final part I have tested, I still have to mount to the frame. Is the Z axis stepper mount, this printer will only have 1 x Z axis stepper but I think since the bushings have such a nice fit we can get away with only one.

This is a Prusa I3 style mount, as such that the Z axis smooth rod fits next to the stepper and the stepper bolts right to the frame with 7 x 10mm M4’s.

So far that’s where I will leave this post, at first I thought I was just going to scrap the Da Vinci Jr for parts and think nothing of if. I would have taken pictures of the tare down or a video had I thought about it. I am currently waiting on a load of M4 nuts and bolts from china to finish test fiting some stuff. I have also ordered 2M of 6mm GT2 belt a few GT2 20T pulleys and some idler bearings. I will put them in a bill of materials soon.

Please do share your thoughts and comments, I would like feedback on this project. I also want this to be something that people may be willing to take on if they have a borked unit sitting around. Until next time (soon hopefully)

GB flash cart, Board routing is almost done.

I tend to like to power through designs but this time im forcing myself to take time and think it through.

This where I’m currently at in the design. I still have to assign the 64 pin package all of its nets but I think I can do everything in two layers 🙂

it’s funny to think that the cartridge will be x times more powerful than the hardware in witch it will sit. but I figured this would be the cheapest way and least component count to get a usb flash cart.

if I can swing it I may add uSD support… well see if I want to punish myself that bad with only two layers.

until next time.

Custom Gameboy Cartridge round 2..

I’ve decided to finish thus project finally. between work etc I have a little time to see if I can bring the project into the new age or more recent age and source readily available parts that don’t cost an arm and a leg.

so far I have the carts at a reasonable BOM price. 

The specs so far are:

  • An MBCx simulated by a CPLD
  • A 32Mbit (4MByte) flash ROM upgradable to 64Mbit.
  • A 1Mbit (128KByte) Flash for non-volatile RAM
  • Bi-Directional Voltage converters for the ROM since the only 5v chip is the RAM.
  • LDO for the rest of the 3.3v logic.

I have also sourced clear green (non official) game boy cartridges to house the PCB.

The schematics are done and all the parts are ordered. I still have to route the board but will soon send for DV2 of the cartridge. 

if I have time or the patience I will try my hand at a bootstrap menu to take advantage of the 32Mbit/64Mbit space to allow for use as a multi cart.

until then. stay happy stay healthy and keep hackin.

8bit uC’s (AVR) USART in C

In this tutorial we are going to get serial communication up and running. Having serial communication helps in that we can send human readable messages to a computer instead of decoding a blinking led, unless that’s your cup of tea go ahead and skip this tutorial 🙂

Getting started.

We are going to learn about header files as well here as I like to split my code up into files that have meaning, such as uart.h and uart.c having your functions etc in these files makes it easy for you to remember along with good function names where your function is. Incase the need arises to edit or change something in the function.

Adding files to our project.

First we need to add a few files to our project, board.h, uart.h, uart.c. board.h is where we will redefine all of our important pins, our clock, desired serial baud rate etc.

Uart.h and uart.c are going to house all of our important and reusable serial functions. One approach to creating new functions is to use main.c as a prototype area, define your function in main.c and test it out. If all goes well it can go into the library it was meant for.

So right-click on your project name go to add and add new. This will bring up a new window that allows you to pick and name a new file.

atmelstudio5

We will be adding two .h (header files) and one .c file to our project. Go ahead and create the required three files. Your file tree should look like this now.

atmelstudio6

In brief what is a header file? A header file contains the definitions for your desired library, this file is also included in your main program with the

#include

directive. This tells the Atmel studio you want this library and it’s functions compiled into your program. If you try to use a function from a library without including it the compiler will throw all kinds of errors some cryptic and won’t compile your project.

Board.h file contents.

So first we are going to redefine some pins define our clock and desired baud rate. I will comment the code so it’s well explained. I will go into further detail on registers when we do uart.c.

/*
  board.h
  Author OCybress
  Summery used to define easy to. remember names 
  and other board related defines.
*/

#ifndef BOARD_H_
#define BOARD_H_

//this will be used in calculating baud. 
//Its also defined in your compiler settings 
//so this may throw a warning F_CPU redefined.
#define F_CPU 16000000UL

//move led pin definition here
#define LED_PIN PB5

#endif /* BAORDS_H_ */

uart.h header file

the uart header file contains some uart specific re defines and function prototypes, uart_init, uart_write_byte, and uart_read_byte

#ifndef UART_H_
#define UART_H_

//uart related defines
#define UART_DATA_REG UDR0
//port D bit 0, TX (register UDRE0)
#define TX UDRE0
//port D bit 1, RX (register RXC0)
#define RX RXC0

//baudrate can be set to 115200 as well since we are 
//calculating the baud rate based off F_CPU
#define BAUD_RATE 9600

//Calculated baud rate basses on F_CPU
#define BAUD_PRESCALLER ((F_CPU/(BAUD_RATE * 16UL))-1)

//usart baud rate register high byte
#define USART_BAUD_REG_HB UBRROH
//usart baud rate register low byte
#define USART_BAUD_REG_LB UBRR0L
//tx/rx en bits
#define TX_ENABLE TXEN0
#define RX_ENABLE RXEN0

//Uart Control and Status Registers
#define UART_CTRL_STS_REG_A UCSR0A
#define UART_CTRL_STS_REG_B UCSR0B
#define UART_CTRL_STS_REG_C UCSR0C

//critical uart functions
void usart_init (void);

/*********************************/
/*Useful uart function prototypes*/
/*********************************/
uint8_t uart_read_byte();
void uart_write_byte(uint8_t data);

#endif /* UART_H_ */

uart.c

If you wish to use the bare registers instead of the redefined names feel free, it will work the same. Note they are already defined so you do not have to define the register names. For example if you wanted to use UDR0 instead of UART_DATA_REG that will not effect the code in any way. In fact I urge you to use the registers instead of redefining them for the first few times you write your uart functions. Once you are comfortable with the register names then you can rename as you see fit.

#include "board.h"
#include "uart.h"

/*************************/
/*Critical uart functions*/
/*************************/
void usart_init ()
{
    USART_BAUD_REG_HB = (uint8_t(BAUD_PRESCALLER>>8);
    USART_BAUD_REG_LB = (uint8_t)(BAUD_PRESCALLER);
    UART_CTRL_STS_REG_B = (1<<RX_ENABLE )|(1<<TX_ENABLE);
    //Data flow settings.
    //data bits = 8, parity = none, stop bit = 1
    UART_CTRL_STS_REG_C=(3<<ucsz00);
}

/***********************/
/*useful uart functions*/
/***********************/

/*Read one byte to the UDR0 register*/
uint8_t uart_read_byte()
{
	//wait until the port is ready to read.
	while((UART_CTRL_STS_REG_A &(1<<RX))==0){}
	//return received data
	return UART_DATA_REG;
}

/*Write one byte to the UDR0 register*/
void uart_write_byte(uint8_t data)
{
	// wait until the port is ready to write.
	while((UART_CTRL_STS_REG_A & (1<<TX)) == 0){}
	
	//write data to port
	UART_DATA_REG = data;
}


Putting it all together.

Now that we have everything setup, and our uart library is ready to go. Lets get main.c ready to spit some text to our terminal.

#include <avr/io.h>
//include our library files.
#include "boart.h"
#include "uart.h"

//Test message to send over uart.
const char aTestMsg[] = {"hello world"}

//example of a prototype function in main.c to later
//move into uart.c
void uart_write_string(char *s)
{
	unsigned int i=0;
	while(s[i] != 0x00)
	{
		uart_write_byte(s[i++]);
	}
}

void main(void)
{
	/*setup uart for 9600baud*/
	usart_init();
	
	//send byte with uart example Hello World
	uart_write_byte("H");
	uart_write_byte("e");
	uart_write_byte("l");
	uart_write_byte("l");
	uart_write_byte("o");
	uart_write_byte(" ");
	uart_write_byte("W");
	uart_write_byte("o");
	uart_write_byte("r");
	uart_write_byte("l");
	uart_write_byte("d");
	uart_write_byte("\n"); //new line

	//send a string 
	uart_write_string(aTestMsg);
	
	uint8_t u8_data;
	
	//example of sending a string without the array.
	uart_send_string("Send an option, h = hello, x = exit\r\n");
	//uart_read_byte example
	while(u8_data != 'x')
	{
		u8_data = uart_read_byte();
		if(u8_data == 'h')
		{
			uart_write_string("hello\r\n");
		}
		if(u8_data == 'x')
		{
			uart_write_string("Exiting menu.\r\n");
			u8_data = 'x';
		}
	}/* end while */

	uart_write_string("End Example..\r\n");
	
}/* end main */

Once everything is in order. Compile the project and upload it to the avr (atmega328 series), load up a terminal such as cool term and you should be ready to go. Be sure to go to options and set your connection settings to 9600 baud, the rest should be the default settings.

I’ll post a terminal picture soon.

Going forward.
Now that we know how to toggle some bits, and use the uart to extract useful information from our microcontroller. We can do a lot more experimentation and still know whats going on inside the micro if anything goes wrong.

Next time or later on we may look at implementing Uart functions in ASM just for the hell of it 😉

Whats next?
I think the ADC is a good place to start next, as this allows us to input real world data into the micro , such as a 4×3 keyboard, analog sensors etc. Or we may do something with SPI flash… If you have any comments, questions, or corrections feel free to drop a comment or email me.

8bit uC’s (AVR) getting started in C

A Series of Tutorials. (Rather a space to hold my learnings, so i don’t forget them.)

So I’ve meant to make a “tutorial” series for a while on getting started with atmel avr’s. This is not going to be a tutorial on the Arduino ide or their library’s for that matter, however we will be doing these tutorials with the atmega328 uC IC.

Getting started.

So you bought some Atmega328 microcontrollers from some distributor on the internet, now you are wondering what you should do or how to get started with them. Well you have a few options, go download the Arduino IDE which I recommend if you don’t have a stomach for C and working with Avr registers, boot up Linux and setup an AVRGCC environment and do everything that way. What I recommend, since I run windows on most of my rigs aside from servers, is to download Atmel Studio 7. This software will give you just about everything you need to get started programming these avr’s.

You may also want to pick up an Atmel ICE programmer from digi-key as this allows you to program and debug not only Atmel 8bit avr’s but ARM cortex controllers as well. I will not go into detail on how to bread board a bare atmega328 or other uC at this time. You can follow along with these tutorials with an arduino uno, just keep in mind if you program via ICSP such as with the Atmel ICE you will lose your boot loader. You can reflash the boot loader again later through the ICSP header.

Loading a new project

With Atmel studio 7 installed, start the program and let everything load.

Click on new project.

atmelstudio1

Next you will be presented with what type of project you wish to create. Keep the defaults but change the name of the project to something easy to remember and select a directory to save to.

atmelstudio2

Last thing to do before you can start slamming code into your mint new project is to select the uC you will be using. Since we are using the atmega328, that is what I have selected. This screen tells you what programmers are officially supported with the selected device and gives a link to the datasheet.

atmelstudio3

Lets start twiddle some bits.

if it’s not already open, double-click on main.c in the right panel to open your project main file. you can name this file anything but usually it’s a good idea to name it something short and to the point main is a good name.

you will see code in the file already generated for you.

#include <avr/io.h>
int main(void)
{
    /* Replace with your application code */
    while (1)
    {
    }
}

If you pull up a pin out of the uC in question via google you will see that pin 13 (arduino style) is listed as PB5, shown below.
atmega168pinmap2
lets break this down a bit.

PB5 = [PB] the port the pin is connected to internally
[5] is the bit associated with that pin.

We also need to know about a few other registers

DDR[port] eg DDRB for Data Direction Register PortB. Setting this to 1 will set all pins on that port as output, atm we dont want that we only want to set PB5 as an output.

We do that with a bitwise OR operator |, likewise to set as input use a bitwise AND &

Heres how that looks

DDRB |= PB5;

We can make PB5 easier to remember by defining it into a new name. At the top of our code under the

#include

We define this macro

#define LED_PIN PB5

All this define does is say the defined name (LED_PIN) is now PB5, you can still use the name PB5 but this just makes it easier to remember your pins etc.

Also include delay.h at the top.

#include <avr/io.h>
#include <util/delay.h>

So now lets use our newly defined pin name with this code.

//defines uC pin names, ports, etc.
#include <avr/io.h> 
//used for _delay_ms() function
#include <util/delay.h> 		

//redifine pin.
#define LED_PIN PB5 			

//main
int main(void)						
{
   //Set pin as an output
   DDRB |= LED_PIN; 			
   
   //infinite loop
   While (1)					
   {
       //set led pin high
       PORTB |= LED_PIN; 	
       //wait 1s
       _delay_ms (1000);
       //set led pin low
       PORTB &= ~LED_PIN;
       //wait 1s
       _delay_ms (1000); 		
   }
}/*end Main*/

As one would expect this will toggle PB5 every 1 second. This is usfull in that the uC can present usful information to you about what is going on inside. Now at the top of the program click the little green arrow to compile and program without debugging.
atmelstudio4

Now watch as your creation blinks at you mindlessly… Be sure to save your project as we will be using it in the next tutorial as a base.

Whats next?
In the next tutorial we will configure the UART, better known as the Serial port so we can get human readible information from the uC. If you found this tutorial usfull or have questions, feeel free to drop a comment.

Until next time!