Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - luckowner

Pages: [1] 2
1
The protocol is quite simple, for the sound card each "sentence" consists of 5 bytes:

Code: [Select]
        struct DataSentence {                                   
            uint8_t    Address =            0;                 
            uint8_t    Command =            0;
            uint8_t    Value =              0;
            uint8_t    Modifier =           0;                   
            uint8_t    Checksum =           0;
        };

You can see how the bytes are unpacked on the Serial tab of the Sound Card firmware. Commands are defined in the SoundCard.h file.

On the TCB side you can see the mapping between TCB functions and Sound Card commands in OP_Sound.h and you can see the very simple functions for sending the sentence over the serial port in OPSoundCard.cpp.

The process is basically the same for communicating with the Scout and Sabertooth serial controllers, except those use 4 byte sentences (Address, Command, Value, Checksum) - they don't have the "Modifier" byte.

The Address is unique to each device and prevents the Sabertooth from responding to commands for the sound card, or the sound card responding to commands for the Scout, etc... The addresses are hardcoded, here is the current list:
Pololu Drive - 10 (0x0A)
Pololu Turret - 13 (0x0D)
Sabertooth Drive - 128 (0x80)
Scout Drive - 131 (0x83)
Scout Turret - 132 (0x84)
Sabertooth Turret - 135 (0x87)
OP Sound Card - 218 (0xDA)

If you are just re-creating the sound card where the only difference is the way acceleration/deceleration is handled, just give your device the same address as the OP Sound Card (218). In other words, this is simply an exercise in modifying the existing OP Sound Card firmware, as you have already discussed.

If you are creating a device with all kinds of new features, you will have to give it a different address and then define your commands to do whatever you want (value and modifier are optional). However, I think the problem you will quickly run into is that you will want to issue commands that the TCB doesn't have and doesn't know about (in other words, new Functions). Adding new functions to the TCB requires not only changes to TCB firmware but also changes to OP Config, changes to the wiki, etc, etc...  So that I am probably not going to do.

You may find yourself creating a whole new TCB, or maybe a whole new product entirely. Even so, I hope looking at the code from this project will be useful to you.
Thank you for your answer, it is really useful. I think the light card will be a new product,  the sound card is just a branch. As your trigger source and actions are already perfect, so I don't think I need to develop some new commands. What I have to do is to focus on developing a new light card hardware.
Model hardware development is a hobby I like very much.  I am very happy to make friends like you through the Internet. Your work makes my truck model more realistic. After the project is completed, I will share all the code and hardware with you. You can decide whether to integrate it into TCB.
Thanks again for your excellent work and best wishes.

2
Hi Luckowner, thanks for bringing those threads to my attention. It seems some progress has been made on the PJRC forums with sound sampling, although I see for now it only works with RAW files. It would be ideal if Paul from PJRC can include this feature into his official Audio library, and maybe he will be able to do so eventually.

Unfortunately I have no time at all for development right now, so I can not be of much help to you. You seem to have come quite far already, I think if you stare at the code long enough you can see what I have done and probably figure out how to make the changes you need. Start small, make one change at at time and test, and through slow experimentation my experience is that you can eventually go quite far. I'm sorry I can't be of more assistance, but I wish you good luck and please let us know if you have success!
I also noticed that Paul said that he plans to update the audio library this summer. Changing the playback speed is one of the important content. So I am going to wait for a while, so that I have more time to do other things.I want to develop a more complete light card based on your serial communication protocol. The purpose is to control many lights on the truck and realize many complex functions. For example, the headlights and taillights of the Scania truck have a flowing water effect.
You have finished controlling the sound and ESC through the serial port in your program, and the serial port protocol is complete. So I think it will be much easier. I am currently reading about the communication between the sound card and TCB. It would be great if you can tell the standard of the protocol, it will save a lot of time.
Best wishes.

3
Hi LukeZ
   Long time no see. After a long busy day, I finally have time to do something I like. I want to discuss with you some of the problems of engine sound simulation. In fact, I asked you about this issue last year.  For the truck model, or the moving tank model. Keeping the engine sound synchronized with speed and acceleration is important. So I think resampling the sound will be more effective than simply playing another sound. I have found some topics on this issue, and after verification they really work.
