donderdag 6 februari 2020

FPGA first steps -1-

My last blog post was more than a month ago. However this does not mean that i did not projects or learned new things. For a long time i wanted to do something with FPGAs but never found a good way to start.
Recently i did some research how to start with board below 22 euro from AliExpress. I found some boards. e.g. the EP2C5T144 and EP4CE6E22C8N Altera FPGA Cyclone ii and iv development boards. These boards also need an USB blaster (that only a cost a few euros). They are not the newest boards but offer a cheap way to start.

Sooner than expected i received EP2C5T144 Altera Cyclone ii development board from China. This blog post is a short introduction also to log results of some of my experiments until now.
The Cylone ii is an older FPGA that is not supported anymore in the newest software only Quartus II version 13.1 (servicepack p1 version 13) or lower can be used. There is a free version of the software. Registration for download is required. The software can be a bit confusing as it has many options. The free version is sufficient to use the FPGA. Some options only work in the payed version.
There are warning not to use directory or file names with spaces.
The development board came together with an USB blaster. The 4 Dupont connectors 2*14 pin where not yet soldered.
On circuit diagram i found for this board is an IS61LV25616-10T memory chip. As mentioned in the text in the article i found this is more the explanation how to connect the chip as it is not on the development board. Perhaps if i ever make an expansion board ( JLCPB ) for this FPGA i will add this to the board as these chips are still available.
The board has two connection points for the USB blaster:
JTAG one close to the 2*14 pins for temporary programming using an *.sof file.
AS close to the edge of the PCB for more permanent programming using a *.pof file.
The board has a power led and 3 leds connected to the FPGA
Led D2 = PIN_3
Led D4 = PIN_7
Led D5 = PIN_9
For input there is one push button "key" connected to PIN144
Soon i discovered the FPGA is not powered over the USB blaster and needs a separate 5V power source. Fortunately i could temporary cannibalize a 5V power adapter with the right connection while waiting for a power adapter from China.
Replicating and adapting some simple experimenting with this FPGA i also discovered a little issue. Perhaps i do not configure the i/o the right way. Touching the push button with my finger (without really pushing) also had effect on the leds. I only could work reliable with the logic when using a pen or some other con conduction material to push the button This issue was not reported in the articles i read.
The one input pin also limits the possibilities for experiments so i decided to solder the Dupont pins. As i was soldering i also did put a 2 pin Dupont connector on P8 to easy access to the 5V power. I could resist my temptation to solder (more Arduino style) female in stead of male 2*14 pins. So i am still compatible with other FPGA owners.
This way it was easy to connect more buttons. Also input is more comfortable without issue when touching the button. I found a YouTube video with information where 5 buttons wired to pin 40 - 44 and the other side the button connected to ground. This is not explained in the video, however the next FPGA video of this YouTuber is explained that this connection to ground will give inverse logic (1 is default 0 = pushing the button). I did not repeated his experiment but used this configuration with graphical creating some logic in the Quartis ii. It did not work and i also could not find the setting for internally configuring a resistor for the input pin. Finally i changed the button connection from ground and connected it to VCC (3V3 pin 28 on P2). After this change my circuits did work.
However the leds also dimmed when i touched a ground connection with my hand. Even some times the leds reacted when moving my hand near the wires, especial when leds where not included in a circuit.
In an next blog post i will try to explain in more detail how to start using this interesting FPGA the software to create a project.
Summary:
It is possible to start cheap with FPGA using an EP2C5T144
You also need a USB blaster and a 5V power supply and perhaps a soldering iron if headers are not soldered yet.
Use the free software Quartus II version 13.1 (or below) as the higher versions do not support the Cyclone ii anymore. Do not use space character.
It is nice to also have some buttons and Dupont wires as this board only has one push button for input. 































maandag 23 december 2019

ATTiny85 RGB led

An RGB Led with DuPont connectors from a previous post was tested with the attiny85 with Dupont female wires. the wire without resistor was connected to ground and the other led pins with the resistors to P0, P1 and P2.
As program i used the Example DigisparkRGB program. ( Examples \  DigisparkRGB \ DigisparkRGB  ).

#include <DigisparkRGB.h>
/*
 Digispark RGB

 This example shows how to use soft PWM to fade 3 colors.
 Note: This is only necessary for PB2 (pin 2) - Blue, as Red (pin 0) and Green (pin 1) as well as pin 4 support the standard Arduino analogWrite() function.

 This example code is in the public domain.
 */
byte RED = 0;
byte BLUE = 2;
byte GREEN = 1;
byte COLORS[] = {RED, BLUE, GREEN};

// the setup routine runs once when you press reset:
void setup()  {
  DigisparkRGBBegin();
}


