donderdag 21 januari 2021

2021 January Mailbag



 Some items in from my january 2021 mailbag from AliExpress
TM1638

QYF_TM1638

A PCB with 16 buttons and 8 seven segment displays and a driver that looks nice to use for I/O in projects e.g. with an Arduino.

10PCBs with 4 buttons

PCB with 4 Buttons

10 PCBs with 4 buttons each.
The PCBs and buttons are somewhat smaller than expected. (About 32mm*8 mm) However they are relative cheap and can be used easy in projects. Expect to use some with Dupont pins for use on a breadboard, some with wires and some direct soldered in projects. Also the next item is a reason that i did buy this cheap 4 buttons on a PCB.

433 MHz receiver / transmitter.

10 sets 433 MHz receivers and transmitters. Each set has 4 channels. I do not know if the signals interfere. It would be easy to connect one of the 4 button PCBs above with one of the 433 MHz transmitter. Where i ordered them antenna's where not included. However there are instructions how to make simple antennas for the receiver and transmitter.  I hope to find time to make an antenna set and test this item and post an update with more details on this blog.

UV Lamp

On AliExpress i also found this relative cheap 220 - 110 Volt UV Lamp. I ordered the 220Volt version without power plug and it came well packaged in foam. With a real UV lamp never radiate living tissue, your skin and take special care to protect your eyes.   I don't know if it really is an UV lamp and if it can be used for disinfection.   I have somewhere a UV detection card to test it. I decided to give it a try, perhaps it will be useful to radiate my postbag items. I did not test it yet.

Arduino CNC Shield

As i have on my long term wish list to experiment with a 3D printer / CNC machine or laser engraver i ordered this shield for an Arduino Uno. For the upcoming months i already have other plans, so this will become a long term project. However as i do not know how easy it will be in the future to get items from AliExpress i decided to already but this Arduino Uno Shield. 

 Arduino Mega and Enclosure

This two items (on one photo) where a little disappointing. It are two separate items bought from the same seller at AliExpress. On the right an Arduino Mega. On the left and middle a cheap enclodure to protect the Arduino Mega. When the enclosure came the top plate (in the middle of the photo) was not broken. This was due to my fault! I was surprised how easy it brake. I have mounted several similar enclosures for Arduino Uno's. This was the first one for Arduino Mega. The top plate from the enclosure (on the photo in the middle) dropped from table height on the floor and did brake.
Mounting of this cheap enclosure on the Chinese Arduino Mega clone was already a problem so unfortunate it was not a big loss. On this Arduino Mega the power and USB connectors are not on the exact right place so it did not fit in the holes of the enclosure. I think i will only mount the Arduino Mega on the base plate. I noticed the base plate has also holes for using it with an Arduino Uno what is a plus for this enclosure. For an Arduino Uno the holes fit exact so i expect the problem is the Arduino Mega. However i want to inform readers of this blog about the two minus points:
The top plate of the enclosure is fragile.
I think the power and USB connectors on this Arduino Mega Clone are not on the exact right position, so it does not fit in a 'standard enclosure'. 




zondag 10 januari 2021

Big Clive Supercomputer


Some time ago the youtuber Big Clive published on his Youtube channelhis "Big Clive's SuperComputer". Several other people build their own version of this device. Some even published it on their Youtube channel. ( e.g. Julian Ilett , Learnelectronics , TheEPROM9 )
I have the parts for it, it gives a nice endresult so i decided to build one. The "Supercomputer" is a display with flashing (led)lights giving the impression of a retro computer.
I wanted to use 5 mm color leds and make it configurable, power it with  9 volt battery and use a 5*7 cm perfboard (as i have several of these boards). On the 5*7 cm board could fit 6*9 leds. However on the perfboard are only holes for 6*8. There is just one row of holes missing for nice distribution of 9 columns of leds with two open holes between each column.
I decide to put 6 rows by 9 columns anyway. I did bend the legs of the leds in the last column in a chair shape and place his leds in the last column. With the zigzag chair legs the 9 led light columns gets distributed equally.
With 6 rows of leds one row with holes is free. I used this row for Dupont male pins with jumpers. Using the jumpers it is possible to enable or disable the power to groups of leds. As i have colored jumpers i decided to use jumpers in the same color as the corresponding leds.
For selecting groups of leds any arrangement is possible. I decided to use the arrangement below:
A rectangle of red blink leds surrounded by blue blink leds and these leds surrounded by a rectangle of yellow blink leds. (R=red, B=blue, Y=yellow the number is the subgroup Jumpers are marked italic)

