26 Jan 2020

How to run Raspberrypi on QEMU emulator

Commands:
startx
sudo apt-get install raspberrypi-kernel-headers
sudo shutdown -h now
sudo apt install raspberrypi-ui-mods
sudo raspi-config
sudo apt-get update

SSH:
sudo raspi-config

Connect: 
(Install OpenSSH before)
ssh -p2222 -X pi@localhost
ssh pi@localhost -p 2222

IP:
hostname -I
10.0.2.15

qemu-img convert -f raw -O qcow2 2017-08-16-raspbian-stretch.img raspbian-stretch.qcow

Start:
-----
qemu-system-x86_64.exe -boot d -cdrom kolibri.iso -m 512
qemu-system-armw.exe -M versatilepb -cpu arm1176 -m 256 -hda 2019-09-26-raspbian-buster-lite.img -dtb versatile-pb.dtb -kernel kernel-qemu-4.19.50-buster -append 'root=/dev/sda2' -no-reboot
===
cd: <iso folder>
qemu-system-armw.exe -kernel ./kernel-qemu-4.4.34-jessie -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda raspbian-stretch-lite.qcow -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -net nic -nic user,hostfwd=tcp::2222-:22
===

- At the bottom of the screen. Type "pi" and hit enter.
- You will be prompted for a password, type "raspberry" and hit enter.
- If you wish to set a root password, type "sudo passwd root"
- From here you can continue to use the command line, but if you would prefer to use a window based desktop, type "startx"

25 Oct 2019

How to measure current with voltmeter only or multimeter without current measurement

Make a simple shunt and measure voltage drop on the shunt resistor.

to the circuit <---- < Shunt 2,4R or any low value resistor > ----> to the circuit 
*for better accuracy check the value of shunt if you can.

Calculate via Ohm's law:

I, A = Udrop, V / 2,4 R

Bingo!

24 Oct 2019

Arduino "Fireflies" Lamp with Light Detector & Sleep Mode

Arduino "Fireflies" Lamp with Light Detector & Sleep Mode

Board: 
Robotdyn Arduino Pro Mini 3.3V, 8MHz
(Attention! The wrong pinout by the manufacturer in the *pdf doc, use UNO's labels! pin 11 is PWM, not 12!)
 
Connection:
GND |-----< 9k1 >----- (A3) ------< LDR >-----> VCC 3.3V
GND |-----< cathode LED anode >-----< 240R >-----> to PWM pin (3, 5, 6, 9, 10, 11)

Energy-saving:
- Remove Power LED from the board
- Remove DC regulator


Arduino "Fireflies" Lamp with Light Detector & Sleep Mode

25 Sept 2019

How to add Entity Framework Core into ASP.Net Core project

Installation

1. Open a terminal and navigate into the project's folder
2. Use the following .NET Core CLI command from the operating system's command line to install or update the EF Core SQL Server provider

Global EF installation

dotnet ef must be installed as a global or local tool. Most developers will install dotnet ef as a global tool with the following command:

dotnet tool install --global dotnet-ef

https://docs.microsoft.com/en-us/ef/core/get-started/?tabs=netcore-cli

=============

Project

for MS SQL
dotnet add package Microsoft.EntityFrameworkCore.SqlServer

or for SQLite
dotnet add package Microsoft.EntityFrameworkCore.Sqlite 

modifier
-v // version
-v 2.2.0

3. Install tools to carry out EF Core-related tasks in your project, like creating and applying database migrations, or creating an EF Core model based on an existing database

dotnet add package Microsoft.EntityFrameworkCore.Design

For ASP.NET Core apps, this package is included automatically. Database provider design-time packages such as Microsoft.EntityFrameworkCore.SqlServer.Design are no longer required or supported from EF Core 2.0 and later, but aren't automatically removed when upgrading the other packages

4. To get the Package Manager Console tools for EF Core, install

dotnet add package Microsoft.EntityFrameworkCore.Tools


or install packages via NuGet

=============

Add Migrations

After you've defined your initial model, it's time to create the database. To add an initial migration, run the following command:

dotnet ef migrations add InitialCreate 

Update the database
Next, apply the migration to the database to create the schema.

dotnet ef database update

Remove a migration
Sometimes you add a migration and realize you need to make additional changes to your EF Core model before applying it. To remove the last migration, use this command. After removing the migration, you can make the additional model changes and add it again.

dotnet ef migrations remove

Revert a migration
If you already applied a migration (or several migrations) to the database but need to revert it, you can use the same command to apply migrations, but specify the name of the migration you want to roll back to.

dotnet ef database update LastGoodMigration

=============

Commands

dotnet ef migrations add
dotnet ef migrations list
dotnet ef migrations script
dotnet ef dbcontext info
dotnet ef dbcontext scaffold
dotnet ef database drop
dotnet ef database update


Popular Posts