There is a discussion about this issue here.  https://forum.pjrc.com/threads/44377-SD-Audio-playback-speed?highlight=Speed+playback
Here is its github.  https://github.com/newdigate/Audio/commit/fe2f8dace558614d8a48cb00fc47aecc0c7a1960
   I'm trying to integrate your content about engine sound simulation.I will delete acceleration and deceleration and so on.The idle sound will be left.  The rest of the engine sound will be resampled to the idling sound. This avoids non-smooth transitions. Can you give me some advice?
   At the same time, in order to make the engine sound more real, some random explosion sounds can be added.
   https://forum.pjrc.com/threads/52942-The-sound-of-a-motor-humming-on-a-teensy-3-2?highlight=Speed+playback
   Best wishes.

4
TCB Dev / Re: Testing TCB Firmware with Stock Arduino Mega
« on: October 28, 2019, 06:53:26 AM »
I think that the acceleration sound should change with frequency instead of just playing in the original sound. Have you tried this? I am trying to do this, but I have only little time.
I am not sure I understand exactly what you are asking. But I will say, the current audio capabilities of the Teensy do not allow us to speed up or slow down a .wav file. If we want an acceleration sound that sounds faster, we have to create two sound files - one slow, one fast.

Before that, I think I should have perfect hardware first. Light card is useful for tucks as there are always many lights on a truck.This well be a fully new design.
You might also be interested in an earlier project of mine called Open Source Lights (OSL). It is not very sophisticated but it does have a lot of options for lights on cars/trucks. You can read about it here - Open Source Lights - Arduino based RC Light Controller

I think I have a bad programmer. So the Hex may not be on the TCB. The light don't work. So I have to buy a new one. Thank you for your suggestion.I will tell you if there is any progress.
AVRDUDE should tell you (through the IDE or the command line, whichever one you are using) if the burn bootloader failed. But a bad programmer is very often a problem. I have used this one with success (set it to 5v).

It's hard to tell exactly from your picture, but I don't see a USB connector. Did you go with your previous plan of using a separate board for the bootloader chip?
Yes ,I want an acceleration  sound  when PWM frequency is high, and a slow sound  when the frequency is low. So I can just need a idle sound to creat all the sound for all of the PWM.I don't need any other thing. And it is what I will do with your code.
I have see the light card, another great job. I will see more when the sound card and TCB is OK.
I have got a new programmer and it is OK. I am working on some test.

5
TCB Dev / Re: Testing TCB Firmware with Stock Arduino Mega
« on: October 23, 2019, 02:09:17 AM »
Hi Luck. I am very impressed with your work on the miniature sound card, excellent job. Are you use a 4-layer board?

With the elimination of the Teensy and the reduction in size, production costs of such a board should be much more reasonable. I don't know if you have any contacts with Chinese manufacturing but there might be a greater willingness for someone to take this to market than the existing design.

As for the TCB - yes, it does use a custom bootloader, I have attached it to this post along with some instructions if you want to use it. The main difference is that it has been reduced in size from the standard bootloader and it also permits flashing on an alternate serial port depending on the position of Dipswitch 5 (Arduino A12, ATmega2560 pin number 85, port K4). When this pin is held to Gnd the processor will accept firmware flashing through Serial 0 (USB on the stock TCB board), when held to +5v it will accept firmware flashing through Serial 1.

However you can still use the stock Arduino bootloader since we usually don't need the alternate flashing port. Everyone here using off-the-shelf Arduino Megas are using the stock bootloader.

You mention that you flashed the bootloader, but you didn't say whether you had flashed the firmware. After you burn the bootloader then flash the latest firmware. After both of those are done then you can try to connect. I don't know if you are having a problem at the firmware stage or the connecting stage.

If you are having problems flashing the firmware, you can try to flash a simple test sketch from the Arduino IDE, something like blink an LED. See if the IDE has problems or not.

