Main Site Documentation

Saving data from fez to laptop without sd card


I wanna save my datas to excel over the bluetooth module. Has anybody got like that application or code? I created a gadgeteer project and wanted to embad a new code into my existing code.


The simplest way is to send your data as ascii over serial port profile and log the data in hyper terminal or teraterm on the pc


you can use my FEZ/PC Bluetooth File Transfer application

Notice: If you have a 64 bit Version of Windows on your PC, you must open Visual Studio as Administrator that the can be used.

Edit: Didn’t notice that you don’t have the data in a file, but perhaps you can use parts of the code anyway.


@ hagster - hi thank you for answer. I used teraterm and could to print values, but i want to save datas to excel.


@ RoSchmi - Hi thank you for answer. Can i use that app without sd card because i havn’t. and can i save datas to excel over that application?


The code on the FEZ Side must be changed, but it should not be to hard to change it to transfer a file from Ram instead of SD-Card


Saving as a native Excel file is complex. You can save as a comma seperated variable (CSV) file. Excel will open this fine.


@ hagster - Can i save my fez datas to csv file by teraterm?


@ RoSchmi - it’s quite complicated.can you give me any suggestion how i can change that to without Sd card?


BluetoothFtpClient is the appliaction for the PC. No changes should be required there.

Bluetooth_Ftp_Server is the application for the Spider.

You must select your Mainboard here:

//This application can be used on different mainboards
//The actually not used mainboards are outcommented
//#define Cobra_2
//#define CerbuinoBee

    #define Spider

//#define Raptor

then, if you have no SD-Card, outcomment the code that initializes the SD-Card

                // SD-Card stuff for Spider
                #if Spider || Raptor
                    //Mount SD-Card
                    String rootDirectory = sdCard.GetStorageDevice().RootDirectory;
                    if (VolumeInfo.GetVolumes()[0].IsFormatted)
                        _root = VolumeInfo.GetVolumes()[0].RootDirectory;
                        string[] files = Directory.GetDirectories(_root);
                        for (int i = 0; i < files.Length; i++)
                            // Debug.Print(files[i]);
                        Debug.Print("Cannot use SD-Card");

the bluetooth module should be on socket 8, otherwise change

const int MySocketNumber = 8; 

then your applications should compile and the devices should connect over bluetooth (see video)


@ RoSchmi - in the video you wrote “ftp President Secretservice”. what should i write? Because i wrote Pulse values and got that


then outcomment the line

// _root = NormalizeDirectory(ud.StartDirectory);

in the BtFtpServer.cs class

 // Find user
            UserData ud;
            for (int i = 0; i < _users.Count; i++)
                ud = (UserData)_users[i];
                if (ud.Username == Username)
                    if (ud.Password == Password)
                        _permissions = ud.Permissions;

                      //  _root = NormalizeDirectory(ud.StartDirectory);

                        _dir = _root;
                        DebugLine("User '" + Username + " logged in");
                        DebugLine("Directory is now " + _dir);
                        return true;
                        DebugLine("User '" + Username + " login failed; incorrect password");
                        return false;

now you should be able to connect with the command

ftp RoSchmi Password (don#t Forget to check the ftp-mode Checkbox)

then not file dependent commands should work


cmd gelb


If you want to write an excel file the simple way with formations, you could just save an html page with an single table and name the file .xls.
Never tried it my self, but it should work.
If you need no formations, use csv, as already suggested.


in the Server the possible Passwords i used were

ftp President SecretService


RoSchmi password

you can include other combinations in the code of the Server (see program)


then you must search this code section in the Class
here the selected file is send over the BT-Connection. You must adapt this code that your file from the Ram is transferred.

private void FTP_RETR(string Param)
            byte[] b = new byte[2048];
            FileStream iFile;
            long lRemain;
            if (!_permissions.CanDownload)
                client.Send(Encoding.UTF8.GetBytes("500 RETR not allowed for this user\n"));
                string sFile = NormalizeFile(Param);
                DebugLine("?? " + sFile);
                if (!File.Exists(sFile))
                    client.Send(Encoding.UTF8.GetBytes("500 " + RemoveRoot(sFile) + " does not exist\n"));
                        client.Send(Encoding.UTF8.GetBytes("150 opening data connection for " + FixPath(sFile) + "\n"));
                        // Send File in Chunks
                        iFile = new FileStream(sFile, FileMode.Open, FileAccess.Read);
                        lRemain = iFile.Length;

                        while (lRemain > 0)
                            if (lRemain < 2048)
                                b = new byte[lRemain];

                            DebugLine("## Sending " + b.Length + " bytes; " + lRemain + " remain...");
                            iFile.Read(b, 0, b.Length);
                            //client.Send(Encoding.UTF8.GetBytes("125 Send Data \n"));
                            lRemain -= b.Length;
                        client.Send(Encoding.UTF8.GetBytes("226 Transfer complete.\n"));
                    catch (Exception)
                        client.Send(Encoding.UTF8.GetBytes("456 Transfer failed!\n"));

I am away now for a while, bye


@ Reinhard Ostermeier - I had pulse oximeter module and every foour seconds i get values from module. and I want to save values to excel or csv file over the bluetooth module that my fez doesn’t connect to laptop with usb hub. I’m not programist. i’m just try to find out the simple way for solving that problem.


Well if it’s just for saving the data in a format excel can open, then I would use CSV.
Every line is a row.
Columns are separated by comma ‘,’.
Any program like Excel (OpenOffice clac, …) can open and save this format.


there are at least two different ways you can use.
The first way is that you collect your data in a data structure as a file, an Array or an ArrayList. If you are ready with collecting data you stop collecting and transfer all your data in one batch in a file on your PC. For this way you can adapt my my BtFtp Program.

The second way is, that you “stream” your data over the Bluetooth Connection, catch the incoming data with a program on your PC and write the data to a file when you want to stop collecting.

Did you get my BtFtp Programm working?


@ RoSchmi - Hi. yes it worked but it didn’t send any data to pc because i havn’t xml doc or any data collection so i get momentary values. and i don’t know how i can collect them.Should i make another project for data collection or i can solve it with adding a few line code to my gadgeteer project.


I can send you another PC project that has the functions you want. If you send me a direct message with your E-Mail address, I can send it as zip file.