I made a "Smartphone stand". It's a my first product!
My current smartphone is Huawei G620s. The stand use for displaying and charging on the desk.
Design:
The smartphone 3D modelind data was created by 123D design into toppled on its side. Also printing out use Scoovo studio into toppled on its side.
Memorandum:
The working create 3D data is summary according to the follows.
- Change view to TOP
- Use sketch tools, select Polyline. Write a triangle.
- Use sketch tools, select Offset. Make offset position in first triangle.
These two triangle shape is base of smartphone stand.
- Use construct tools, select Extrude and choice area of surrounding two triangle.
And, input extruding Z axis size.
You can see 3d triangle tube when move pan.
- Also you can make smartphone put place then use sketch rectangle and construct extrude tools.
I made two rectangle.
One is put smartphones base side, more one is front side.
- Made put place stick on smartphone base then use snap tool.
- The stand cut three holes that use combine subtract tool.
Holes are back panel center, front panel under and put place.
Previous make subtract shapes and move appropriate position.
These holes in order to pass through a USB cable.
Viewing is front and rear.
And it can use landscape.
3D Data File:
STL File.
THIS DATA FILE IS NO WARRANTY ANYTHING.
PrintingOut(Scoovo Studio):
That an object had done printing out it takes about 13 hours. (My 3D printer Scoovo C170 is too slow?)
G-code creating options are below.
- Quality is Fine.
- Support material is Existence.
- Raft is None.
Improvement:
Running time is too long.
A one of the method, printing quality adjust to rough.
I'm thought that at first it should cut down raw materials to reduce running time. In short, back panel's and other holes expands diameter. In addition more unused walls make holes...
Thursday, March 24, 2016
Tuesday, March 22, 2016
Linux IPC the Message Queue
Linux IPC Message Queue is inter process/thread exchanging message as you choose.
This examples are made two programs.
rcvmsg.c
"rcvmsg" functions.
1. Create message queue.
2. Waiting receive a message. It continue until "END" receiving.
3. Remove message queue.
sndmsg.c
1. Create message queue. If message queue don't exist then quit self.
2. Wait user input message.
3. Send a message.
"rcvmsg" run at first then late run "sndmsg".
"sndmsg" send "END" message when "rcvmsg" is going to final.
This examples are made two programs.
rcvmsg.c
#include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <string.h> main() { int msqid; key_t msgkey; struct msgbuf{ long mtype; char mdata[256]; }; struct msgbuf msgdata,*p; p = &msgdata; // Make Message queue key. msgkey = ftok("msgq.key",'X'); // Get Message queue ID. msqid = msgget(msgkey,IPC_CREAT|0666); // Message receive loop wile get "END" massage. while(1) { // Receive a Message. if(msgrcv(msqid,p,sizeof(p->mdata),0,IPC_NOWAIT)<=0) { printf("No message\n"); sleep(3); continue; } printf("message received from %ld\n%s\n",p->mtype,p->mdata); if(strncmp((char*)p->mdata, "END", (size_t)3)==0) break; } // Remove Message Queue msgctl(msqid, IPC_RMID, 0); }
"rcvmsg" functions.
1. Create message queue.
2. Waiting receive a message. It continue until "END" receiving.
3. Remove message queue.
sndmsg.c
#include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> main() { int msqid; key_t msgkey; struct msgbuf{ long mtype; char mdata[256]; }; struct msgbuf msgdata,*p; // Make Message queue key. msgkey = ftok(argv[1], 'X'); // Get Message queue ID. (Only get existing message queue.) msqid = msgget(msgkey, 0666); printf("QID = %d\n", msqid); if(msqid<0) return; p = &msgdata; printf("Enter message: "); fflush(stdin); fgets(p->mdata,BUFSIZ,stdin); p->gtmtype = getpid(); // Message send. msgsnd(msqid,p,sizeof(p->data),0); }"sndmsg" functions.
1. Create message queue. If message queue don't exist then quit self.
2. Wait user input message.
3. Send a message.
"sndmsg" send "END" message when "rcvmsg" is going to final.
Linux IPC the SEMAPHORE
Ho do the semaphore use?
Semaphore is Linux IPC resources for other process working synchronization.
Linux semaphore set has to create and initialize in first.
Displaying code, Linux IPC semaphore initialize.
seminit.c
Semaphore is created via the code you can confirm by command line.
$ ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
0x530120c6 0 hogehoge 666
Semaphore key is made by ftok() file "sem.dat". This file created by command line before running semaphore initialize program.
$touch sem.dat
Next, two processes inter synchronize code.
semproc.c
Semaphore is made "seminit.c" lock by "semproc" then you are press return-key will unlock semaphore and quit program.
When running "semproc", you run more "semproc" from other terminals. Later running "semproc" are waiting for locking semaphore. Previous running "semproc" quit as soon as next "semproc" take semaphore.
Finally, Used semaphore has to remove when all program end and don't need semaphore.
semrm.c
$ ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
$
Semaphore is Linux IPC resources for other process working synchronization.
Linux semaphore set has to create and initialize in first.
Displaying code, Linux IPC semaphore initialize.
seminit.c
#include#include #include #include #include #include union semun { int val; struct semid_ds *buf; unsigned short *array; }; int main() { key_t key; int semid; union semun arg; if ((key = ftok("sem.dat", 'S')) == -1) { perror("ftok"); exit(1); } /* create a semaphore set with 1 semaphore: */ if ((semid = semget(key, 1, 0666 | IPC_CREAT)) == -1) { perror("semget"); exit(1); } /* initialize semaphore #0 to 1: */ arg.val = 1; if (semctl(semid, 0, SETVAL, arg) == -1) { perror("semctl"); exit(1); } return 0; }
Semaphore is created via the code you can confirm by command line.
$ ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
0x530120c6 0 hogehoge 666
Semaphore key is made by ftok() file "sem.dat". This file created by command line before running semaphore initialize program.
$touch sem.dat
Next, two processes inter synchronize code.
semproc.c
#include#include #include #include #include #include int main(int argc, char** argv) { key_t key; int semID; struct sembuf sop; sop.sem_num = 0; // Semaphore number sop.sem_op = -1; // Semaphore operation is Lock sop.sem_flg = 0; // Operation flag // Create key if ((key = ftok("sem.dat", 'S')) == -1) { perror("ftok"); exit(-1); } // Get created semaphore if ((semID = semget(key, 1, 0)) == -1) { perror("semget"); exit(-2); } printf("Be going to lock--- -\n"); // Try to lock semaphore if (semop(semID, &sop, 1) == -1) { perror("semop()"); if(errno == EIDRM) { printf("errno=EIDRM, ERRNO=%d\n", errno); printf(" I'm going to CANCEL this procedure.\n"); return(1); } else { exit(-3); } } printf("--Locked!\n\n"); // You are proccesing code. printf("Press return --> Unclock, and quit self\n"); getchar(); // Try to release semaphore sop.sem_op = 1; if (semop(semID, &sop, 1) == -1) { perror("semop"); exit(1); } printf("--Unlocked\n"); return 0; }
Semaphore is made "seminit.c" lock by "semproc" then you are press return-key will unlock semaphore and quit program.
When running "semproc", you run more "semproc" from other terminals. Later running "semproc" are waiting for locking semaphore. Previous running "semproc" quit as soon as next "semproc" take semaphore.
Finally, Used semaphore has to remove when all program end and don't need semaphore.
semrm.c
#includeYou can confirm removing semaphore via command line.#include #include #include #include #include union semun { int val; struct semid_ds *buf; unsigned short *array; }; int main() { key_t key; int semid; union semun arg; if ((key = ftok("sem.dat", 'S')) == -1) { perror("ftok"); exit(1); } /* grab the semaphore set created by seminit */ if ((semid = semget(key, 1, 0)) == -1) { perror("semget"); exit(1); } /* remove */ arg.val = 1; if (semctl(semid, 0, IPC_RMID, arg) == -1) { perror("semctl"); exit(1); } return 0; }
$ ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
$
Sunday, March 20, 2016
I decided 3D modeling software!
I google estimations for 3D modeling software, so I decided to use '123D Design' by Autodesk.
How do I decided?
- Free, but it has enough functions.
- It's able to use cloud and local PC storage.
- Many persons said good estimations.
Before installing.
I want to raise the power on my PC that it has memory 4GBite and Windows7 32bit.
+ Memory up to 8GBite.
+ Upgrade free Windows10 with 64bit.for now.
At first, Windows7 upgrade to Windows10 32bit then Windows10 32bit change to Windows10 64bit. But, Changing 64bit can only clean install, so I did backup private files before those working.
WIndows7 upgrade Windows10 64bit.
1. Download Windows10 64bit iso file from MS and burn bootable medium DVD or USB.
2. Backup private files.
3. Upgrade Windows7 32bit to Windows10 32bit
4. Boot from Windows10 64bit.
5. Update Windows.(Do not new install)
6. Restore private files.
OK, My PC.
Setup 123D Design.
1. An installer file(Windows64bit) download from '123D Design'.
2. Downloaded installer file run and start installing.
3. Make 123D account.
Let's call it a day!
How do I decided?
- Free, but it has enough functions.
- It's able to use cloud and local PC storage.
- Many persons said good estimations.
Before installing.
I want to raise the power on my PC that it has memory 4GBite and Windows7 32bit.
+ Memory up to 8GBite.
+ Upgrade free Windows10 with 64bit.for now.
At first, Windows7 upgrade to Windows10 32bit then Windows10 32bit change to Windows10 64bit. But, Changing 64bit can only clean install, so I did backup private files before those working.
WIndows7 upgrade Windows10 64bit.
1. Download Windows10 64bit iso file from MS and burn bootable medium DVD or USB.
2. Backup private files.
3. Upgrade Windows7 32bit to Windows10 32bit
4. Boot from Windows10 64bit.
5. Update Windows.(Do not new install)
6. Restore private files.
OK, My PC.
Setup 123D Design.
1. An installer file(Windows64bit) download from '123D Design'.
2. Downloaded installer file run and start installing.
3. Make 123D account.
Let's call it a day!
I purchased personal '3D PRINTER' at last!
My 3D-Printer is 'SCOOVO C170' by Abee Corporation.
This 3D-Printer is able to make an small object that is up to 170mm(height) x 150mm(width) x 150mm(deps).
I have just unbox !
But, I could buy low price(32,800JPY, about 293dollars) it from BicCamera online store.
This 3D-Printer is able to make an small object that is up to 170mm(height) x 150mm(width) x 150mm(deps).
I have just unbox !
But, I could buy low price(32,800JPY, about 293dollars) it from BicCamera online store.
I
I'm exciting.
Working steps.
+ Setup 3D-Printer.
+ Install printing software.
+ Install 3D modeler software.
What shuld I use modeler software?
I have used a 3D modeling software 'Blender' a few years ago.
Subscribe to:
Posts (Atom)