For connecting, have you tried the alternate connection method where you connect first via Snoop, and once that has been established then click the Connect button?

Let me know what you find and I will help you out.
I just use a 2-layer board because I don't need to use all the pin of MK20. And the 2-layer board is cheap. Many of my friend is very interesting in this little sound card.Your work is very good, I can only improve a little.I think that the acceleration sound should change with frequency instead of just playing in the original sound. Have you tried this? I am trying to do this, but I have only little time.
Before that, I think I should have perfect hardware first. Light card is useful for tucks as there are always many lights on a truck.This well be a fully new design.
For TCB . I think I have a bad programmer. So the Hex may not be on the TCB. The light don't work. So I have to buy a new one. Thank you for your suggestion.I will tell you if there is any progress.

6
TCB Dev / Re: Testing TCB Firmware with Stock Arduino Mega
« on: October 22, 2019, 11:23:10 AM »
Dear LukeZ, long time no see, I my very busy before, and now I can take a break.
I have made some sound card without teensy, and it works well. So my next step it to design some TCB card for my trucks. I wound make you a surprise when all the things finshed, but TCB does not work. So I have to get some help from you.
In fact I have made some TCB from empty pcb and new atmega2560. Is the bootloader for TCB  special? I use stk500boot_v2_mega2560.hex as bootloader, is that right? When I finished flash the bootloader , I connect TCB with USB but OP config can't connect.
Can you tell my some detials about how can I make a empty 2560 be a TCB? Thank you.
And here is my sound card, It is just 5*3 cm .

7
There is a lot of forum spam going on (as I know from here), but hopefully they will respond to your message and allow you in.

May I ask what country are you located in? I am interested to know all the countries that Open Panzer users are from.
hi LukeZ
Good news
my DIY teensy works. And I have made the bootloader outside the board. So I have a very small board now.
Next step , I will make the MK1 more small. I find it is wonderful for 1/14 truck model. But it is a little big too. In the same way. I want to make the usb part out of the board. And delate some function. The smoke, light ,and something else .
Thank you again for your wonderful work. I will post all the design when all my work finished.

8
There is a lot of forum spam going on (as I know from here), but hopefully they will respond to your message and allow you in.

May I ask what country are you located in? I am interested to know all the countries that Open Panzer users are from.
I am from China. And I have to use a VPN to visit the website in other country.

9
I have not personally designed a DIY Teensy board myself, so I can't speak from experience. But looking at the schematic I see no reason why separating the bootloader chip onto its own board wouldn't work (in other words, I think it should work fine).

The only way to know will be to test. Of course you can also get some very good advice at the PJRC forum. They have a whole section called "Project Guidance" where you can describe your project and ask for input. There have been several threads in the past about people designing their own Teensy-compatible boards and the usual response is that it's not worth the effort especially for low production numbers. But everyone has their own idea about what efforts are worth making. If you have the time and the ability, as it seems you do, then it could be a rewarding experience.
Unfortunately,my IP is banned.This is my first time to visit PJRC forum and I don't know the problem. I have just send a email , and waiting for replay. Anyway my design is going on, and I will make you know if it works.

10
Thanks. I see now the forum would not allow posting .ini files, I have changed that for anyone in the future who needs to attach one.

Anyway, here again we have another bug which I have fixed, and you will need to flash new firmware (v0.93.51).

Very few people in the world have even tested one of these sound cards, and I think even of those few people they are all using it with with the TCB - in other words, not in RC mode as you are. Therefore I am not surprised you are finding some bugs. I do appreciate your testing which is helping me perfect the firmware.

Let me know if you notice anything else strange!
Hi LukeZ,I have a question in design a diy teensy. Teensy mainly based on MK20DX256VLH7. And the pre-loaded bootloader chip make it possible for teesny to load arduino code.So if a want to design a teensy based boad.I can just make two board. One is pre-loaded bootloader board with a small bootloader chip and Micro usb on it. The other have MK20DX256VLH7 and the left.Is that right? Do you have any experience if the bootloader chip must be attached to the main board anytime?You know it is impoartant for me,because I want to design a very small board. And I have more than 20 models,so I think it’s worth making a new design. Any suggestion?