void loop ()
{
//direction: up = true, down = false
boolean dir = true;
int i = 0;

while(1)
{
fade(COLORS[i%3], dir);
i++;
dir = !dir;
}
}
void fade(byte Led, boolean dir)
{
int i;

//if fading up
if (dir)
{
for (i = 0; i < 256; i++)
{
DigisparkRGB(Led, i);
DigisparkRGBDelay(25);//1);
}
}
else
{
for (i = 255; i >= 0; i--)
{
DigisparkRGB(Led, i);
DigisparkRGBDelay(25);//1);
}
}
}


A video of the result was posted on my YouTube channel :
(At that time this blogpost was not yet ready for publishing.)

As i was not very happy with the recorded colors, i tried to improve it by putting a white paper below the led. However the improvement was only minor and the real colors are different. I hope the video will at least give a little impression of the changing colors.
As all the colors are faded in the program i did not specially select the led color pins to be matched to the colors in the program (  RED = 0;  BLUE = 2;  GREEN = 1; )


zondag 15 december 2019

SMD Leds breadboard friendly -2-

Mailbag
August 2019 i published how to make SMD leds breadboard friendly with Dupont connectors.  https://blog.jeronimus.net/2019/08/smd-led-breadboard-friendly.html

Another option to make SMD components more breadboard friendly is to using a PCB. I found some SMD PCBs on Aliexpress and ordered 3 lots with 10 PCBs. (30 PCBs in total)
The PCBs arrived some days later in my mail in a small envelope. See "Mailbag" picture on the right. They match DIP 8 format and you need to break them apart yourself.
Besides for DIP 8 IC's these PCBs can also be used for other SMD components.
For a test I soldered some different SMD leds on them. To solder the Dupont pins to the PCB i used a small breadboard to temporary fix the Dupont pins at the right positions.