R1


B1

B2

B3

Y1

Y2

Y3

Y4

Y3Y2Y2Y2Y2Y2Y2Y2Y4
Y3B3B1B1B1B1B1B3Y4
Y3B3R1R1R1R1R1B3Y4
Y3B3R1R1R1R1R1B3Y4
Y3B2B2B2B2B2B2B2Y4
Y1Y1Y1Y1Y1Y1Y1Y1Y1

Using the jumpers selections of blink led can be switched on or off.
With the 8 jumpers 256 combinations can be made (including the all off or all on combination )
This selection determines which leds will be included in a random blink pattern.

To simplify the circuit as much as possible i used one  (470 ohm) resistor for all the leds.. This resulted in a failure due to the blue leds. These leds are different than the red an yellow. When much other leds where switched on the blue leds did not light up or started only blinking when the power was switched on and soon faded out. When i added a second (470 ohm) resistor for all the blue leds the "supercomputer" worked well.

After checking that everything worked as expected  i added a layer of hot glue to the back of the perfboard for protection.

Perhaps i also will post some video's on my YouTube channel of my version of this Big Clive Supercomputer. (Please post comment if you would like this) 


 

zondag 13 december 2020

Arduino Elecrow EL Shield

A long time ago i ordered on Aliexpress an Arduino EL-shield as it seemed interesting to play with it. Due to other priorities i never found time to play with it. When looking in my box with Arduino shields i decided to do a quick test. 

EL wire is flexible plastic wire that glows brightly when high-voltage AC is applied to it.

Numerous cool colors are available. They requires very little current, but it can be difficult to work with because of the high-voltage requirements. The Elecrow EL Shield enables you to implement up to 8 channels of EL wires or tapes in an Arduino  project to control the EL modules. 
The controlling method is as simple as controlling an LED. Driven by PWM, it can create a colorful and florid effect by controlling each EL wire according to your own programs.
With the shield 4 pieces of 2 meter are included The shield has 8 channels. See table below.

Pin

PINEL Channel to ControlPWM?(My Wire)
D2EL Channel A-
D3EL Channel BPWM( Blue )
D4EL Channel C-
D5EL Channel DPWM( Orange )
D6EL Channel EPWM( Green )
D7EL Channel F-
D8EL Channel G-
D9EL Channel HPWM( Yellow )


On the Arduino Uno Pin D3 D5 D6 D9 are PWM pins.
Therefore i decided to use these pins for the EL wires. ( Also tested the other channels on the EL shield and they all worked. However on D2 D4 D7 D8 there is no PWM )
When the EL wires are not powered and give no light the color is a bit different. I added in the table above the colors of my wires. 


The EL modules needs a driver voltage more than 110V, AC. The included Elecrow customized inverter can convert the 5V-DC input to AC,110~220V. 
Connected the inverter to EL-Shield as below:
The input wire of the inverter is red/white, which need to be inserted into the DC_5V terminal of EL Shield, and the output wire(black) of the inverter need to be inserted into the AC>110V termina
Specs say that can drive a max of 15m EL wires. 4 x 2 m = 8 meter EL wire was included so lighting them all up at the same is no problem.
As this is all the EL-wire i have i could net test adding additional EL-wire.