11
Thanks. I see now the forum would not allow posting .ini files, I have changed that for anyone in the future who needs to attach one.

Anyway, here again we have another bug which I have fixed, and you will need to flash new firmware (v0.93.51).

Very few people in the world have even tested one of these sound cards, and I think even of those few people they are all using it with with the TCB - in other words, not in RC mode as you are. Therefore I am not surprised you are finding some bugs. I do appreciate your testing which is helping me perfect the firmware.

Let me know if you notice anything else strange!
It works and I think I will use TCB, but I want a small one. So I need to design another hardware base on yours.

12
Can  you describe in more detail the issue with Switch 5? It is a problem specifying the switch function in INI Creator? Or does that part work but the function doesn't trigger correctly on the sound card itself?

Can you also post your INI file?

I will think about the engine speed request. All that sort of thing is possible with the TCB but the configuration framework on this device is much more simple as you can see (no dynamic allocation of functions with triggers). In the meantime, if you are using a programmable transmitter you can accomplish what you propose with a transmitter mix. But it depends on your transmitter, it is true that most pistol-grip car radios do not have that level of programmability.
I think I have made a right INI file, and I will post it in the attachment. RC3 make sound when turn left or turn right. RC4 is two kind of horn. RC5 is a beep sound during backing. I'm using a programmable transmitter graupner mc 20. And RC1-RC4 have the right output,but rc5 don't work.

13
STM32 might also be a good choice, but I already had experience with ARM and the work PJRC has done, especially with the Audio library, has saved us hundreds and probably thousands of hours of work. Because I don't have a lot of free time and no one is paying me to do this I try to use what will be the most direct route to the goal!

If anyone wants to port my code (either the sound card or the TCB) to STM32 that would be an interesting project and they are welcome to do so.
I want to try but I think the first thing is to design a little board. Another bug .When I set RC 5 to switch mode there is no use. I'm following your code but I think it will take some time. And a suggestion, can your make some sound at a specific  speed? For example, when the truck is backing up ,there is always a Beep. I am trying to followyour code and make some changes. The big logic is basically understood.

14
Very good! Thank you for bringing this to my attention as it is important to fix any bugs or errors in the code.

I do not think it will be very easy to eliminate the Teensy, but you can try. In addition to the main MK20DX256VLH7 processor which you can obtain anywhere, you can purchase from PJRC a pre-loaded bootloader chip that will give you compatibility with Teensyduino, see this link. There are two options, both have the same functionality, but the MKL02 is smaller in size. You can then follow the Teensy 3.2 schematic to match up the MK20DX256 pins with "Teensy pins."

The designer of the Teensy, Paul Stoffregen, has said before that routing for the Teensy 3.2 was a difficult job and I believe him. However you will not need to use very many pins so that will be some help to you. If you are good at board design and routing I am sure it is possible, but it may not be worth the effort. Already your board design is considerably smaller than mine.

Regardless, keep us updated on your progress!
I think Paul Stoffregen is right too, but I will try. I'm following the schematic. The mirco usb part is not necessary for this card,and I can put all the pin at one side.Two side board is enough and difficulty will be greatly reduced.
Just a suggestion, why don't you use stm32? Of couse ,Freescale is more powerfulIt, but stm32 is more cheap and more popular.

15
Hi Luckowner. There might be a bug in the sound card firmware, I have posted an update (v0.93.50). Please re-flash your soundcard with this update and let me know if that fixes it.
It realy works! Thank you. I use this card on my 1/14 Scania truck,it's too big for me. So my next step is to make a little one base on your hardware.In fact,design has been completed but production has not yet started. I am not sure if I can make one without teensy, so all the components can be placed on one board. It is very important to me because I want to make it as small as possible.
The attach picture show my first design with teensy.  I'm trying to avoid using it.This board is 23*52mm I think I can make it more small.

Pages: [1] 2