Business Card PLUS (#003)

In this post a detail views of my this first version of my PCB business card. One side is more the business card side with contact information.
Also two rulers are in included. One on the bottom with cm divided in mm.
The division on the right can be used for counting PCB pins.
Text on the PCB is aligned with the holes in the PCB. (E.g. the o in Jeronimus. However in linkedin i needed to put the hole over the e.



The other side of the PCB is for the electronic circuits that can be build. It is more a development type board than one circuit and can also be used as a breakout board. So not all items need to be placed on the board. For several components the SMD or thru hole version can be used by placing the SMD pads between the holes for the thru hole version. The PCB can be used as an Arduino Uno shield / Arduino breakout board. In the white rectangulars long dupont pin holders can be placed. The two Arduino pin holders are not at "Dupont" distances. The good thing about this is that this prevents some mistakes when connection a shield. The disadvantage is that it is not easy to connect cheap prototype pcbs like the {} 5cm*7cm pcb.
By adding female pin holders vertical on the two columns where the small white line at the top this PCB can connect an Arduino pins to the 5cm*7cm PCB. Also on the top two blocks for 2*4 connectors are marked ESP01.
The right one is for "normal use" and the left one can be used to program an ESP01. The ESP01 can be used without an Arduino. An connector for an CR2035 can be used as power source, LA0 and LA2 are locations for 2 leds (SMD or thrue hole) with corresponing resistors ( PL0 and PL2),

On the bottom are three metal pads. 5V , 3V3 and GND for crocodile clips. Above the GND pad is a an SMD IC 8 SOP can be soldered. ( e.g. 555 or memory chip.)the pins of this SOP8 are only connected to the nearby holes. On the right side are holes for two push buttons.C1 and C2 are locations the corresponding capacitors. Between the two buttons is a location for a jumper (or wore bridge) to program ESP01 1  (top right). In up coming blog posts more details will follow.





vrijdag 13 december 2019

Business Card PLUS (#002)

PCB Business Cards
Yesterday I posted a short quick message on my blog to show my Business Card PLUS have arrived.
I decided that my (classic) Business Card needed an update. I still have several of this paper business cards. As the information on them is still up to date i don't like to throw them away as waste. So will still use them but, if i become more happy with the Printed Circuit Board  - Business Cards i expect not to order new paper cards. I wanted a business card that can be used.
The price of manufacturing this PCBs in China is low. To get PCBs in low quantities relative cheap best stay under the size of 100 mm * 100 mm and the minimum order is 5 pieces. By "panelizing" the PCB you can even get more PCBs. I don't like to throw away unused PCB's. Perhaps if i need a PCB for future project perhaps i will design them so the PCB can also be used as a business card.
However a few weeks ago i started designing a (test) PCB especially to be used as a business card.
'classic' Business Card
Panelizeing the PCBs gave multiple PCBs with a break line for easy separation. As the manufacturer needs to add some text to your PCB to identify the order between all other orders i a added borders and asked the manufactured to place there ID on the boarder. I even changed the size of the PCBs a little from the standard size. This way two PCB/Business cards can be placed on one 100*100 mm PCB. As the minimum order is 5 (< 100*100 mm) PCB you will get after separating them 10 cards. ( In fact 10 panelized PCBs where ordered ,so i now have have 20 new business cards / PCBs that can be used different ways.
The disadvantage of my new card is that it is not possible to write something on the back.As i also have plans to add RFID with a sticker (also usable with classic paper business card) this can change).
To quick start, this first PCBs contain no QR. code. However i did add a ruler to the design.
The PCB can be used for electronic circuits in different ways. On my blog i will post some examples with test results and hope it will work in this first batch of PCBs. If not i can still use this batch as 'regular' business cards. If you get one of my PCB business cards and want to dispose it, consider giving it to someone else who perhaps can use it.
Also i would be happy to know how my PCB business cards are used (or only the [complex] PCB). Comments on this blog, mail, about this topic is welcome. I will share the Gerber files so you can (adapt and) order your own PCB if you don't get one from me. New blog post about this PCB will be published soon.


donderdag 12 december 2019

Business Card PLUS (#001)


Quick update :
"My Business Card PLUS - Printed Circuit Boards " arrived from China.
Not only some different (example/demo) circuits that can be made with my Business Card need to be tested (and published).
I am now testing these cards and also did give away some. Test how the PCB with text will degrade after some time also seems important.
More details about this PCB follow.

dinsdag 20 augustus 2019

ATTiny85 Mouse

The ATTiny85 can not only act as a keyboard, it can also act as a mouse.
Extreme caution if you use this as the program does not only mouse movements, it also clicks!
( Examples \ DigisparkMouse \ Mouse )

// DigiMouse test and usage documentation
// CAUTION!!!! This does click things!!!!!!!!
// Originally created by Sean Murphy (duckythescientist)

#include <DigiMouse.h>

void setup() {
  DigiMouse.begin(); //start or reenumerate USB - BREAKING CHANGE from old versions that didn't require this
}

void loop() {
  // If not using plentiful DigiMouse.delay(), make sure to call
  // DigiMouse.update() at least every 50ms

  // move across the screen
  // these are signed chars
  DigiMouse.moveY(10); //down 10
  DigiMouse.delay(500);
  DigiMouse.moveX(20); //right 20
  DigiMouse.delay(500);
  DigiMouse.scroll(5);
  DigiMouse.delay(500);

  // or DigiMouse.move(X, Y, scroll) works

  // three buttons are the three LSBs of an unsigned char
  DigiMouse.setButtons(1<<0); //left click
  DigiMouse.delay(500);
  DigiMouse.setButtons(0); //unclick all
  DigiMouse.delay(500);

  //or you can use these functions to click
  DigiMouse.rightClick();
  DigiMouse.delay(500);
  DigiMouse.leftClick();
  DigiMouse.delay(500);
  DigiMouse.middleClick();
  DigiMouse.delay(500);

  //for compatability with other libraries you can also use DigiMouse.move(X, Y, scroll, buttons)
}

I have tested this script on with my digispark and it worked. The movements are relative to the current position. I did not dare to experiment and move it to bottom left on a windows computer and use Microsoft start to start programs.

maandag 19 augustus 2019

ATTiny85 Keyboard

One of the scripts that works on my attiny85 is a keyboard emulator.
All is done  with the next simple script that was available as a sample script in the library;
(   File \ Examples \ DigisparkKeyboard \  Keyboard )

#include "DigiKeyboard.h"

void setup() {
  // don't need to set anything up to use DigiKeyboard
}

void loop() {
  // this is generally not necessary but with some older systems it seems to
  // prevent missing the first character after a delay:
  DigiKeyboard.sendKeyStroke(0);

  // Type out this string letter by letter on the computer (assumes US-style
  // keyboard)
  DigiKeyboard.println("Hello Digispark!");

  // It's better to use DigiKeyboard.delay() over the regular Arduino delay()
  // if doing keyboard stuff because it keeps talking to the computer to make
  // sure the computer knows the keyboard is alive and connected
  DigiKeyboard.delay(5000);
}


After uploading the script the program starts so watch out where to put the cursor when uploading the script.
The Digispark USB reacts if it is a keyboard where the  "Hello Digispark!" is typed over and over again (with a delay  5000 ).

Hello Digispark!
Hello Digispark!
Hello Digispark!
Hello Digispark!

An application could be reading some sensor data on the attiny85 and outputting it e.g. in a spreadsheet.