In the instruction ( https://www.elecrow.com/wiki/index.php?title=8-Channel_EL_Shield ) First the Arduino is connected to a computer and a script is uploaded. After that the Arduino is disconnected from the computer. The shield is plugged in and an external mains power supply is used. As there is a high voltage on the shield (also near to the Arduino USB connector) i think this is the best way to prevent damaging your computer.
For some applications it would be interesting to see how long this shield can run on a 9 volt battery.
The disadvantage is that you need to plug and unplug connections when playing with the EL-shield. It also makes testing and debugging Arduino programs for this shield a little more difficult. An option could be creating a test with leds connected to D2 to D9 or using an good opto-isolation in the USB to your computer.

When running programs like the provided test program the system emits some low volume beeps and a buzzing sound. It is not a loud noise however i think it is important to mention it. It is possible the sound depends on the amount of power used by the wires and that only 4 of the 8 wires are connected.

On the EL-shield is also a red power led.
// EXAMPLE PROGRAM FROM THE ELCROW WEBSITE
void setup(){
 for(int i = 2; i<10; i++)
 { 
  pinMode(i, OUTPUT);
 }
}
 
void setEL(int ch) // set a certain EL on
{ 
  for(int i = 2; i<10; i++) // all on
 digitalWrite(i, HIGH);
 delay(1000);
 for(int i = 2; i<10; i++) // all off
 digitalWrite(i, LOW);
  for(int i = 2; i<10; i++) // 
 {
  digitalWrite(i, HIGH);
  delay(200);
  digitalWrite(i, LOW);
 }
 } 
 
int count = 0; 
 
void loop()
{ 
 setEL(count%4 + 1);
 delay(200);
 if(count++ == 1000)
 { 
  count = 0;
 } 
}
 
( The % in the Arduino program above is the modulo operator : count%4 is 'counter modulo 4 ' )


Conclusion:
  • An interesting relative cheap Arduino shield.
  • The (2 meter long) EL-wires give an interesting light effect for a project. Perhaps for your project you will need another color or more wire of the same color. (I did not test other El-wires.)
  • Due to the high voltage generated by the 'Elecrow customized inverter' i did not want to take risks trying the EL-lights with the USB connected to my computer. A USB opto-isolator or a test shield with leds to D2 to D9 would be useful.

 






zaterdag 12 december 2020

Using Forth on my ELF II

Using Forth on my ELF II computer (including a CREATE DOES> explanation ) is the second article in a series about me and using Forth that started with my blogpost “My first computer and Forth” 
With Forth running on my ELF II computer with its RCA 1802 processor now real high level coding was possible.
I used virtual disk blocks with code stored in memory (loaded and saved to my system using audio cassettes). For coding in assembler an 1802 assembler in Forth was available. Also Forth text editor was published in a Forth magazine. I controlled hardware with Forth (an AY-3-8910 audio chip that I had added to my system). Forth became one the most important work horse on my system

In Forth you can new own words in vocabularies using : ; Do (complex) math in RPN using a (Forth) stack. Add extensions for floating point and strings. In my opinion one of the most powerful features of Forth is CREATE DOES> ( in the fig-Forth version when i started with Forth  <BUILD DOES> ).

Explanation of CREATE DOES>

Before i can explain CREATE DOES> (or <BUILD DOES> as it was called when i started with Forth) some fundamentals of Forth must be known. I do not give an in depth explanation however it is always possible to ask questions after reading this article.
Parameters (numbers) in Forth are passed using a stack.
(New) Forth words are stored in memory in a dictionary.
Things you type in using your keyboard are placed in a special memory area, the terminal input buffer. Space or spaces are used as separators between words and there is a character defining the end of line.
The Forth interpreter looks at the first word from the terminal input buffer and tries to find it in its dictionary. If found, there is also code to be executed in the dictionary. If not found Forth tries to convert it to a number and places the number on the stack. If not found Forth shows an error message.
After that (when there was no error) it continues with the next word until the end of line character in the terminal input buffer. The end of line character is just a special Forth word that prints an oke prompt and lets you enter a new line of text in the terminal input buffer.
Defining a new Forth word is placing a new word in the Forth dictionary together with the code that needs to be executed.
Example 1 : ; ( or colon semi-colon ) construction.
: My1stWord DUP 2 + . ;
The : puts My1stWord in the dictionary. DUP 2 + is the Forth code that belongs to My1stWord
; ( semi-colon) indicates that this is the end of the definition made by : ( colon )
Example 2 VARIABLE ( I do not encourage the use variables as often it is better to store things on the stack than in a variables)
15 VARIABLE My1stVar
15 is put on the stack. A variable with the name My1stVar is created containing the initial value 15 . ( I assume you have a Forth system where the initial value is on the stack. it is also possible you have a system where no initial value is needed/used.)
When the new Forth word My1stVar is executed it gives a memory pointer to the address where the value of the variable is stored. To get the value ( 15 ) we can use the Forth word @ This word uses the address (that is on the top of the stack) and fetches the value.
The magic of creating new words is CREATE DOES>
CREATE creates a new word in the dictionary and the DOES> part tells what to do.
Let make the Forth word JVAR to create a variable This is relative simple:
: JVAR CREATE , DOES> ;
: defines the word JVAR
CREATE is a word that creates the dictionary entry. The dictionary entry contains a pointer to the DOES> part. So when the word is found in the dictionary it knows what to do.
, ( comma ) is just a simple word that gets a number from the stack and puts it in the dictionary.
And then there is the DOES> part, in this case seems to do nothing.
When we now enter 12 JVAR My2ndVar The variable with the name My2ndVar is created and available in the Forth Dictionary.
When the new Forth word My2ndVar is executed it gives a memory pointer to the address where the value of the variable My2ndVar is stored. To get the value ( 12 ) we can use the Forth word @
To change this to the behaviour of a “constant” where, when executed not a pointer but the value is on the stack, we could do something like
: My1stCONST My2ndVar @ ;
However this would be an uncommon way to create a constant as this is actually fetching a variable. Creating multiple constants would require for each constant also a variable.
Let us make a word JCONST to create a ‘real’ constant.
: JCONST CREATE , DOES> @ ;
The @ is now in the DOES> part.
32 JCONST My2ndCONST
creates the word My2ndCONST
The DOES> part uses the address and fetches ( @ ) the value.
A very powerful way to make defining words at your own flavor as everything can be adapted in this CREATE DOES> concept.
For example create double size variables initialized with the value 0
: JDVAR CREATE 0 , 0 , DOES> ;
or do you want something else like a constant with a value that increments each time with one when a new constant word is created?

Forth has advantages and disadvantages. Floating point math, use of text strings. It was always a bit different from other computer languages. Most times with what I would call ‘more contact to what is really happening in the system’. I liked using less variables and using the data stack.

In my brain came the idea that the most beautiful programs are the smallest ones. When I was repeatedly typing (almost) the same code (copy and paste was that time not as easy as nowadays) programs could be done differently (and better). When you expect to find here a lot of real Forth code that you can enter in any Forth system I must disappoint you. However I present some ideas and parts of code that you can use in your Forth system if you know some of the internal working of your Forth system and add some code to adapt it to your Forth system.

A (lazy) simple program to control your hardware in Forth only needs
1 :LAMP LAMP_CHILDROOM
2 :LAMP LAMP_LIVING
4 :LAMP LAMP_B
8 :LAMP LAMP_BEDROOM
If you have created a smart defining word :LAMP with your system suddenly can understand what to do when you type
OFF LAMP_LIVING
ON LAMP_BEDROOM
TOGGLE LAMP_CHILDROOM
TEST? LAMP_CHILDROOM
I used TOGGLE to switch it ON when the light was OFF or switch of OFF when it was ON.
TEST? to leave TRUE or FALSE on the stack depending on the current state.
OFF ON TOGGLE and TEST? can be implemented as constants that each push a different value on the stack.
:LAMP is used to define LAMP_CHILDROOM LAMP_LIVING LAMP_B LAMP_BEDROOM
The 1 2 4 or 8 are stored in these words so later on FORTH knows which hardware bit controls which lamp. The DOES> part is executed when the new defined words are executed.
It gives a pointer to the defined word so the correct hardware bit (and/or other parameters) that was stored during the <BUILD can be fetched.
OFF ON TOGGLE and TEST? pushed a value on the stack so the DOES> part can use it to determine what to do.
So on the stack are the bit/hardware parameters and what you like to do ( OFF ON TOGGLE or TEST? )
SWAP these, so what you want to do is on top of the stack. Using a CASE statement you can continue with the code to turn the bit/(hardware) high, low, toggle it or test the current state (and leave that as a flag on the stack).
To turn all the lights of you need something like
OFF LAMP_CHILDROOM
OFF LAMP_LIVING
OFF LAMP_B
OFF LAMP_BEDROOM
or
OFF OFF OFF OFF LAMP_CHILDROOM LAMP_LIVING LAMP_B LAMP_BEDROOM
This as each device needs its own control parameter when coded the way described above.
Some people don't like that.
This can be solved in different ways:
Method 2 could be OFF ON TOGGLE and TEST? are not constants that were pushed on the stack. Implement OFF ON TOGGLE and TEST? as words that change a variable
Method 3 could be don’t eat the value of OFF OF TOGGLE or TEST? from the stack.
Change the code so it is after (successful) execution still on the stack. (Otherwise leave a special number indicating there was an error)
Another option could be that you don’t like the spaces between the command and word at all.
2 :LAMP LAMP_LIVING
You do not want to create one word LAMP_LIVING
It should create multiple words (without spaces):
LAMP_LIVING_OFF
LAMP_LIVING_ON
LAMP_LIVING_TOGGLE
LAMP_LIVING_TEST?
This is also possible because :LAMP can define multiple words e.g.
2 2 2 2 :LAMP LAMP_LIVING_OFF LAMP_LIVING_ON LAMP_LIVING_TOGGLE LAMP_LIVING_TEST?
This as you can make :LAMP consisting of multiple defining words like
: :LAMP :LAMP_OFF :LAMP_ON :LAMP_TOGGLE :LAMP_TEST? ;
:LAMP_OFF has a CREATE DOES> to turn a bit off
:LAMP_ON has a CREATE DOES> to turn a bit on
:LAMP_TOGGLE has a CREATE DOES> to toggle a bit
:LAMP_TEST? has a CREATE DOES> to test a bit
Each of the defining words needs to know the hardware bit (in this case 2)
It is strange and can give errors if you need to do it as described before repeating 2 2 2 2.
Again this can be solved multiple ways:
One method is by duplicating the hardware bit (Except the last time)
: :LAMP DUP :LAMP_OFF DUP :LAMP_ON DUP :LAMP_TOGGLE :LAMP_TEST? ;
Another method is to make the code of the defining words :LAMP_OFF :LAMP_ON :LAMP_TOGGLE :LAMP_TEST? keeping the hardware bit on the stack
: :LAMP :LAMP_OFF :LAMP_ON :LAMP_TOGGLE :LAMP_TEST? DROP ;
The last word does not need to maintain the bit on the stack. However for consistency it let all words keep the hardware bit and DROP it at the end.
This way if you later-on add a new thing like :LAMP_BLINK you do not need to check which words change the stack.
This all to reduce the code from
2 2 2 2 :LAMP LAMP_LIVING_OFF LAMP_LIVING_ON LAMP_LIVING_TOGGLE LAMP_LIVING_TEST?
to
2 :LAMP LAMP_LIVING_OFF LAMP_LIVING_ON LAMP_LIVING_TOGGLE LAMP_LIVING_TEST?
What about improving the code so
2 :LAMP LAMP_LIVING
would create in the Forth dictionary
LAMP_LIVING_OFF LAMP_LIVING_ON LAMP_LIVING_TOGGLE LAMP_LIVING_TEST?
This is not very difficult. You need to know in detail how (your) Forth creates new words.
CREATE (or <BUILD) gets the new word that needs to come in the dictionary from the terminal input buffer (TIB). Adapt this so you start each time again at the same word LAMP_LIVING and add the _OFF _ON _TOGGLE _TEST?
You need to DIG in your system to check how this is implemented. (Perhaps you have the word DIG to check Forth words).
So modify Forths so not the next word from the terminal input buffer is fetched (and eaten) but a word is defined including _OFF _ON _TOGGLE or _TEST?

Unfortunate i learned that in eForth there is no CREATE DOES>.  However i expect some of the ideas presented still can be used. For example modifying the defining words so not only the word comes in the dictionary, also with suffixes appended as _OFF _ON _TOGGLE _TEST?

donderdag 10 december 2020

Testing two interesting 220V led light bulbs

 Recently i received two interesting main volt light bulbs from Aliexpress . These two light bulbs are both equipped with sensors. One has a PIR motion sensor. The other mentions a radar sensor. They both give light when someone is near the bulb and it is dark.
From both lamps several versions are available (Warm of Cold white and different watts).

PIR Lamp


Induction Lampe LED E27 B22 LED Night Light Lamp With PIR Motion Sensor Light bulb Luminaria Auto On/Off Detection Energy-saving.

I ordered 12W Cold White. And indeed it looks very cold white








"Radar" Lamp
Radar Motion Sensor E27 Led Lamp Bulb E27 85-265V Auto Smart Infrared Body Sensor Light Bulb For Home Stair Porch Aisle Garage
I ordered a 10W Cold White version

To compare the light bulbs i used a lamp socket with a main ( 220V ) connector and did some tests.
The led lamp with the PIR sensor has a little (additional) ball on top (for the sensor).
The led lamp with the 'radar' is, by just looking at it difficult to distinguish from an ordinary led lamp.


When connecting to mains both lamps first go on. I did not check if this was due to the design or due to the fact that i was near the bulbs.

After the last detection both lamps turn off after a delay of about 25 seconds.
After that they both only light up when sensing something if it is dark.
However the lamp with the PIR sensor is more sensible to light and for this lamp it needs to be a little more dark than for the radar lamp to turn on again when approaching the light bulb.

I did some simple tests to see if the lamps turn on when inside a bag, a box, or behind my computer screen. The lamp with the radar sensor was a little more sensible than the PIR sensor lamp. However the radar was less sensible than expected. So i have some doubts if it is really equipped with a radar sensor or just has another type of IR sensor. 
Also during these experiments when placing the PIR sensor in a bag it randomly turned on an of when nobody was near.


For a more extended test two lamps of a similar wattage should be tested including a power consumption measurement. Also a tear-down of the lamps would be interesting to check the sensors used. Especially for this 'radar motion detector lamp'.  At the moment i will not do such an extended test. I have seen some video's and there are several lamps with radar included. I don't know if there is a lot of variation between the sensibility of these lamps. 

To really know if these motion detection lamps will suit your needs and which lamp will be the best for which situation you will need to test them in the real location where you want to use them.

woensdag 9 december 2020

Arduino Uno enclosure

Today received some new mail items for Aliexpress. In the past i received items form each seller separately. However the last months i notice packages from several sellers get combined. I receive now packages containing several separate little packages.

Arduino Uno in enclosure (Front)


One item in my mailbag of today was a plastic Arduino enclosure. They are relative cheap and i have seen several pictures and video recordings where using this enclosure.
I ordered some to check if they fit my needs. Until now i used several times plastics plastic screws with my PCBs to put them better on my table.

Arduino Uno in enclosure (back)


 I like the plastic enclosure. I did find some little disadvantages:

  • Some Arduino shields have relative short legs and do not fit as nice as without the enclosure.
  • When putting a shield for the first time you must bend the shield legs a little, which is done better without the enclosure.
 Also in this blog a photo of the manual for assembling this enclosure. The enclosure came with a spare M2 screw and nut.



donderdag 3 december 2020

My first programmable Car

This week i took some picture of my car to share on my blog.  It is a "Fantastic Car with a Brain". You program the car and you decide the action,





This Hasbro Amaze-A-Matics programmable car comes with some plastic strips with ready to use programs. Also some cardboard strips are included that you can cut to create your own "programs". 




The card with the program is pulled under the car along two mechanical sensors on the left and right.
One side contains information for the wheels ( Left Straight Right ) and the other side info for the motor ( Forward, Neutral, Reverse ).


The programmable car was one of my toys as a child and i expect the first programming experience.
So below probably the first 'programs' ever that i created. Perhaps you can even find my first programming bug. (The white cardboard ones are my programs. The plastic black one is one of the programs the came with the car.
I remember cutting my own cardboard when i used up the pre-printed cardboard provided with this car. 
As the "program" contains no (conditional) branches or loops. In my current definition, i would not call  it a real program. This 'programmable' car (see picture below) perhaps moved me in the direction of computers and Ford Forth. 






vrijdag 20 november 2020

Found Emma 02 an RCA 1802 emulator

Just found Emma 02 , an 1802 Emulator that can emulates several RCA 1802 systems and could not resist trying a quick install, and it worked.

Internet home         https://www.emma02.hobby-site.com/
(Download             https://www.emma02.hobby-site.com/download.html )
Facebook               https://www.facebook.com/emma02.emu/
Github                    https://github.com/etxmato/emma_02

After the easy installation on my windows machine i did run it.
On the tab "Elf" i pushed at the [Start] button. (bottom left)In the green terminal screen 'For help type HELP.' at the >>> prompt type FOR NEW  or FOR OLD start a Forth.
(It is also possible to type FORTH , and the system wil ask OLD or NEW ) 

It is also possible to emulate other 1802 systems e.g. the COMX-35 (an RCA 1802 computer i never owned) that runs a Basic version.